public BookingsManager(BookingTab parent, string facilityName, DateTime bookingDate) { InitializeComponent(); // Reference parent this.parent = parent; // Initialize DB context context = new ElevenAlphaEntities(); // Initialize Window Size this.Size = new Size(1000, (int)(Screen.PrimaryScreen.Bounds.Height * 0.75)); // Initialize values based on slot selected FacilityTypeComboBox.Text = facilityName; BookingDateTimePicker.Value = bookingDate; // Initialize watermark FirstNameTextBox_TextChanged(FirstNameTextBox, new EventArgs()); LastNameTextBox_TextChanged(LastNameTextBox, new EventArgs()); // Initialize comboBox Collection InitializeFacilityTypeComboBox(); // Initialize dataGrid LoadBookingDataGrid(); }
public ViewBookingReceipt(int bookingId) { InitializeComponent(); context = new ElevenAlphaEntities(); this.bookingId = bookingId; }
public EditMember(int memberId, int selectedIndex, MembersTab memberTab) { InitializeComponent(); this.memberId = memberId; this.selectedIndex = selectedIndex; this.memberTab = memberTab; ctx = new ElevenAlphaEntities(); }
public MemberList() { InitializeComponent(); ElevenAlphaEntities context = new ElevenAlphaEntities(); MemberListCR memList = new MemberListCR(); memList.SetDataSource(context.Members); MemberListCRV.ReportSource = memList; }
public MemberLookup(BookingsManager parent) { InitializeComponent(); context = new ElevenAlphaEntities(); this.parent = parent; LoadMemberLookupDataGrid(); }
//loads data private void LoadDataGridView() { //filling columns FacilitiesdataGridView1.AutoGenerateColumns = false; ElevenAlphaEntities context = new ElevenAlphaEntities(); var columns = context.Facilities .Select (x => new Result { FacilityID = x.FacilityID, Name = x.Name, Active = (int)x.Active, OpeningTime = (DateTime)x.OpeningTime, ClosingTime = (DateTime)x.ClosingTime }); var resultsList = columns.ToList(); for (int i = 0; i < resultsList.Count; i++) { //Opening time to closing time var result = resultsList[i]; var opening = (result.OpeningTime).ToString("H:mm"); var closing = (result.ClosingTime).ToString("H:mm"); result.Difference = opening + " - " + closing; //number of hours between opening and closing var start = (result.OpeningTime.TimeOfDay); var end = (result.ClosingTime.TimeOfDay); TimeSpan duration = end - start; result.HoursOpen = int.Parse(duration.TotalHours.ToString()); //active status var activestatus = (result.Active.ToString()); if (activestatus == "1") { activestatus = "Active"; } else { activestatus = "Deactivated"; } result.ActiveStatus = activestatus; } FacilitiesdataGridView1.Columns[0].DataPropertyName = "FacilityID"; FacilitiesdataGridView1.Columns[1].DataPropertyName = "Name"; FacilitiesdataGridView1.Columns[2].DataPropertyName = "Difference"; FacilitiesdataGridView1.Columns[3].DataPropertyName = "HoursOpen"; FacilitiesdataGridView1.Columns[4].DataPropertyName = "ActiveStatus"; FacilitiesdataGridView1.DataSource = resultsList; }
public BookingTab(MainScreen parent) { InitializeComponent(); this.Dock = DockStyle.Fill; context = new ElevenAlphaEntities(); this.parent = parent; // Load Facility Types LoadFacilityTypes(); // Initialize DatePickers LoadDatePickers(); }
private void DeleteButton_Click(object sender, EventArgs e) //delete means Deactive { //check whether related type has related record string OldType = FacilityDataGrid.SelectedCells[0].Value.ToString(); //selected typename FacilityType ft = ctx.FacilityTypes.Where(x => x.Name == OldType).First(); //selected facilityType List <int> fi = new List <int>(); //typeid related facilityid Array foreach (Facility f in ctx.Facilities) { if (f.TypeID == ft.TypeID) { fi.Add(f.FacilityID); } } int flag = 0; foreach (Booking b in ctx.Bookings) { for (int i = 0; i < fi.Count(); i++) { if (b.FacilityID == fi[i]) { flag++; } } } if (flag != 0) { MessageBox.Show("Unable to delete due to existing Booking Records."); flag = 0; } else { ElevenAlphaEntities ctx = new ElevenAlphaEntities(); OldType = FacilityDataGrid.SelectedCells[0].Value.ToString(); FacilityType f = ctx.FacilityTypes.Where(x => x.Name == OldType).First(); f.Active = 0; ctx.SaveChanges(); refresh(); } }
public BookingHistoryMembers(BookingsManager parent, int memberId, DateTime fromDateTime, DateTime toDateTime) { InitializeComponent(); context = new ElevenAlphaEntities(); this.parent = parent; MemberIdTextBox.Text = memberId.ToString(); // Initialize DateTimePicker FromDateTimePicker.Value = fromDateTime; ToDateTimePicker.Value = toDateTime; // Initialize watermark FirstNameTextBox_TextChanged(FirstNameTextBox, new EventArgs()); LastNameTextBox_TextChanged(LastNameTextBox, new EventArgs()); }
public BookingHistoryFacilities(int facilityId, DateTime fromDateTime, DateTime toDateTime) { InitializeComponent(); context = new ElevenAlphaEntities(); FacilityIdTextBox.Text = facilityId.ToString(); this.facilityId = facilityId; // Initialize DatePickers FromDateTimePicker.Value = fromDateTime; ToDateTimePicker.Value = toDateTime; // Load DataGrid LoadBookingHistoryDataGrid(); // Initialize watermark FacilityNameTextBox_TextChanged(FacilityNameTextBox, new EventArgs()); }
private void AddButton_Click(object sender, EventArgs e) { string inputname = InputTypeNameTextBox.Text; // check if the inputname already exist but deactive int flag = 0; foreach (FacilityType f1 in ctx.FacilityTypes) { if (f1.Name.ToLower() == inputname.ToLower()) { ElevenAlphaEntities ctx = new ElevenAlphaEntities(); FacilityType f = ctx.FacilityTypes.Where(x => x.Name == inputname).First(); //f.Active = 1; flag = 1; if (f.Active == 0) { f.Active = 1; MessageBox.Show("Facility Type successfully reactivated."); } else { MessageBox.Show("Facility Type already exists!"); } ctx.SaveChanges(); refresh(); break; } } if (flag == 0) { ElevenAlphaEntities ctx = new ElevenAlphaEntities(); FacilityType fnew = new FacilityType(); fnew.Active = 1; fnew.Name = inputname; ctx.FacilityTypes.Add(fnew); ctx.SaveChanges(); refresh(); MessageBox.Show("Facility Type successfully added."); } }
//deactivating facilities private void FacilitiesTabBtnDeactivate_Click(object sender, EventArgs e)//already deactivated keeps popping out { ElevenAlphaEntities context = new ElevenAlphaEntities(); int q = (int)FacilitiesdataGridView1.SelectedRows[0].Cells[0].Value; Facility toinactive = context.Facilities.Where(x => x.FacilityID == q).First(); if (toinactive.Active == 0) { MessageBox.Show("Facility already deactivated"); } else { toinactive.Active = 0; MessageBox.Show("Facility deactivated"); context.SaveChanges(); LoadDataSearchFilter(); StatusFilter(); } parent.bookingTab.LoadBookingDataGrid(); }
public EditMember() { InitializeComponent(); ctx = new ElevenAlphaEntities(); }
public ViewOccupancyTrend() { InitializeComponent(); context = new ElevenAlphaEntities(); }
public FacilityTypeManager(CreateFacility parent) { InitializeComponent(); ctx = new ElevenAlphaEntities(); this.parent = parent; }