public ActionResult DropView() { Models.mysqlConnector objConnector = new Models.mysqlConnector(); ViewBag.treeDataSource = objConnector.GetPersonContacts(); List <SchedulerDataModel> eventListData = new List <SchedulerDataModel>(); eventListData = objConnector.GetEvents(); ViewBag.Jobs = objConnector.GetJobs(); foreach (SchedulerDataModel objemodel in eventListData) { string[] newArr = new string[] { }; List <string> list = new List <string>(); string AttendeesData1 = objemodel.attendeesAsString; if (AttendeesData1 != string.Empty) { string[] _arr = AttendeesData1.Split(','); foreach (string stringCon in _arr) { list.Add(stringCon); } newArr = list.ToArray(); objemodel.Attendees = newArr; } else { objemodel.Attendees = new string[] { } }; objemodel.Subject = objemodel.Job; } ViewBag.datasource = eventListData; ViewBag.Resources = new string[] { "Jobs" }; return(View()); }
public ActionResult BindEvent() { Models.mysqlConnector objConnector = new Models.mysqlConnector(); List <SchedulerDataModel> eventListData = new List <SchedulerDataModel>(); eventListData = objConnector.GetEvents(); foreach (SchedulerDataModel objemodel in eventListData) { string[] newArr = new string[] { }; List <string> list = new List <string>(); string AttendeesData1 = objemodel.attendeesAsString; if (AttendeesData1 != string.Empty) { string[] _arr = AttendeesData1.Split(','); foreach (string stringCon in _arr) { list.Add(stringCon); } newArr = list.ToArray(); objemodel.Attendees = newArr; } else { objemodel.Attendees = new string[] { } }; objemodel.Subject = objemodel.Job; } return(Json(eventListData, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadData(Params param) { DateTime start = param.StartDate; DateTime end = param.EndDate; Models.mysqlConnector objConnector = new Models.mysqlConnector(); var data = objConnector.GetEvents(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateData(EditParams2 param) { Models.mysqlConnector objConnector = new Models.mysqlConnector(); if (param.action == "insert" || (param.action == "batch" && param.added != null)) // this block of code will execute while inserting the appointments { var value = (param.action == "insert") ? param.value : param.added[0]; int intMax = db.ScheduleEventDatas.ToList().Count > 0 ? db.ScheduleEventDatas.ToList().Max(p => p.Id) : 1; DateTime startTime = Convert.ToDateTime(value.StartTime); DateTime endTime = Convert.ToDateTime(value.EndTime); SchedulerDataModel appointment = new SchedulerDataModel() { Id = intMax + 1, StartTime = startTime.ToLocalTime(), EndTime = endTime.ToLocalTime(), Job = value.Job, Attendees = value.Attendees, Event = value.Event, ResourceId = value.ResourceId, IsAllDay = value.IsAllDay, StartTimezone = value.StartTimezone, EndTimezone = value.EndTimezone, RecurrenceRule = value.RecurrenceRule, RecurrenceID = value.RecurrenceID, RecurrenceException = value.RecurrenceException, }; string resp = objConnector.AddEvent(appointment); ViewData["result"] = resp; } if (param.action == "remove" || (param.action == "batch" && param.deleted != null)) // this block of code will execute while removing the appointment { int key = Convert.ToInt32(param.key); SchedulerDataModel obj2 = param.deleted.FirstOrDefault(); SchedulerDataModel appointment = new SchedulerDataModel(); if (appointment != null) { ViewData["result"] = objConnector.DeleteEvent(obj2.Id); } } var data = objConnector.GetEvents(); return(Json(data, JsonRequestBehavior.AllowGet)); }