Hi Atif, I'd ;ove to get a better understanding of jayrock.
That didn't work. It seems the placement object can't be recreated. Do
I need to add an attribute or structure it in a certain way?
====================================================================================================
Err: SaveBlock Failed with Don't know how to import Placement from
JSON.
====================================================================================================
public class PlacementHandler : JsonRpcHandler,
System.Web.SessionState.IRequiresSessionState
{
[JsonRpcMethod("setPlacement", Idempotent = true)]
[JsonRpcHelp("Save the current locations to the db.")]
public string SetPlacement(JsonArray parts)
{
try {
string s = "";
IList Parts = (Placement[])JsonConvert.Import(typeof
(Placement[]), parts.ToString());
//for (int i = 0; i < parts.Length;i++ ) {
// Placement p = (Placement)JsonConvert.Import(typeof
(Placement), parts[i].ToString());
//}
return "success";
} catch (Exception ex) {
fbisPersonalCms.Utils.JsonError err = new
fbisPersonalCms.Utils.JsonError("SaveBlock Failed with " + ex.Message,
0);
return JsonConvert.ExportToString(err);
//throw;
}
}
}
public class Placement
{
public Placement(string ca, bool isContent, int position, int id)
{
this.ca = ca;
this.isContent = isContent;
this.position = position;
this.id = id;
}
public string ca;
public bool isContent;
public int position;
public int id;
}
On Oct 6, 9:11 pm, Atif Aziz <
aziza...@gmail.com> wrote:
> Instead of this:
>
> > (IList)JsonConvert.Import(typeof(IList),parts.ToString());
>
> Try this:
>
> > (Placement[])JsonConvert.Import(typeof(Placement[]),parts.ToString());
>
> If it works and you're interested on why, I can expand further.
>
> - Atif
>
> On Tue, Oct 6, 2009 at 5:31 PM, FruitBatInShades <
fruitbatinsha...@gmail.com