public JsonResult GetArasWork() { List <CalendarPatial> calendarList = new List <CalendarPatial>(); if (Session["innovator"] != null) { Innovator inn = (Innovator)Session["innovator"]; Item work_note = inn.newItem("work_note", "get"); work_note = work_note.apply(); if (work_note.isError() == false) { for (int i = 0; i < work_note.getItemCount(); i++) { Item work = work_note.getItemByIndex(i); CalendarPatial cal = new CalendarPatial(); cal.id = work.getProperty("id", ""); cal.title = work.getProperty("title", ""); cal.description = work.getProperty("content", ""); cal.start = work.getProperty("startdate", ""); cal.end = work.getProperty("enddate", ""); cal.className = "plm_work"; calendarList.Add(cal); } } } return(Json(calendarList, JsonRequestBehavior.AllowGet)); }
public JsonResult NewWork(CalendarPatial calendar) { Dictionary <string, string> result = new Dictionary <string, string>(); if (Session["innovator"] != null) { Innovator inn = (Innovator)Session["innovator"]; Item work_note; if (string.IsNullOrWhiteSpace(calendar.id)) { work_note = inn.newItem("work_note", "add"); } else { work_note = inn.newItem("work_note", "edit"); work_note.setAttribute("where", "id='" + calendar.id + "'"); } work_note.setProperty("title", calendar.title); work_note.setProperty("content", calendar.description); work_note.setProperty("startdate", calendar.start + "T00:00:00"); if (calendar.end == "") { calendar.end = calendar.start; } work_note.setProperty("enddate", calendar.end + "T00:00:00"); string beforeAml = work_note.dom.OuterXml; work_note = work_note.apply(); if (work_note.isError()) { result.Add("error", work_note.getErrorString()); result.Add("error_aml", beforeAml); } else { result.Add("result", work_note.dom.OuterXml); } } return(Json(result)); }