private MyAppointment CreateDummyApp() { MyAppointment controller = new MyAppointment(); controller.Subject = txtSub.Text; controller.Location = txtLoc.Text; controller.Description = txtNote.Text; controller.ResourceId = (cboZon.EditValue as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource).Id; //controller.SetStatus(edStatus.Status); //controller.SetLabel(appointmentLabelEdit1.Label); //controller.AllDay = this.checkAllDay.Checked; controller.StartDate = this.dtpIni.DateTime.Date + this.timini.Time.TimeOfDay; controller.EndDate = this.dtpFin.DateTime.Date + this.timfin.Time.TimeOfDay; controller.Resource = cboZon.EditValue as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource; controller.Label = cboCaus.EditValue as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Label; controller.Customer = txtCust.EditValue as Customer; controller.Operator = cboOp.EditValue as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Operator; if (dtpOut.EditValue == null) { controller.OutcomeDate = DateTime.MinValue; } else { controller.CreateRapporto(); controller.OutcomeDate = dtpOut.DateTime; } controller.Outcome = cboOut.SelectedItem as Outcome; controller.Description = txtNoteRapp.Text; controller.IsClosed = chkClosed.Checked; controller.CalculateAppointmentInfo(Properties.Settings.Default.Main_DeadlineDaysBefore); controller.Key = new Key(-1); return(controller); }
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); } }
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.Column.FieldName == "OutcomeDate") { MyAppointment app = gridView1.GetRow(e.RowHandle) as MyAppointment; if (app != null) { if (app.OutcomeDate == DateTime.MinValue) { e.DisplayText = ""; } } } else if (e.Column.Name == "colFiscale") { MyAppointment app = gridView1.GetRow(e.RowHandle) as MyAppointment; if (app != null) { if (app.Customer != null) { e.DisplayText = app.Customer.CodiceFiscale; } } } else if (e.Column.Name == "colContatti") { MyAppointment app = gridView1.GetRow(e.RowHandle) as MyAppointment; if (app != null) { if (app.Customer != null) { e.DisplayText = app.Customer.Residenza.ToString(); } } } else if (e.Column.Name == "colTelContatti") { MyAppointment app = gridView1.GetRow(e.RowHandle) as MyAppointment; if (app != null) { if (app.Customer != null) { e.DisplayText = app.Customer.Comunicazione.TelefonoUfficio; } } } else if (e.Column.Name == "colCell1") { MyAppointment app = gridView1.GetRow(e.RowHandle) as MyAppointment; if (app != null) { if (app.Customer != null) { e.DisplayText = app.Customer.Comunicazione.Cellulare1; } } } else if (e.Column.Name == "colCell2") { MyAppointment app = gridView1.GetRow(e.RowHandle) as MyAppointment; if (app != null) { if (app.Customer != null) { e.DisplayText = app.Customer.Comunicazione.Cellulare2; } } } }
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; //} }
private void xrPictureBox1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { MyAppointment m = this.GetCurrentRow() as MyAppointment; SetImageState(m); }