public override void Load(AppointmentFormController appointmentController) { base.Load(appointmentController); SetEditorTypeFor(m => m.Subject, DialogFieldEditorType.ComboBox); SetDataItemsFor(m => m.Subject, (addItemDelegate) => { addItemDelegate("meeting", "meeting"); addItemDelegate("travel", "travel"); addItemDelegate("phone call", "phonecall"); }); List <Company> companies = Company.GenerateCompanyDataSource(); SetDataItemsFor((CustomAppointmentEditDialogViewModel m) => m.AppointmentCompany, (addItemDelegate) => { foreach (Company comp in companies) { addItemDelegate(comp.CompanyName, comp.CompanyID); } }); SetDataItemsFor((CustomAppointmentEditDialogViewModel m) => m.AppointmentContact, (addItemDelegate) => { List <CompanyContact> contacts = CompanyContact.GenerateContactDataSource().Where(c => c.CompanyID == AppointmentCompany).ToList(); addItemDelegate("", 0); foreach (CompanyContact cont in contacts) { addItemDelegate(cont.ContactName, cont.ContactID); } }); TrackPropertyChangeFor((CustomAppointmentEditDialogViewModel m) => m.AppointmentCompany, () => { AppointmentContact = 0; }); TrackPropertyChangeFor(m => m.Subject, () => { });// just to process changing via server to show/hide company/contact }
public CustomAppointmentForm(SchedulerControl control, Appointment apt, bool openRecurrenceForm) { Guard.ArgumentNotNull(control, "control"); Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage"); Guard.ArgumentNotNull(apt, "apt"); this.openRecurrenceForm = openRecurrenceForm; this.controller = CreateController(control, apt); // // Required for Windows Form Designer support // InitializeComponent(); SetupPredefinedConstraints(); LoadIcons(); this.control = control; this.storage = control.DataStorage; this.edtShowTimeAs.Storage = this.storage; this.edtLabel.Storage = this.storage; this.edtResource.SchedulerControl = control; this.edtResource.Storage = this.storage; this.edtResources.SchedulerControl = control; SubscribeControllerEvents(Controller); SubscribeEditorsEvents(); BindControllerToControls(); }
void SubscribeControllerEvents(AppointmentFormController controller) { if (controller != null) { controller.PropertyChanged += OnControllerPropertyChanged; } }
public CustomAppointmentForm(SchedulerControl control, Appointment apt, bool openRecurrenceForm) { abc = apt; Guard.ArgumentNotNull(control, "control"); Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage"); Guard.ArgumentNotNull(apt, "apt"); this.openRecurrenceForm = openRecurrenceForm; this.controller = CreateController(control, apt); // // Required for Windows Form Designer support // InitializeComponent(); SetupPredefinedConstraints(); veri.Database.Connection.ConnectionString = AnaForm.cstr; LoadIcons(); this.control = control; this.storage = control.DataStorage; this.edtLabel.Storage = this.storage; SubscribeControllerEvents(Controller); SubscribeEditorsEvents(); BindControllerToControls(); this.Load += CustomAppointmentForm_Load; }
void ApplyRecurrence(AppointmentFormController controller, DateTime clientStart) { Appointment patternCopy = controller.PrepareToRecurrenceEdit(); AssignRecurrenceInfoProperties(controller, patternCopy, (RecurrenceInfo)patternCopy.RecurrenceInfo, clientStart); controller.ApplyRecurrence(patternCopy); }
public JarsDefaultAppointmentEditForm(SchedulerControl control, Appointment apt, bool openRecurrenceForm) { Guard.ArgumentNotNull(control, "control"); Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage"); Guard.ArgumentNotNull(apt, "apt"); this.openRecurrenceForm = openRecurrenceForm; this.controller = CreateController(control, apt); // // Required for Windows Form Designer support // InitializeComponent(); SetupPredefinedConstraints(); LoadIcons(); this.control = control; this.storage = control.DataStorage; this.riAppointmentResource.SchedulerControl = control; this.riAppointmentResource.Storage = storage; this.riAppointmentStatus.Storage = storage; this.riAppointmentLabel.Storage = storage; BindControllerToControls(); LookAndFeel.ParentLookAndFeel = control.LookAndFeel; this.supressCancelCore = false; }
public AppointmentFormOutlook2007Style(DevExpress.XtraScheduler.SchedulerControl control, DevExpress.XtraScheduler.Appointment apt, bool openRecurrenceForm) : base() { if (control == null) Exceptions.ThrowArgumentException("control", control); if (control.Storage == null) Exceptions.ThrowArgumentException("control.Storage", control.Storage); if (apt == null) Exceptions.ThrowArgumentException("apt", apt); this.openRecurrenceForm = openRecurrenceForm; this.controller = CreateController(control, apt); this.sourceAppointment = apt; // // Required for Windows Form Designer support // InitializeComponent(); SchedulerStorage storage = (SchedulerStorage)control.Storage; repItemAppointmentStatus.Storage = storage; repItemAppointmentLabel.Storage = storage; barAndDockingController.LookAndFeel.ParentLookAndFeel = LookAndFeel; LoadIcons(); LoadImages(); this.control = control; this.storage = control.Storage; }
private void SubscribeControllerEvents(AppointmentFormController controller) { if (controller == null) { return; } controller.PropertyChanged += OnControllerPropertyChanged; }
public XtraForm1(Appointment pattern, FirstDayOfWeek fdow, AppointmentFormController afc) : base(pattern, fdow, afc) { //InitializeComponent(); checkEdit1.Tag = RecurrenceType.Hourly; UnsubscribeRecurrenceTypeControlsEvents(); SubscribeRecurrenceTypeControlsEvents(); SetRecurrenceType(this.GetRecurrenceType()); }
public override void Load(AppointmentFormController appointmentController) { base.Load(appointmentController); SetDataItemsFor(m => m.Location, PopulateLocations); SetDataItemsFor(m => m.Subject, PopulatePilots); //UpdateResourceRelatedProperties(); //TrackPropertyChangeFor((CustomAppointmentEditDialogViewModel m) => m.ResourceIds, UpdateResourceRelatedProperties); }
protected override void AssignControllerCustomFieldsValues(AppointmentFormController controller, ClientAppointmentProperties clientAppointment) { Appointment editedAppointment = controller.EditedAppointmentCopy; double result = 0; if (clientAppointment.Properties["Price"] != null) { Double.TryParse(clientAppointment.Properties["Price"].ToString(), out result); } editedAppointment.CustomFields["Price"] = result; base.AssignControllerCustomFieldsValues(controller, clientAppointment); }
protected void OnBtnOkClick(object sender, EventArgs e) { Appointment apt = (String.IsNullOrEmpty(appointmentId.Value)) ? Scheduler.Storage.CreateAppointment(AppointmentType.Normal) : Scheduler.LookupAppointmentByIdString(appointmentId.Value); AppointmentFormController formController = new AppointmentFormController(Scheduler, apt); if (formController == null) { return; } AssignControllerValues(formController); formController.ApplyChanges(); RaiseFormClosed(); }
protected virtual void AssignRecurrenceInfoProperties(AppointmentFormController controller, Appointment patternCopy, RecurrenceInfo rinfo, DateTime clientStart) { rinfo.Type = edtRecurrenceTypeEdit.Type; controller.AssignRecurrenceInfoRangeProperties(rinfo, edtRecurrenceRangeControl.ClientRange, clientStart, edtRecurrenceRangeControl.ClientEnd, edtRecurrenceRangeControl.ClientOccurrenceCount, patternCopy); RecurrenceRuleControlBase ruleControl = GetCurrentRecurrenceRuleControl(); RecurrenceRuleValuesAccessor valueAccessor = ruleControl.ValuesAccessor; rinfo.DayNumber = valueAccessor.GetDayNumber(); rinfo.Periodicity = valueAccessor.GetPeriodicity(); rinfo.Month = valueAccessor.GetMonth(); rinfo.WeekDays = valueAccessor.GetWeekDays(); rinfo.WeekOfMonth = valueAccessor.GetWeekOfMonth(); }
public bool AssignControllerValues(AppointmentFormController controller, DateTime clientStart) { bool isValid = IsRecurrenceValid(); if (isValid) { ApplyRecurrence(controller, clientStart); } else { controller.RemoveRecurrence(); } return(isValid); }
public void AssignControllerValues(AppointmentFormController controller) { TimeZoneHelper helper = new TimeZoneHelper(Scheduler.OptionsBehavior.ClientTimeZoneId); controller.Start = helper.FromClientTime(edtStartDate.Date); controller.End = helper.FromClientTime(edtEndDate.Date); controller.Subject = tbSubject.Text; controller.Location = tbLocation.Text; controller.Description = tbDescription.Text; controller.AllDay = chkAllDay.Checked; controller.StatusKey = Convert.ToInt32(edtStatus.Value); controller.LabelKey = Convert.ToInt32(edtLabel.Value); controller.ResourceId = (edtResource.Value.ToString() != "null") ? edtResource.Value : ResourceEmpty.Id; if (chkRecurrence.Checked) { recurrenceControl.AssignControllerValues(controller, helper.FromClientTime(edtStartDate.Date)); } }
public MyAppointmentRecurrenceForm(SchedulerControl scheduler_control, Appointment apt) { InitializeComponent(); // Create a controller instance. controller = new AppointmentFormController(scheduler_control, apt); // Get an appointment pattern copy. patternCopy = controller.PrepareToRecurrenceEdit(); // Get access to the recurrence information. this.rinfo = patternCopy.RecurrenceInfo; // Get the first day of the week. firstDayOfWeek = scheduler_control.OptionsView.FirstDayOfWeek; radioGroup1.EditValueChanged += radioGroup1_EditValueChanged; btnOK.Click += btnOK_Click; btnCancel.Click += btnCancel_Click; InitializeControls(firstDayOfWeek); }
public CustomAppointmentForm(SchedulerControl control, Appointment apt, bool openRecurrenceForm) { Guard.ArgumentNotNull(control, "control"); Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage"); Guard.ArgumentNotNull(apt, "apt"); this.openRecurrenceForm = openRecurrenceForm; this.controller = CreateController(control, apt); // // Required for Windows Form Designer support // InitializeComponent(); LoadIcons(); this.control = control; this.storage = control.DataStorage; SubscribeControllerEvents(Controller); BindControllerToControls(); }
public AppointmentFormOutlook2007Style(DevExpress.XtraScheduler.SchedulerControl control, DevExpress.XtraScheduler.Appointment apt, bool openRecurrenceForm) : base() { if (control == null) { Exceptions.ThrowArgumentException("control", control); } if (control.Storage == null) { Exceptions.ThrowArgumentException("control.Storage", control.Storage); } if (apt == null) { Exceptions.ThrowArgumentException("apt", apt); } this.openRecurrenceForm = openRecurrenceForm; this.controller = CreateController(control, apt); this.sourceAppointment = apt; // // Required for Windows Form Designer support // InitializeComponent(); SchedulerStorage storage = (SchedulerStorage)control.Storage; repItemAppointmentStatus.Storage = storage; repItemAppointmentLabel.Storage = storage; edtResource.SchedulerControl = control; edtResource.Storage = storage; edtResources.SchedulerControl = control; barAndDockingController.LookAndFeel.ParentLookAndFeel = LookAndFeel; this.spellChecker.LookAndFeel.ParentLookAndFeel = this.LookAndFeel; LoadIcons(); this.control = control; this.storage = control.Storage; }
public OutlookAppointmentForm(DevExpress.XtraScheduler.SchedulerControl control, Appointment apt, String parentTaskTemplateId, bool openRecurrenceForm) { Guard.ArgumentNotNull(control, "control"); Guard.ArgumentNotNull(control.DataStorage, "control.DataStorage"); Guard.ArgumentNotNull(apt, "apt"); this.openRecurrenceForm = openRecurrenceForm; this.controller = CreateController(control, apt); // // Required for Windows Form Designer support // InitializeComponent(); SetupPredefinedConstraints(); LoadIcons(); this.control = control; this.storage = control.DataStorage; this.edtResource.SchedulerControl = control; this.edtResource.Storage = this.storage; this.edtResources.SchedulerControl = control; this.riAppointmentResource.SchedulerControl = control; this.riAppointmentResource.Storage = this.storage; this.riAppointmentStatus.Storage = this.storage; this.riAppointmentLabel.Storage = this.storage; BindControllerToControls(); LookAndFeel.ParentLookAndFeel = control.LookAndFeel; this.supressCancelCore = false; // 取得上级任务节点 this.parentTaskTemplateId = parentTaskTemplateId; }
//TO DO: Remove Stored Procs. private void Duplicate() { if (strMenuOption == "User...") { int Row = fUser.gvwUser.FocusedRowHandle; if (Row >= 0) { int intUserID = Convert.ToInt32(fUser.gvwUser.GetRowCellValue(fUser.gvwUser.FocusedRowHandle, fUser.gcolUserID).ToString()); int intContactID = Convert.ToInt32(fUser.gvwUser.GetRowCellValue(fUser.gvwUser.FocusedRowHandle, fUser.gcolContactID).ToString()); //intContactID = Contact.CloneData(intContactID); //intUserID = User.Clone(intUserID); //Changing the mode to 'AddClone' and passing the same IDs for loading data frmUserDlg fUserDlg = new frmUserDlg(); fUserDlg.Mode = "AddClone"; fUserDlg.UserID = intUserID; fUserDlg.ContactID = intContactID; fUserDlg.LoadData(); fUserDlg.ShowDialog(); fUserDlg.Close(); fUserDlg.Dispose(); fUserDlg = null; ReloadUsersList(); } } else if (strMenuOption == "Contact...") { int Row = fContact.gvwContact.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fContact.gvwContact.GetRowCellValue(fContact.gvwContact.FocusedRowHandle, fContact.gcolContactID).ToString()); //intID = Contact.CloneData(intID); frmContactDlg fContDlg = new frmContactDlg(); fContDlg.Mode = "AddClone"; fContDlg.ContactID = intID; fContDlg.LoadData(); fContDlg.ShowDialog(); fContDlg.Close(); fContDlg.Dispose(); fContDlg = null; ReloadContactsGrid(); } } else if (strMenuOption == "Instructor...") { int Row = fContact.gvwContact.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fContact.gvwContact.GetRowCellValue(fContact.gvwContact.FocusedRowHandle, fContact.gcolContactID).ToString()); //intID = Contact.CloneData(intID); frmInstructorDlg fInstructorDlg = new frmInstructorDlg(); fInstructorDlg.Mode = "AddClone"; fInstructorDlg.ContactID = intID; fInstructorDlg.LoadData(); fInstructorDlg.ShowDialog(); fInstructorDlg.Close(); fInstructorDlg.Dispose(); fInstructorDlg = null; ReloadInstructorsList(); } } else if (strMenuOption == "Client...") { int Row = fContact.gvwContact.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fContact.gvwContact.GetRowCellValue(fContact.gvwContact.FocusedRowHandle, fContact.gcolContactID).ToString()); //intID = Contact.CloneData(intID); frmClientDlg fClientDlg = new frmClientDlg(); fClientDlg.Mode = "AddClone"; fClientDlg.ContactID = intID; fClientDlg.LoadData(); fClientDlg.ShowDialog(); fClientDlg.Close(); fClientDlg.Dispose(); fClientDlg = null; ReloadClientsList(); } } else if (strMenuOption == "Department...") { int Row = fDept.gvwDept.FocusedRowHandle; if (Row >= 0) { int intDeptID = Convert.ToInt32(fDept.gvwDept.GetRowCellValue(fDept.gvwDept.FocusedRowHandle, fDept.gColDeptID).ToString()); int intContactID = Convert.ToInt32(fDept.gvwDept.GetRowCellValue(fDept.gvwDept.FocusedRowHandle, fDept.gColContactID).ToString()); //int[] array = new int[2]; //array = Department.CloneData(intDeptID); //intDeptID = array[0]; //intContactID = array[1]; frmDepartmentDlg fDeptDlg = new frmDepartmentDlg(); fDeptDlg.Mode = "AddClone"; fDeptDlg.DeptID = intDeptID; fDeptDlg.ContactID = intContactID; fDeptDlg.LoadData(); fDeptDlg.ShowDialog(); fDeptDlg.Close(); fDeptDlg.Dispose(); fDeptDlg = null; ReloadDepartmentsList(); } } else if (strMenuOption == "Program...") { int Row = fProgram.gvwProgram.FocusedRowHandle; if (Row >= 0) { int intProgID = Convert.ToInt32( fProgram.gvwProgram.GetRowCellValue(fProgram.gvwProgram.FocusedRowHandle, fProgram.gcolProgID).ToString()); //intProgID = Program.CloneData(intProgID); frmProgramDlg fProgDlg = new frmProgramDlg(intProgID); fProgDlg.Mode = "AddClone"; fProgDlg.LoadData(); fProgDlg.ShowDialog(); fProgDlg.Close(); fProgDlg.Dispose(); fProgDlg = null; ReloadProgramList(); } } else if (strMenuOption == "Class...") { int Row = fCourse.gvwCourse.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fCourse.gvwCourse.GetRowCellValue(fCourse.gvwCourse.FocusedRowHandle, fCourse.gcolCourseId).ToString()); //intID = Course.CloneData(intID); frmClassDlg fClassDlg = new frmClassDlg(); fClassDlg.Mode = "AddClone"; fClassDlg.CourseId = intID; fClassDlg.LoadData(); fClassDlg.ShowDialog(); fClassDlg.Close(); fClassDlg.Dispose(); fClassDlg = null; ReloadClassesList(); } } else if (strMenuOption == "Event...") { if (fEvt != null) { int Row = fEvt.gvwEvent.FocusedRowHandle; if (Row >= 0) { bool IsRecur = false; int intID = Convert.ToInt32(fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.gcolEventID).ToString()); int intCalID = Convert.ToInt32(fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.colCalendarEventID).ToString()); if (fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.gcolIsRecur).ToString() != "") IsRecur = true; int Option = -1; if (IsRecur) { frmOpenEvents frmOpenEvt = new frmOpenEvents(); if (frmOpenEvt.ShowDialog() == DialogResult.OK) { Option = frmOpenEvt.Option; } else { frmOpenEvt.Close(); frmOpenEvt.Dispose(); frmOpenEvt = null; return; } } //this part was copy-pasted from frmCalendar.cs we exit if no module linked to the event string module = string.Empty; int _uid = 0; int _eventtypeindex = 0; Events objEvent = new Events(); _uid = objEvent.GetEvent(intID, ref module, ref _eventtypeindex); if (module == "") { return; } //--- //frmEventDlg fEvtDlg = null; if (Option == 1) { if (module == "Class") { frmClassDlg frm = new frmClassDlg(_uid, _eventtypeindex, intCalID); frm.Mode = "AddClone"; if (frm.ShowDialog() == DialogResult.OK) { frm.Close(); frm.Dispose(); frm = null; } } else if (module == "Program") { frmProgramDlg frm = new frmProgramDlg(_uid, _eventtypeindex, intCalID); frm.Mode = "AddClone"; if (frm.ShowDialog() == DialogResult.OK) { frm.Close(); frm.Dispose(); frm = null; } } /* fEvtDlg = new frmEventDlg(intID, intCalID); fEvtDlg.Mode = "Edit"; fEvtDlg.EventID = intID; fEvtDlg.LoadData(); */ } else { if (module == "Class") { frmClassDlg frm = new frmClassDlg(_uid, _eventtypeindex); frm.Mode = "AddClone"; if (frm.ShowDialog() == DialogResult.OK) { frm.Close(); frm.Dispose(); frm = null; } } else if (module == "Program") { frmProgramDlg frm = new frmProgramDlg(_uid, _eventtypeindex); frm.Mode = "AddClone"; if (frm.ShowDialog() == DialogResult.OK) { frm.Close(); frm.Dispose(); frm = null; } } /* fEvtDlg = new frmEventDlg(); fEvtDlg.Mode = "Edit"; fEvtDlg.EventID = intID; fEvtDlg.LoadData(); */ } /* if (fEvtDlg.ShowDialog() == DialogResult.OK) { fEvt.LoadEvent(); } fEvtDlg.Close(); fEvtDlg.Dispose(); fEvtDlg = null; fEvt.gvwEvent.FocusedRowHandle = Row; */ } }/* else { }*/ } else if (strMenuOption == "Calendar...") { if (fCalendar.schedulerControl1.SelectedAppointments.Count > 0) { Appointment apt = fCalendar.schedulerControl1.SelectedAppointments[0]; bool IsRecur = false; controller = new AppointmentFormController(fCalendar.schedulerControl1, apt); int intCalID = Convert.ToInt32(controller.LabelId.ToString()); int intEventID = Common.GetID("select EventID from CalendarEvent where CalendarEventID=" + intCalID.ToString()); string strRecurrenceText = Common.GetString("select RecurrenceText from Event where EventID=" + intEventID.ToString()); if (strRecurrenceText != "") IsRecur = true; int Option = -1; if (IsRecur) { frmOpenEvents frmOpenEvt = new frmOpenEvents(); if (frmOpenEvt.ShowDialog() == DialogResult.OK) { Option = frmOpenEvt.Option; } else { frmOpenEvt.Close(); frmOpenEvt.Dispose(); frmOpenEvt = null; return; } } frmEventDlg fEvtDlg = null; if (Option == 1) { fEvtDlg = new frmEventDlg(intEventID, intCalID); fEvtDlg.Mode = "Edit"; fEvtDlg.EventID = intEventID; fEvtDlg.LoadData(); } else { fEvtDlg = new frmEventDlg(); fEvtDlg.Mode = "Edit"; fEvtDlg.EventID = intEventID; fEvtDlg.LoadData(); } if (fEvtDlg.ShowDialog() == DialogResult.OK) { fCalendar.LoadCalendar(); } fEvtDlg.Close(); fEvtDlg.Dispose(); fEvtDlg = null; } } }
private void Delete() { if (strMenuOption == "User...") { int Row = fUser.gvwUser.FocusedRowHandle; if (Row >= 0) { int intUserID = Convert.ToInt32(fUser.gvwUser.GetRowCellValue(fUser.gvwUser.FocusedRowHandle, fUser.gcolUserID).ToString()); int intContactID = Convert.ToInt32(fUser.gvwUser.GetRowCellValue(fUser.gvwUser.FocusedRowHandle, fUser.gcolContactID).ToString()); if (Message.MsgDelete()) { User objUser = new User(); objUser.UserID = intUserID; objUser.ContactID = intContactID; if (!objUser.DeleteData()) { Message.MsgWarning("User cannot be deleted"); fUser.grdUser.Focus(); return; } fUser.LoadUser(); fUser.grdUser.Focus(); fUser.gvwUser.FocusedRowHandle = Row - 1; if (fUser.gvwUser.RowCount > 0) { if (fUser.gvwUser.FocusedRowHandle < 0) { fUser.gvwUser.FocusedRowHandle = 0; } } } } } else if ((strMenuOption == "Contact...") || (strMenuOption == "Instructor...") || (strMenuOption == "Client...")) { string strtemp = ""; int Row = fContact.gvwContact.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fContact.gvwContact.GetRowCellValue(fContact.gvwContact.FocusedRowHandle, fContact.gcolContactID).ToString()); strtemp = strMenuOption; strtemp = strtemp.Replace("...", ""); if (Message.MsgDelete()) { Contact objContact = new Contact(); objContact.ContactID = intID; //objContact.DeleteData(); if (!objContact.DeleteData()) { Message.MsgWarning(strtemp + " cannot be deleted"); fContact.grdContact.Focus(); return; } fContact.LoadContact(strtemp); fContact.grdContact.Focus(); fContact.gvwContact.FocusedRowHandle = Row - 1; if (fContact.gvwContact.RowCount > 0) { if (fContact.gvwContact.FocusedRowHandle < 0) { fContact.gvwContact.FocusedRowHandle = 0; } } } } } else if (strMenuOption == "Department...") { int Row = fDept.gvwDept.FocusedRowHandle; if (Row >= 0) { int intDeptID = Convert.ToInt32(fDept.gvwDept.GetRowCellValue(fDept.gvwDept.FocusedRowHandle, fDept.gColDeptID).ToString()); int intContactID = Convert.ToInt32(fDept.gvwDept.GetRowCellValue(fDept.gvwDept.FocusedRowHandle, fDept.gColContactID).ToString()); if (Message.MsgDelete()) { Department objDept = new Department(); objDept.DeptID = intDeptID; objDept.ContactID = intContactID; //objDept.DeleteData(); if (!objDept.DeleteData()) { Message.MsgWarning("Department cannot be deleted"); fDept.grdDept.Focus(); return; } fDept.LoadDepartment(); fDept.grdDept.Focus(); fDept.gvwDept.FocusedRowHandle = Row - 1; if (fDept.gvwDept.RowCount > 0) { if (fDept.gvwDept.FocusedRowHandle < 0) { fDept.gvwDept.FocusedRowHandle = 0; } } } } } else if (strMenuOption == "Program...") { int Row = fProgram.gvwProgram.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fProgram.gvwProgram.GetRowCellValue(fProgram.gvwProgram.FocusedRowHandle, fProgram.gcolProgID).ToString()); if (Message.MsgDelete()) { Program objProg = new Program(); objProg.ProgramID = intID; //objProg.DeleteData(); if (!objProg.DeleteData()) { Message.MsgWarning("Program cannot be deleted"); fProgram.grdProgram.Focus(); return; } fProgram.LoadProgram(); fProgram.grdProgram.Focus(); fProgram.gvwProgram.FocusedRowHandle = Row - 1; if (fProgram.gvwProgram.RowCount > 0) { if (fProgram.gvwProgram.FocusedRowHandle < 0) { fProgram.gvwProgram.FocusedRowHandle = 0; } } } } } else if (strMenuOption == "Class...") { int Row = fCourse.gvwCourse.FocusedRowHandle; if (Row >= 0) { int intID = Convert.ToInt32( fCourse.gvwCourse.GetRowCellValue(fCourse.gvwCourse.FocusedRowHandle, fCourse.gcolCourseId).ToString()); if (Message.MsgDelete()) { Course objCourse = new Course(); objCourse.CourseId = intID; //objCourse.DeleteData(); if (!objCourse.DeleteData()) { Message.MsgWarning("Class cannot be deleted"); fCourse.grdCourse.Focus(); return; } fCourse.LoadCourse(); fCourse.grdCourse.Focus(); fCourse.gvwCourse.FocusedRowHandle = Row - 1; if (fCourse.gvwCourse.RowCount > 0) { if (fCourse.gvwCourse.FocusedRowHandle < 0) { fCourse.gvwCourse.FocusedRowHandle = 0; } } } } } else if (strMenuOption == "Event...") { int Row = fEvt.gvwEvent.FocusedRowHandle; bool IsRecur = false; if (Row >= 0) { int intID = Convert.ToInt32(fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.gcolEventID).ToString()); int intCalID = Convert.ToInt32(fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.colCalendarEventID).ToString()); int CourseId = Convert.ToInt32(fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.gcolCourseId).ToString()); if (fEvt.gvwEvent.GetRowCellValue(fEvt.gvwEvent.FocusedRowHandle, fEvt.gcolIsRecur).ToString() != "") IsRecur = true; if (IsRecur) { frmDeleteEvents frmDelEvt = new frmDeleteEvents(intID, intCalID); if (frmDelEvt.ShowDialog() == DialogResult.OK) { fEvt.LoadEvent(); fEvt.grdEvent.Focus(); fEvt.gvwEvent.FocusedRowHandle = Row - 1; if (fEvt.gvwEvent.RowCount > 0) { if (fEvt.gvwEvent.FocusedRowHandle < 0) fEvt.gvwEvent.FocusedRowHandle = 0; } } frmDelEvt.Close(); frmDelEvt.Dispose(); frmDelEvt = null; } else { if (Message.MsgDelete()) { string strMess = ""; Events evt = new Events(); evt.EventID = intID; strMess = evt.CheckClassEvent(); if (strMess == "") strMess = evt.CheckProgramEvent(); if (strMess != "") { Message.MsgWarning("This Event is linked with" + strMess + ".\n\nEvent cannot be deleted."); return; } //evt.DeleteData(true); if (evt.EventType=="Extra Class") evt.DeleteSingleCalendarEvent(); else evt.DeleteTestEvent("Course", CourseId); fEvt.LoadEvent(); fEvt.grdEvent.Focus(); fEvt.gvwEvent.FocusedRowHandle = Row - 1; if (fEvt.gvwEvent.RowCount > 0) if (fEvt.gvwEvent.FocusedRowHandle < 0) fEvt.gvwEvent.FocusedRowHandle = 0; } } } } else if (strMenuOption == "Calendar...") { if (fCalendar.schedulerControl1.SelectedAppointments.Count > 0) { Appointment apt = fCalendar.schedulerControl1.SelectedAppointments[0]; bool IsRecur = false; controller = new AppointmentFormController(fCalendar.schedulerControl1, apt); int intCalID = Convert.ToInt32(controller.LabelId.ToString()); int intEventID = Common.GetID("select EventID from CalendarEvent where CalendarEventID=" + intCalID.ToString()); string strRecurrenceText = Common.GetString("select RecurrenceText from Event where EventID=" + intEventID.ToString()); if (strRecurrenceText != "") IsRecur = true; if (IsRecur) { frmDeleteEvents frmDelEvt = new frmDeleteEvents(intEventID, intCalID); if (frmDelEvt.ShowDialog() == DialogResult.OK) { fCalendar.LoadCalendar(); } frmDelEvt.Close(); frmDelEvt.Dispose(); frmDelEvt = null; } else { if (Message.MsgDelete()) { string strMess = ""; Events evt = new Events(); evt.EventID = intEventID; strMess = evt.CheckClassEvent(); if (strMess == "") strMess = evt.CheckProgramEvent(); if (strMess != "") { Message.MsgWarning("This Event is linked with" + strMess + ".\n\nEvent cannot be deleted."); return; } evt.DeleteData(true); fCalendar.LoadCalendar(); } } } } }
private void iDelete_Click(object sender, EventArgs e) { if (schedulerControl1.SelectedAppointments.Count > 0) { Appointment apt = schedulerControl1.SelectedAppointments[0]; bool IsRecur = false; controller = new AppointmentFormController(schedulerControl1, apt); //int intCalID = Convert.ToInt32(apt.GetValue(schedulerControl1.Storage,"CEID")); int intCalID = Convert.ToInt32(controller.LabelId.ToString()); int intEventID = Common.GetID("select EventID from CalendarEvent where CalendarEventID=" + intCalID.ToString()); string strRecurrenceText = Common.GetString("select RecurrenceText from Event where EventID=" + intEventID.ToString()); if (strRecurrenceText != "") IsRecur = true; if (IsRecur) { frmDeleteEvents frmDelEvt = new frmDeleteEvents(intEventID, intCalID); if (frmDelEvt.ShowDialog() == DialogResult.OK) { schedulerStorage1.Appointments.DataSource = FetchGridData(); } frmDelEvt.Close(); frmDelEvt.Dispose(); } else { if (Message.MsgDelete()) { string strMess; Events evt = new Events(); evt.EventID = intEventID; strMess = evt.CheckClassEvent(); if (strMess == "") strMess = evt.CheckProgramEvent(); if (strMess != "") { Message.MsgWarning("This Event is linked with" + strMess + ".\n\nEvent cannot be deleted."); return; } evt.DeleteData(true); schedulerStorage1.Appointments.DataSource = FetchGridData(); } } } }
private void schedulerControl_EditAppointmentFormShowing(object sender, AppointmentFormEventArgs e) { Appointment apt = e.Appointment; controller = new AppointmentFormController(schedulerControl1, apt); // Required to open the recurrence form via context menu. bool isNewApp = schedulerStorage1.Appointments.IsNewAppointment(apt); if (isNewApp) { e.Handled = true; return; } frmEventDlg fEvtDlg = null; bool IsRecur = false; bool IsExtraClass = false; e.Handled = true; int intCalID = Convert.ToInt32(controller.LabelId.ToString()); int intEventID = Common.GetID("select EventID from CalendarEvent where CalendarEventID=" + intCalID.ToString()); string strRecurrenceText = Common.GetString("select RecurrenceText from Event where EventID=" + intEventID.ToString()); IsExtraClass = apt.Subject.Contains("Extra Class"); if (strRecurrenceText != "") IsRecur = true; int Option = -1; if (IsRecur) { if (!IsExtraClass) { frmOpenEvents frmOpenEvt = new frmOpenEvents(); if (frmOpenEvt.ShowDialog() == DialogResult.OK) { Option = frmOpenEvt.Option; } else { e.Handled = true; frmOpenEvt.Close(); frmOpenEvt.Dispose(); return; } } } if (Option == 1) { //fEvtDlg=new frmEventDlg(intEventID, intCalID); //fEvtDlg.Mode="Edit"; //fEvtDlg.EventID = intEventID; //fEvtDlg.LoadData(); string module = string.Empty; int _uid; int _eventtypeindex = 0; Events objEvent = new Events(); _uid = objEvent.GetEvent(intEventID, ref module, ref _eventtypeindex); if (module != "") { if (module == "Class") { frmClassDlg frm = new frmClassDlg(_uid, _eventtypeindex, intCalID); frm.Mode = "Edit"; if (frm.ShowDialog() == DialogResult.OK) { LoadCalendar(); frm.Close(); frm.Dispose(); } } else if (module == "Program") { frmProgramDlg frm = new frmProgramDlg(_uid, _eventtypeindex, intCalID); frm.Mode = "Edit"; if (frm.ShowDialog() == DialogResult.OK) { LoadCalendar(); frm.Close(); frm.Dispose(); } } } else { fEvtDlg = new frmEventDlg(); fEvtDlg.Mode = "Edit"; fEvtDlg.EventID = intEventID; fEvtDlg.LoadData(); } } else { string module = string.Empty; int _uid; int _eventtypeindex = 0; Events objEvent = new Events(); _uid = objEvent.GetEvent(intEventID, ref module, ref _eventtypeindex); if (IsExtraClass) _eventtypeindex = 4; if (module != "") { if (module == "Class") { frmClassDlg frm = new frmClassDlg(_uid, _eventtypeindex); frm.Mode = "Edit"; if (frm.ShowDialog() == DialogResult.OK) { LoadCalendar(); frm.Close(); frm.Dispose(); } } else if (module == "Program") { frmProgramDlg frm = new frmProgramDlg(_uid, _eventtypeindex); frm.Mode = "Edit"; if (frm.ShowDialog() == DialogResult.OK) { LoadCalendar(); frm.Close(); frm.Dispose(); } } } } /* if (fEvtDlg != null) { if (fEvtDlg.ShowDialog() == DialogResult.OK) { schedulerStorage1.Appointments.DataSource = FetchGridData(); e.Handled = true; } e.Handled = true; fEvtDlg.Close(); fEvtDlg.Dispose(); }*/ }
public CustomRecurrenceForm(AppointmentFormController controller) { RecurrenceVisualController = new StandaloneRecurrenceVisualController(controller); Controller = controller; InitializeComponent(); }