protected void ApmtButton_Click(object sender, EventArgs e) { Page.Validate("BookingInfoGroup"); if (Page.IsValid == true) { int CustomerId = 0; if (int.TryParse(CmbBxName.SelectedValue.ToString().Trim(), out CustomerId)) { CustomerId = Int16.Parse(CmbBxName.SelectedValue.ToString().Trim()); } int HairStylistId = 0; if (int.TryParse(DDLStylist.SelectedValue.ToString().Trim(), out HairStylistId)) { HairStylistId = Int16.Parse(DDLStylist.SelectedValue.ToString().Trim()); } var Appointment = new AppointmentDetails(); Appointment.Id = 1; //Arbitrary as I do not need the Id for inserting new services Appointment.DesiredDate = TxtAppointmentDate.Text.Trim(); Appointment.StartingTime = DDLBeginTime.SelectedItem.Text.ToString().Trim(); Appointment.EndingTime = ""; //Arbitrary as I do not need the EndingTime for inserting Appointment.DetermineServicesToBePerformed(ChkBxListServices); Appointment.HairStylist = HairStylistId; Appointment.DetermineCustomerHairLenght(DDLHairLength.SelectedIndex); Appointment.IdCustomer = CustomerId; Appointment.RegistrationDate = DateTime.Now; //For initialization purposes Appointment.RegisteredBy = 1; //Arbitrary until we decide how to allow access to app Appointment.Cancelled = false; //For initialization purposes Appointment.CancellationReason = ""; //For initialization purposes /* Get schedule for stylist on date picked by user, also select services timeframe*/ var dtTableServicesDurationAndProcessingTime = RetrieveServicesDurationAndProcessingTime(Appointment); //Create DataTable for services to be booked for a customer. var dtTableServicesToBeBooked = BuildServicesSchedule(Appointment, dtTableServicesDurationAndProcessingTime); var dtTableStylistSchedule = RetrieveStylistSchedule(Appointment); if (DetermineTimeSlotsAvailabilityForServicesToBeBooked(dtTableStylistSchedule, dtTableServicesToBeBooked)) { AssignMessageToLabelWithResultFromOperation(AppConstants.LblMessage.WarningForecolor, AppConstants.LblMessage.WarningBackgroundColor, "Please select another time"); } else { string bookingDateSelected = BookServices(dtTableServicesToBeBooked); TxtAppointmentSummary.Text = bookingDateSelected; PopulateGridWithAppointmentData(bookingDateSelected); } DetermineWhetherDateForBookingAppointmentSelectedIsToday(); UpdtPanelMessageCenter.Update(); UpdtPanelScheduleGridView.Update(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "VanishMessageCenterApmt", "vanishMessageCenter();", true); } }
protected void BtnNewCustomer_Click(object sender, EventArgs e) { Page.Validate("RegistrationInfoGroup"); if (Page.IsValid == true) { ProjectStructs.Client customer = CreateAHashOfNewCustomerDataEntered(); var Client = ClientHair.CreateCustomerObjectAndAssignData(customer); RegisterCustomer(Client); PopulateCustomerNamesComboBox(LoadCustomerNamesIntoDataTable()); UpdtPanelMessageCenter.Update(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "VanishMessageCenterNewCust", "vanishMessageCenter();", true); } }