private void GetDataFromForm() { if (Event == null) { Event = new Event { EventId = Guid.NewGuid() } } ; Event.Name = EventName.EditValue as string; Event.Description = EventDescription.EditValue as string; Event.Type = EventTypeReference.GetTypeByReference(EventType.EditValue as string); int personNumber; Int32.TryParse(EventPersonNumber.EditValue.ToString(), out personNumber); Event.PersonNumber = personNumber; Event.ManagerPersonId = EventManager.EditValue == null ? Guid.Empty : (Guid)EventManager.EditValue; Event.ContactPersonId = EventContactPerson.EditValue == null ? Guid.Empty : (Guid)EventContactPerson.EditValue; Event.OrganizationId = EventOrganization.EditValue == null ? Guid.Empty : (Guid)EventOrganization.EditValue; Event.RegistrationDate = RegistrationDateEdit.EditValue == null ? DateTime.Now : (DateTime)RegistrationDateEdit.EditValue; Event.ExitDate = ExitDateEdit.EditValue == null ? DateTime.Now : (DateTime)ExitDateEdit.EditValue; Event.CashPrice = CashPrice; Event.NonCashPrice = NonCashPrice; Event.Loss = Loss; Event.Review = Review; }
private void EventDetailsForm_Shown(object sender, EventArgs e) { EventType.Properties.Items.AddRange(EventTypeReference.GetEventReferences()); EventContactPerson.Properties.DataSource = PersonsDataSource; EventManager.Properties.DataSource = PersonsDataSource; EventOrganization.Properties.DataSource = OrganizationsDataSource; SetFormData(); }
private void TypeTextEdit_CustomDisplayText(object sender, CustomDisplayTextEventArgs e) { if (e == null || e.Value == null) { return; } try { e.DisplayText = EventTypeReference.GetEventReference((EventTypes)e.Value); }catch (Exception) { } }
private void SetFormData() { if (Event == null) { EventType.EditValue = EventTypeReference.GetEventReference(EventTypes.Unknown); } else { EventName.EditValue = Event.Name; EventDescription.EditValue = Event.Description; EventType.EditValue = EventTypeReference.GetEventReference(Event.Type); EventPersonNumber.EditValue = Event.PersonNumber; EventManager.EditValue = Event.ManagerPersonId; EventContactPerson.EditValue = Event.ContactPersonId; EventOrganization.EditValue = Event.OrganizationId; RegistrationDateEdit.EditValue = Event.RegistrationDate; ExitDateEdit.EditValue = Event.ExitDate; } }