//private User user; //private List<List<Guest>> guests; //private List<List<Guest>> OrigGuests; //private List<EventDay> _day; //private Events _event; //List<Guest> guestList; //List<EventDay> _day; //EventDay eventDay_; //int selectedIndex = -1; public frmWizSummary(frmWizard c) { //_guests = c._guests; //_day = c._days; _event = c._event; _days = c._days; //_programs = new List<List<Program>>(); _programs = c._programs; _items = c._items; _itemTypes = new List<ItemTypes>(); _guests = c._guests; //_guests = new List<List<Guest>>(); _publish = c._publish; _task = c._task; InitializeComponent(); }
//Publish orginal_publish; public frmWizPublish(frmWizard c) { InitializeComponent(); publish = c._publish; user = c._user; event_ = c._event; //publish.StartDateTime = orginal_publish.StartDateTime; //publish.Remarks = orginal_publish.Remarks; //publish.EndDateTime = orginal_publish.EndDateTime; //publish.IsPayable = orginal_publish.IsPayable; //publish.PaymentAMount = orginal_publish.PaymentAMount; if (publish.Remarks != null) { txtRemarks.Text = publish.Remarks; dtpStart.SelectedDateTime = publish.StartDateTime; dtpEnd.SelectedDateTime = publish.EndDateTime; cboIsPayable.IsChecked = publish.IsPayable; txtamount.Text = publish.PaymentAMount.ToString(); } else { btnDelete.IsEnabled = false; } dtpStart.dtpDate.SelectedDateChanged += dateChanged; dtpEnd.dtpDate.SelectedDateChanged += dateChanged; dtpStart.cboHr.SelectionChanged += dateChanged; dtpStart.cboMin.SelectionChanged += dateChanged; dtpEnd.cboHr.SelectionChanged += dateChanged; dtpEnd.cboMin.SelectionChanged += dateChanged; dtpStart.cboHr.SelectionChanged += starthourChanged; dtpEnd.cboHr.SelectionChanged += endhourChanged; }
private void Window_Loaded(object sender, RoutedEventArgs e) { RegistrationHelper client = new RegistrationHelper(); try { publish = client.ViewPublish(event_.EventID); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { client.Close(); } if (publish != null) { txtRemarks.Text = publish.Remarks; dtpStart.SelectedDateTime = publish.StartDateTime; dtpEnd.SelectedDateTime = publish.EndDateTime; cboIsPayable.IsChecked = publish.IsPayable; txtamount.Text = publish.PaymentAMount.ToString(); } else { btnDelete.IsEnabled = false; } dtpStart.dtpDate.SelectedDateChanged += dateChanged; dtpEnd.dtpDate.SelectedDateChanged += dateChanged; dtpStart.cboHr.SelectionChanged += dateChanged; dtpStart.cboMin.SelectionChanged += dateChanged; dtpEnd.cboHr.SelectionChanged += dateChanged; dtpEnd.cboMin.SelectionChanged += dateChanged; dtpStart.cboHr.SelectionChanged += starthourChanged; dtpEnd.cboHr.SelectionChanged += endhourChanged; changed = false; }
private void btnClear_Click(object sender, RoutedEventArgs e) { publish = null; txtRemarks.Text = ""; //dtpStart.clear(); dtpStart.dtpDate.SelectedDate = DateTime.Now; //dtpEnd.clear(); dtpEnd.dtpDate.SelectedDate = DateTime.Now; cboIsPayable.IsChecked = false; changed = true; }
public static void WizardAddEvent(User user, Events evnt, List<List<Program>> programs, List<List<Guest>> guests, List<ItemTypes> itemtypes, List<Items> items, Publish pub,List<Task> tasks) { try{ if (!user.isEventOrganizer) throw new FaultException<SException>(new SException(), new FaultReason("Invalid User, User Does Not Have Rights To Create Events!")); for (int x = 0; x < itemtypes.Count; x++) { for(int y=0;y<itemtypes.Count;y++) { if (x == y) continue; if (itemtypes[x].typeString == itemtypes[y].typeString) { throw new Exception("Duplicate ItemType"); } } } for (int x = 0; x < items.Count; x++) { for (int y = 0; y < items.Count; y++) { if (x == y) continue; if (items[x].ItemName == items[y].ItemName && items[x].typeString == items[y].typeString) { throw new Exception("Duplicate ItemType"); } } } DAL dalDataContext = new DAL(); using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required)) { EventWithDays eventswithdays; eventswithdays = EventDayController.AddEvent(user, evnt.Name, evnt.StartDateTime, evnt.EndDateTime, evnt.Description, evnt.Website, evnt.Tag, dalDataContext); evnt = eventswithdays.e; for (int x = 0; x < programs.Count; x++) { List<Program> daysprograms = programs[x]; for (int y = 0; y < daysprograms.Count; y++) { Program program = daysprograms[y]; ProgramController.AddProgram(program.Name, program.StartDateTime, program.EndDateTime, program.Description, eventswithdays.ds[x].DayID, program.Location, dalDataContext); } } for (int x = 0; x < guests.Count; x++) { List<Guest> daysguests = guests[x]; for (int y = 0; y < daysguests.Count; y++) { Guest guest = daysguests[y]; GuestController.AddGuest(eventswithdays.ds[x].DayID, guest.Name, guest.Contact, guest.Description, dalDataContext); } } for (int i = 0; i < itemtypes.Count; i++) { ItemTypesController.AddItemType(evnt.EventID, itemtypes[i].typeString, itemtypes[i].IsImportantType, dalDataContext); } for (int i = 0; i < items.Count; i++) { ItemsController.AddItem(evnt.EventID, items[i].typeString, items[i].ItemName, items[i].Satisfaction, items[i].EstimatedPrice, dalDataContext); } // eventswithdays = EventDayController.AddEvent(u, ); //insert task for (int i = 0; i < tasks.Count; i++) { TaskController.CreateTask(evnt.EventID, tasks[i].TaskName, tasks[i].TaskDesc, tasks[i].DueDate, dalDataContext); } //insert publish if(pub.Remarks != null) PublishController.AddPublish(evnt, pub.StartDateTime, pub.EndDateTime, pub.Remarks, pub.IsPayable, pub.PaymentAMount, dalDataContext); dalDataContext.SubmitChanges(); tScope.Complete(); } } catch(Exception ex){ throw new FaultException<SException>(new SException(), new FaultReason("Error!, an error occured while adding in new event via wizard")); } }
public static void AddPublish(User user, int eventID, DateTime startDateTime, DateTime endDateTime, string remarks, Boolean isPayable, decimal paymentAmount) { Events evnt = EventController.GetEvent(eventID); if (!user.isAuthorized(evnt)) throw new FaultException<SException>(new SException(), new FaultReason("Invalid User, User Does Not Have Rights To Publish this Event!")); if (endDateTime.CompareTo(startDateTime) < 0) throw new FaultException<SException>(new SException(), new FaultReason("Error, start date must be ealier then end date")); if (evnt.EndDateTime.CompareTo(startDateTime) < 0 || evnt.EndDateTime.CompareTo(endDateTime) < 0) throw new FaultException<SException>(new SException(), new FaultReason("Error, start or end date/time must not be after the event's date/time")); try { int fieldsize = FieldController.ViewField(eventID).Count(); if (isPayable == false && ParticipantController.isParticipantPaid(eventID) == true) { throw new InvalidOperationException(); } DAL dalDataContext = new DAL(); if(fieldsize == 0) FieldController.AddDefaultFeids(evnt.EventID, dalDataContext); Table<Publish> publishs = dalDataContext.publishs; Publish creatingpublish = new Publish(eventID, startDateTime, endDateTime, remarks, isPayable, paymentAmount); publishs.InsertOnSubmit(creatingpublish); publishs.Context.SubmitChanges(); } catch (InvalidOperationException ex) { throw new FaultException<SException>(new SException(), new FaultReason("invalid operation, event already have paid participant and cannot be an unpaid event anymore!")); } catch { throw new FaultException<SException>(new SException(), new FaultReason("An Error occured While Publishing Event, Please Try Again!")); } }
public static void AddPublish(Events evnt, DateTime startDateTime, DateTime endDateTime, string remarks, Boolean isPayable, decimal paymentAmount, DAL dalDataContext) { if (endDateTime.CompareTo(startDateTime) < 0) throw new FaultException<SException>(new SException(), new FaultReason("Error, start date must be ealier then end date")); if (evnt.EndDateTime.CompareTo(startDateTime) < 0 || evnt.EndDateTime.CompareTo(endDateTime) < 0) throw new FaultException<SException>(new SException(), new FaultReason("Error, start or end date/time must not be after the event's date/time")); try { FieldController.AddDefaultFeids(evnt.EventID, dalDataContext); Table<Publish> publishs = dalDataContext.publishs; Publish creatingpublish = new Publish(evnt.EventID, startDateTime, endDateTime, remarks, isPayable, paymentAmount); publishs.InsertOnSubmit(creatingpublish); publishs.Context.SubmitChanges(); } catch (InvalidOperationException ex) { throw new FaultException<SException>(new SException(), new FaultReason("invalid operation, event already have paid participant and cannot be an unpaid event anymore!")); } catch { throw new FaultException<SException>(new SException(), new FaultReason("An Error occured While Publishing Event, Please Try Again!")); } }
public void WizardAddEvent(User user, Events evnt, List<List<Program>> programs, List<List<Guest>> guests, List<ItemTypes> itemtypes, List<Items> items, Publish pub, List<Task> tasks) { WizardController.WizardAddEvent(user, evnt, programs, guests, itemtypes, items, pub, tasks); }