コード例 #1
0
        private void schedulerStorage1_AppointmentDeleting(object sender, PersistentObjectCancelEventArgs e)
        {
            try
            {
                Nested_CheckSecurityForDeletion();
            }
            catch (AccessDeniedException)
            {
                ErrorHandler.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato");
                e.Cancel = true;
                return;
            }


            if (XtraMessageBox.Show("Sicuro di procedere alla cancellazione dell'appuntamento?", "Domanda", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                DevExpress.XtraScheduler.Appointment app = e.Object as DevExpress.XtraScheduler.Appointment;

                MyAppointment a = app.GetSourceObject(schedulerStorage1) as MyAppointment;


                ////i save on my db
                AppointmentHandler h = new AppointmentHandler();

                h.Delete(a);

                return;
            }

            e.Cancel = true;
        }
コード例 #2
0
        protected override void Nested_LoadDataFromDataSource()
        {
            AppointmentHandler h = new AppointmentHandler();

            h.GetAppointmentsByUser(_current.Id.ToString(), Properties.Settings.Default.Main_DeadlineDaysBefore);
            _appointments = h.BindableResults;
        }
コード例 #3
0
        private void SaveOrUpdate()
        {
            if (_current == null)
            {
                return;
            }
            //inserisco i parametri abituali
            _current.Subject     = txtSub.Text;
            _current.Resource    = cboZon.SelectedItem as Resource;
            _current.Customer    = txtCust.EditValue as Customer;
            _current.Location    = txtLoc.Text;
            _current.Label       = cboCaus.SelectedItem as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Label;
            _current.Operator    = cboOp.SelectedItem as Operator;
            _current.StartDate   = dtpIni.DateTime.Date + timini.Time.TimeOfDay;
            _current.EndDate     = dtpFin.DateTime.Date + timfin.Time.TimeOfDay;
            _current.Description = txtNote.Text;


            if (dtpOut.EditValue == null)
            {
                _current.OutcomeDate = DateTime.MinValue;
            }
            else
            {
                _current.OutcomeDate = dtpOut.DateTime;
            }
            _current.Outcome            = cboOut.SelectedItem as Outcome;
            _current.OutcomeDescription = txtNoteRapp.Text;
            _current.IsClosed           = chkClosed.Checked;



            //imposto i parametri di base
            _current.AppointmentType = 0;
            _current.AllDay          = false;
            _current.StatusId        = 0;
            _current.LabelId         = 0;
            _current.ResourceId      = 0;
            _current.RecurrenceInfo  = "";
            _current.ReminderInfo    = "";



            AppointmentHandler h = new AppointmentHandler();

            h.SaveOrUpdate(_current);



            _current.CalculateAppointmentInfo(Properties.Settings.Default.Main_DeadlineDaysBefore);
        }
コード例 #4
0
        public List <SelectListItem> BindMCUPackage()
        {
            List <SelectListItem> mcuPackages = new List <SelectListItem>();
            var qryData = new AppointmentHandler(_unitOfWork).GetMCUPackage();

            foreach (var item in qryData)
            {
                mcuPackages.Add(new SelectListItem
                {
                    Value = item.Id.ToString(),
                    Text  = item.Name
                });
            }
            return(mcuPackages);
        }
コード例 #5
0
        private void TryDelete(MyAppointment myTask, int rowIndex)
        {
            if (myTask == null)
            {
                return;
            }

            if (XtraMessageBox.Show("Rimuovere l'appuntamento selezionato?", "Domanda", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                AppointmentHandler h = new AppointmentHandler();
                h.Delete(myTask);

                IBindingList h1 = gridView1.DataSource as IBindingList;
                h1.Remove(myTask);
            }
        }
コード例 #6
0
        private void schedulerStorage1_AppointmentsChanged(object sender, PersistentObjectsEventArgs e)
        {
            try
            {
                Nested_CheckSecurityForChanging();
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
                return;
            }


            foreach (DevExpress.XtraScheduler.Appointment app in e.Objects)
            {
                // DevExpress.XtraScheduler.Appointment app = e.Objects[0] as DevExpress.XtraScheduler.Appointment;
                //imposto per sicurezza il campo allday a false;
                app.AllDay = false;

                MyAppointment a = app.GetSourceObject(schedulerStorage1) as MyAppointment;

                //se ho cambiato risorsa dal calendario e non dal form
                //(il form tiene i valori sincronizzati) recupero la risorsa e la setto
                if (a.ResourceId != a.Resource.Id)
                {
                    ResourceHandler h1 = new ResourceHandler();
                    WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource res = h1.GetElementById(a.ResourceId.ToString()) as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource;
                    a.Resource = res;
                    app.SetValue(schedulerStorage1, "Resource", res);
                }
                ////i save on my db
                AppointmentHandler h = new AppointmentHandler();

                try
                {
                    h.SaveOrUpdate(a);
                }
                catch (Exception ex)
                {
                    WIN.SCHEDULING_APP.GUI.Utility.ErrorHandler.Show(ex);
                }
            }
        }
コード例 #7
0
        public JsonResult GetPoliScheduleData(string poliId, string tanggal)
        {
            var _draw          = Request.Form.GetValues("draw").FirstOrDefault();
            var _start         = Request.Form.GetValues("start").FirstOrDefault();
            var _length        = Request.Form.GetValues("length").FirstOrDefault();
            var _sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][name]").FirstOrDefault();
            var _sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();
            var _searchValue   = Request.Form.GetValues("search[value]").FirstOrDefault();

            int _pageSize = _length != null?Convert.ToInt32(_length) : 0;

            int _skip = _start != null?Convert.ToInt32(_start) : 0;

            if (String.IsNullOrEmpty(tanggal))
            {
                tanggal = DateTime.Now.ToString("dd/MM/yyyy");
            }

            var request = new AppointmentRequest
            {
                Draw          = _draw,
                SearchValue   = _searchValue,
                SortColumn    = _sortColumn,
                SortColumnDir = _sortColumnDir,
                PageSize      = _pageSize,
                Skip          = _skip,
                Data          = new AppointmentModel
                {
                    PoliID          = Convert.ToInt64(poliId),
                    AppointmentDate = CommonUtils.ConvertStringDate2Datetime(tanggal)
                }
            };

            var response = new AppointmentHandler(_unitOfWork).GetDoctorBasedOnPoli(request);

            return(Json(new { data = response.schedules, recordsFiltered = response.RecordsFiltered, recordsTotal = response.RecordsTotal, draw = response.Draw }, JsonRequestBehavior.AllowGet));
        }
コード例 #8
0
        private void commandBar1_DelCommandPressed(object sender, EventArgs e)
        {
            MyAppointment label = null;

            if (gridView1.FocusedRowHandle >= 0)
            {
                label = gridView1.GetRow(gridView1.FocusedRowHandle) as MyAppointment;
                if (label == null)
                {
                    return;
                }
            }


            try
            {
                if (XtraMessageBox.Show("Sicuro di voler procedere? ", "Elimina appuntamento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Nested_CheckSecurityForDeletion();

                    AppointmentHandler h = new AppointmentHandler();
                    h.Delete(label);

                    IBindingList g = gridView1.DataSource as IBindingList;
                    g.Remove(label);
                }
            }
            catch (AccessDeniedException)
            {
                XtraMessageBox.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
コード例 #9
0
 public void Initialize()
 {
     _ah = new AppointmentHandler(_tp);
 }
コード例 #10
0
        private void schedulerStorage1_AppointmentsInserted(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e)
        {
            //gets the newly created Devexpress appointment;
            DevExpress.XtraScheduler.Appointment app = e.Objects[0] as DevExpress.XtraScheduler.Appointment;


            //*********************************************************
            //questo codice è inserito per risolvere il problema dell'assegnazione della risorsa
            //dopo il grag drop
            DevExpress.XtraScheduler.Resource ee = app.ResourceId as DevExpress.XtraScheduler.Resource;
            //questa situazione si verifica quando lo scheduler non è stato in grado
            //di assegnare una risorsa all'appuntamento creato nella funzione GetDragData
            //e pertanto assegna la risorsa "All" all'appuntamento
            if (ee != null)
            {
                Customer ccc = app.GetValue(schedulerStorage1, "Customer") as Customer;
                if (ccc != null)
                {
                    app.SetValue(schedulerStorage1, "Resource", ccc.Resource);
                    app.ResourceId = ccc.Resource.Id;
                }
                else
                {
                    WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource t = new ResourceHandler().GetAll()[0] as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource;
                    app.SetValue(schedulerStorage1, "Resource", t);
                    app.ResourceId = t.Id;
                }
            }
            else
            {
                app.SetValue(schedulerStorage1, "Resource", new ResourceHandler().GetElementById(app.ResourceId.ToString()) as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource);
            }
            //****************************************************************++



            //imposto per sicurezza il campo allday a false;
            app.AllDay = false;

            ////i get my custom object
            MyAppointment a = app.GetSourceObject(schedulerStorage1) as MyAppointment;



            ////i save on my db
            AppointmentHandler h = new AppointmentHandler();

            try
            {
                h.SaveOrUpdate(a);
            }
            catch (Exception ex)
            {
                WIN.SCHEDULING_APP.GUI.Utility.ErrorHandler.Show(ex);

                return;
            }


            //notifico l'id all'oggetto appena creato
            Key newId = a.Key;

            app.SetValue(schedulerStorage1, "Key", newId);


            //Appointment app1 = app.Copy();
            //app1.Start = DateTime.Now.AddHours(2);

            //schedulerStorage1.Appointments.Add(app1);

            //foreach (Appointment item in schedulerStorage1 .Appointments.Items  )
            //{
            //    MyAppointment a1 = app.GetSourceObject(schedulerStorage1) as MyAppointment;

            //}
        }
コード例 #11
0
 public AppointmentController(AppointmentHandler ah)
 {
     _ah = ah;
 }