Esempio n. 1
0
        private void PrepareForLoading()
        {
            //Carico le combo

            LoadComboZone();
            LoadComboCausali();
            LoadComboOperatori();
            LoadComboEsiti();

            //imposto il cliente, la zona, il luogo di default se il cliente è presente

            txtSub.EditValue = Properties.Settings.Default.Main_CalendarSubject;
            if (_customer != null)
            {
                txtCust.EditValue = _customer;
                txtLoc.EditValue  = string.Format("{0} {1} {2}", _customer.Residenza.Via, _customer.Residenza.Cap, _customer.Residenza.Comune.Descrizione);
                cboZon.EditValue  = _customer.Resource;
                txtNote.EditValue = _customer.OtherDataSummary;
            }
            else
            {
                txtCust.EditValue = null;
                txtLoc.EditValue  = "";
                txtNote.EditValue = "";
            }



            //carico la data e l'ora iniziale
            AppointmentDateValidator v = AppointmentUtils.GetProposedDate();

            dtpIni.EditValue = v.StartDate;
            dtpFin.EditValue = v.EndDate;

            timini.Time = new DateTime(v.StartDate.TimeOfDay.Ticks);
            timfin.Time = new DateTime(v.EndDate.TimeOfDay.Ticks);

            ////imposto le note
            //txtNote.EditValue = "";


            //imposto i valori per il rapporto
            dtpOut.EditValue  = null;
            chkClosed.Checked = false;



            txtNoteRapp.EditValue = "";
        }
Esempio n. 2
0
        private void schedulerControl1_InitNewAppointment(object sender, AppointmentEventArgs e)
        {
            //////carico la data e l'ora iniziale


            e.Appointment.AllDay  = false;
            e.Appointment.Subject = Properties.Settings.Default.Main_CalendarSubject;
            if (schedulerControl1.ActiveViewType != SchedulerViewType.Day && schedulerControl1.ActiveViewType != SchedulerViewType.WorkWeek)
            {
                AppointmentDateValidator v = AppointmentUtils.GetProposedDate(e.Appointment.Start);
                e.Appointment.Start = v.StartDate;
                e.Appointment.End   = v.EndDate;
            }

            //dtpin.EditValue = v.StartDate;
            //dtpfin.EditValue = v.EndDate;

            //timin.Time = new DateTime(v.StartDate.TimeOfDay.Ticks);
            //timfin.Time = new DateTime(v.EndDate.TimeOfDay.Ticks);
        }
Esempio n. 3
0
        SchedulerDragData GetDragData(GridView view)
        {
            int[] selection = view.GetSelectedRows();
            if (selection == null)
            {
                return(null);
            }

            AppointmentBaseCollection appointments = new AppointmentBaseCollection();
            int count = selection.Length;

            for (int i = 0; i < count; i++)
            {
                int    rowIndex = selection[i];
                MyTask myTask   = view.GetRow(rowIndex) as MyTask;


                //imposto una variabile a livello
                //di modulo per il richiamo alle successive azioni postdragdrop
                if (Properties.Settings.Default.Main_RenewActivityAfterDragDrop || Properties.Settings.Default.Main_MarkActivityCompletedafterDragDrop)
                {
                    _draggedTask = myTask;
                }
                else
                {
                    _draggedTask = null;
                }



                if (myTask == null)
                {
                    break;
                }

                Appointment apt = schedulerStorage1.CreateAppointment(AppointmentType.Normal);


                apt.AllDay = false;

                if (schedulerControl1.ActiveViewType != SchedulerViewType.Day && schedulerControl1.ActiveViewType != SchedulerViewType.WorkWeek)
                {
                    AppointmentDateValidator v = AppointmentUtils.GetProposedDate(apt.Start);
                    apt.Start = v.StartDate;
                    apt.End   = v.EndDate;
                }
                else
                {
                    apt.Duration = TimeSpan.FromHours(0.5);
                }

                apt.Subject = myTask.Subject;
                //apt.LabelId = (int)view.GetRowCellValue(rowIndex, "Severity");
                //apt.StatusId = (int)view.GetRowCellValue(rowIndex, "Priority");
                //WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource r = new ResourceHandler().GetAll()[0] as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource;
                ////apt.ResourceId = r.Id;
                //if (schedulerControl1.GroupType == SchedulerGroupType.None)
                //    apt.SetValue(schedulerStorage1, "Resource", r);
                apt.SetValue(schedulerStorage1, "Label", new LabelHandler().GetAll()[0]);
                if (myTask.Customer != null)
                {
                    apt.SetValue(schedulerStorage1, "Customer", myTask.Customer);
                    Customer c = myTask.Customer;
                    apt.Location = string.Format("{0} {1} {2}", c.Residenza.Via, c.Residenza.Cap, c.Residenza.Comune.Descrizione);
                    if (string.IsNullOrEmpty(myTask.Description))
                    {
                        apt.Description = c.OtherDataSummary;
                    }
                }
                if (!string.IsNullOrEmpty(myTask.Description))
                {
                    apt.Description = myTask.Description;
                }

                appointments.Add(apt);
            }

            return(new SchedulerDragData(appointments, 0));
        }