Esempio n. 1
0
        public ActionResult SaveDefault(IEnumerable <HttpPostedFileBase> UploadDefault)
        {
            var destinationPath = "";

            foreach (var file in UploadDefault)
            {
                var fileName = Path.GetFileName(file.FileName);
                destinationPath = Path.Combine(Server.MapPath("~/App_Data"), fileName);
                file.SaveAs(destinationPath);
            }
            ScheduleImport importApps = new ScheduleImport();
            var            app        = importApps.renderingImportAppointments(destinationPath);
            var            dataSource = new ScheduleDataDataContext().DefaultSchedules.ToList();
            int            intMax     = dataSource.Max(a => a.Id);

            for (var i = 0; i < app.Count; i++)
            {
                app[i].Id = intMax + 1;
                DefaultSchedule row = new DefaultSchedule(app[i].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);
                dataSource.Add(row);
                intMax = app[i].Id;
            }
            ViewBag.dataSource     = dataSource;
            TempData["dataSource"] = dataSource;
            return(RedirectToAction("ScheduleImport", "ScheduleImport"));
        }
Esempio n. 2
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;
        }