private void TileMakePayment_Click(object sender, EventArgs e) { this.Visible = false; FormMakePay fmpy = new FormMakePay(this.GetId); fmpy.Visible = true; }
private void BtnConfirm_Click(object sender, EventArgs e) { //Converting string of dtpBookDoc to DateTIme DateTime BookDoc = DateTime.ParseExact(this.dtpBookDoc.Text, "dddd , dd , MMMM , yyyy, ( HH:mm tt )", null); //Auto generated Booking Id string query = "select BookId from DocBook ORDER BY CAST(SUBSTRING(BookId, CHARINDEX('-', BookId) + 1, LEN(BookId)) AS INT);"; //Checking if the table is empty try { this.Dr = DataAccess.GetLastRow(query); } catch { MessageBox.Show("Error: Something went wrong!"); } //Setting serial if (this.Dr != null) { //Accessing last serial string lastRowItem = this.Dr["BookId"].ToString(); string trimValue = lastRowItem.Remove(0, 4); this.serial = Int32.Parse(trimValue); } else { this.serial = 0; } //Increamenting BookId this.BookId = (++this.serial).ToString("d2"); //Check if booking exist if (!AccessedBtnBookedSlot) { MessageBox.Show("Please check booked slots for new date!"); } //Confirm btn action else { string currentTime = dtpBookDoc.Value.ToString("HH:mm") + ":00"; this.SlotRangeOverflow = false; for (int j = 0; j < VarCb.Length; j++) { if (VarCb[j].Text == currentTime && VarCb[j].Checked) { this.SlotUnavailable = true; this.SlotRangeOverflow = false; break; } if (VarCb[j].Text != currentTime && !VarCb[j].Checked) { this.SlotRangeOverflow = true; } else if (VarCb[j].Text == currentTime) { this.SlotRangeOverflow = false; break; } } if (this.SlotRangeOverflow) { MessageBox.Show("Selected time is out of slot range, Please select valid one!"); } else if (this.SlotUnavailable) { MessageBox.Show("Selected slot is unavailable, Please select another one!"); } else { //Opening payment page this.Visible = false; FormMakePay fmp = new FormMakePay(this.GetId, this.BookId, this.lblIdDoc.Text, this.lblFee.Text, BookDoc); fmp.Visible = true; } } }
private void BtnConfirm_Click(object sender, EventArgs e) { //Converting string of dtpBookHp to DateTIme DateTime HpBook = DateTime.ParseExact(this.dtpBookHp.Text, "dddd , dd , MMMM , yyyy", null); //Auto generated Booking Id string query = "select BookId from HpBook ORDER BY CAST(SUBSTRING(BookId, CHARINDEX('-', BookId) + 1, LEN(BookId)) AS INT);"; //Checking if the table is empty try { this.Dr = DataAccess.GetLastRow(query); } catch { MessageBox.Show("Error: Something went wrong!"); } //Setting serial if (this.Dr != null) { //Accessing last serial string lastRowItem = this.Dr["BookId"].ToString(); string trimValue = lastRowItem.Remove(0, 4); this.serial = Int32.Parse(trimValue); } else { this.serial = 0; } //Increamenting BookId this.BookId = (++this.serial).ToString("d2"); //Setting slot SetSlot(); //Validation for Confirm btn if (string.IsNullOrWhiteSpace(this.cmbSlot.Text) || string.IsNullOrWhiteSpace(this.cmbTest.Text)) { MessageBox.Show("Select Test and Slot first!"); } else if (this.AvailableSlot == 0) { MessageBox.Show("All slots are booked!"); } else if (this.blockDateInfo.Visible == true || this.blockSlotInfo.Visible == true) { MessageBox.Show("Selected slot is blocked for booking!"); } else { //Opening payment page this.Visible = false; FormMakePay fmp = new FormMakePay(this.GetId, this.BookId, this.HpId, this.lblFee.Text, HpBook, this.TestId, this.Slot); fmp.Visible = true; } }