public static void RemoveData(int key)
        {
            ScheduleAppointmentsObjData removeApp = GetAllRecords().Where(c => c.ID == key).FirstOrDefault();

            if (removeApp != null)
            {
                GetAllRecords().Remove(removeApp);
            }
        }
        public static ScheduleAppointmentsObjData GetObjectValue(Dictionary <string, object> objValue)
        {
            Dictionary <string, object> KeyVal       = objValue;
            ScheduleAppointmentsObjData appointValue = new ScheduleAppointmentsObjData();

            foreach (KeyValuePair <string, object> keyval in KeyVal)
            {
                if (keyval.Key == "ID")
                {
                    appointValue.ID = Convert.ToInt32(keyval.Value);
                }
                else if (keyval.Key == "Subject")
                {
                    appointValue.Subject = Convert.ToString(keyval.Value);
                }
                else if (keyval.Key == "Location")
                {
                    appointValue.Location = Convert.ToString(keyval.Value);
                }
                else if (keyval.Key == "StartTime")
                {
                    appointValue.StartTime = Convert.ToDateTime(keyval.Value).ToString("MM'/'dd'/'yyyy hh:mm:ss tt");
                }
                else if (keyval.Key == "EndTime")
                {
                    appointValue.EndTime = Convert.ToDateTime(keyval.Value).ToString("MM'/'dd'/'yyyy hh:mm:ss tt");
                }
                else if (keyval.Key == "Description")
                {
                    appointValue.Description = Convert.ToString(keyval.Value);
                }
                else if (keyval.Key == "AllDay")
                {
                    appointValue.AllDay = Convert.ToBoolean(keyval.Value);
                }
                else if (keyval.Key == "Recurrence")
                {
                    appointValue.Recurrence = Convert.ToBoolean(keyval.Value);
                }
                else if (keyval.Key == "RecurrenceRule")
                {
                    appointValue.RecurrenceRule = Convert.ToString(keyval.Value);
                }
                else if (keyval.Key == "StartTimeZone")
                {
                    appointValue.StartTimeZone = (keyval.Value == null) ? (string)keyval.Value : Convert.ToString(keyval.Value);
                }
                else if (keyval.Key == "EndTimeZone")
                {
                    appointValue.EndTimeZone = (keyval.Value == null) ? (string)keyval.Value : Convert.ToString(keyval.Value);
                }
            }
            return(appointValue);
        }
        public static void UpdateData(object value)
        {
            ScheduleAppointmentsObjData obj = GetObjectValue(value as Dictionary <string, object>);
            var filterData = GetAllRecords().ToList().Where(c => c.ID == Convert.ToInt32(obj.ID));

            if (filterData.Count() > 0)
            {
                ScheduleAppointmentsObjData appoint = GetAllRecords().Single(A => A.ID == Convert.ToInt32(obj.ID));
                appoint.StartTime      = obj.StartTime;
                appoint.EndTime        = obj.EndTime;
                appoint.Subject        = obj.Subject;
                appoint.StartTimeZone  = obj.StartTimeZone;
                appoint.EndTimeZone    = obj.EndTimeZone;
                appoint.Recurrence     = obj.Recurrence;
                appoint.AllDay         = obj.AllDay;
                appoint.RecurrenceRule = obj.RecurrenceRule;
            }
        }
Ejemplo n.º 4
0
        protected void fileUpload1_Complete(object sender, Syncfusion.JavaScript.Web.UploadBoxCompleteEventArgs e)
        {
            string txt = HttpContext.Current.Server.MapPath("uploadfiles");

            txt = txt + "\\" + e.Name;
            ScheduleImport importApps = new ScheduleImport();
            var            app        = importApps.renderingImportAppointments(txt);
            var            records    = data.GetRecords();
            int            maxID      = Convert.ToInt32(records.Max(x => x.ID));
            List <ScheduleAppointmentsObjData> list = new List <ScheduleAppointmentsObjData>();

            for (var i = 0; i < app.Count; i++)
            {
                int ID = maxID + 1;
                ScheduleAppointmentsObjData row = new ScheduleAppointmentsObjData(ID, app[i].Subject, app[i].Location, app[i].StartTime, app[i].EndTime, app[i].Description, null, null, app[i].Recurrence, null, null, app[i].AppointmentCategorize, null, app[i].AllDay, null, null, app[i].RecurrenceRules, null, null);
                records.Add(row);
            }
            this.Schedule1.AppointmentSettings.DataSource = records;
        }
 public static void CrudResult(List <object> added, List <object> changed, List <object> deleted)
 {
     if (added != null && added.Count > 0)
     {
         ScheduleAppointmentsObjData appointValue = GetObjectValue(added[0] as Dictionary <string, object>);
         GetAllRecords().Insert(0, appointValue);
     }
     if (changed != null && changed.Count > 0)
     {
         ScheduleAppointmentsObjData value = GetObjectValue(changed[0] as Dictionary <string, object>);
         var filterData = GetAllRecords().ToList().Where(c => c.ID == Convert.ToInt32(value.ID));
         if (filterData.Count() > 0)
         {
             ScheduleAppointmentsObjData appoint = GetAllRecords().Where(A => A.ID == Convert.ToInt32(value.ID)).FirstOrDefault();
             appoint.StartTime      = value.StartTime;
             appoint.EndTime        = value.EndTime;
             appoint.Subject        = value.Subject;
             appoint.StartTimeZone  = value.StartTimeZone;
             appoint.EndTimeZone    = value.EndTimeZone;
             appoint.Recurrence     = value.Recurrence;
             appoint.AllDay         = value.AllDay;
             appoint.RecurrenceRule = value.RecurrenceRule;
         }
     }
     if (deleted != null && deleted.Count > 0)
     {
         foreach (var dele in deleted)
         {
             ScheduleAppointmentsObjData value     = GetObjectValue(dele as Dictionary <string, object>);
             ScheduleAppointmentsObjData removeApp = GetAllRecords().Where(c => c.ID == value.ID).FirstOrDefault();
             if (removeApp != null)
             {
                 GetAllRecords().Remove(removeApp);
             }
         }
     }
 }
        public static void InsertData(object value)
        {
            ScheduleAppointmentsObjData appointValue = GetObjectValue(value as Dictionary <string, object>);

            GetAllRecords().Insert(0, appointValue);
        }