public SelfHelp() { InitializeComponent(); foreach (var item in SelfHelpList) { BookButton myBtn = new BookButton(item); myBtn.Click += MyBtn_Click; flowLayoutPanel1_list.Controls.Add(myBtn); } }
public void ValidateLocationSelect() { Helper.ScrollToSeeTheRightButton(_driver, RendezvousHotel); RendezvousHotel.Click(); Helper.ScrollToSeeTheRightButton(_driver, TypeOfRoom); SelectRoomCheckbox.Click(); Helper.ScrollToSeeTheRightButton(_driver, OneBedroomText); BookButton.Click(); }
public TruyenTranh() { InitializeComponent(); foreach (var item in listBook) { BookButton myBtn = new BookButton(item); myBtn.Click += MyBtn_Click; flowLayoutPanel1_list.Controls.Add(myBtn); } }
public void OnInit() { Init(); Reset(); foreach (Books.BookData data in Data.Instance.GetComponent <Books>().all) { if (data.state == Books.BookData.states.GOT_IT) { BookButton newButton = (BookButton)AddItem(); newButton.OnInit(data); } } }
public void CollectBooks(string root_path, GameObject listbox) { string path = root_path + BookDict.m_bookPath + @"\"; string pattern = "*" + BookDict.m_bookExt; string[] files = Directory.GetFiles(path, pattern); foreach (string file in files) { GameObject book = Instantiate(m_bookPrefab); BookButton script = GetBookButtonScript(book); script.BookPath = Path.GetFileNameWithoutExtension(file); book.transform.SetParent(listbox.transform, false); } }
BookButton GetBookButtonScript(GameObject holder) { BookButton script = null; foreach (Transform child in holder.transform) { if (child.gameObject.name == "BookButton") { script = (BookButton)child.gameObject.GetComponent(typeof(BookButton)); return(script); } } return(null); }
/* Event Handler for Display Button * 1. Perform Validation on 'No.of Guest' Input, Listbox Selection and Hotel Radio Button Selection * 2. Setting Base fare, Time Discount, Hotel Cost and Lunch cost * 3. Calculate Discount and Final Cost * 4. Provide choice to user if he wants to change the selection after displaying short inshorts about trip * 5. if Yes: Booking Breakup will be displayed. if No: Keep on the same main screen so that user can change selection */ private void DisplayButton_Click(object sender, EventArgs e) { //Local Variable Declaration int DestinationIndex, TimeIndex, BaseFareValue = 0, DiscountPercent = 0, NoOfGuestsValue = 0, FareBeforeTimeDiscount = 0, HotelPriceValue = 0, TotalHotelCharge = 0; decimal TimeDiscountValue = 0.0m, TotalBusFare = 0.0m, TotalLunchCharge = 0.0m, TotalPayableCharge = 0.0m, SpecialDiscountValue = 0.0m; string HotelPreference = "", LunchPreference = "", StringMessage = ""; DialogResult DialogRe; //Validating No. of Guests Input try { int value = int.Parse(NoOfGuestTextBox.Text); if (value > 0)//if value is greater than zero { //Performing Destination and Time based Validations if (DestinationListBox.SelectedIndex == -1) { MessageBox.Show("Please Select Destination before proceeding the booking", "Choose Destination", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (TimeListBox.SelectedIndex == -1) { MessageBox.Show("Please select departure time before proceeding the booking", "Choose Time", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (DestinationListBox.SelectedIndex != -1 && TimeListBox.SelectedIndex != -1) { //Setting Hotel Prices if (Hotel1RadioButton.Checked) { HotelPreference = "5-Star Stay"; HotelPriceValue = HOTELFARE1; } else if (Hotel2RadioButton.Checked) { HotelPreference = "4-Star Stay"; HotelPriceValue = HOTELFARE2; } else if (Hotel3RadioButton.Checked) { HotelPreference = "3-Star Stay"; HotelPriceValue = HOTELFARE3; } else if (NoHotelRadioButton.Checked) { HotelPriceValue = 0; } else { //if No Radiobutton has been selected MessageBox.Show("Please choose Hotel before proceeding", "Hotel Preference Required", MessageBoxButtons.OK, MessageBoxIcon.Error); HotelPriceValue = -1; } //if User has provided every input on mainscreen if (HotelPriceValue != -1) { DestinationIndex = DestinationListBox.SelectedIndex; TimeIndex = TimeListBox.SelectedIndex; //Setting Destination Price switch (DestinationIndex) { case 0: BaseFareValue = DESTINATIONFARE1; break; case 1: BaseFareValue = DESTINATIONFARE2; break; case 2: BaseFareValue = DESTINATIONFARE3; break; case 3: BaseFareValue = DESTINATIONFARE4; break; case 4: BaseFareValue = DESTINATIONFARE5; break; case 5: BaseFareValue = DESTINATIONFARE6; break; } //Setting Time based Discount switch (TimeIndex) { case 0: DiscountPercent = TIMEDISCOUNT1; break; case 1: DiscountPercent = TIMEDISCOUNT2; break; case 2: DiscountPercent = TIMEDISCOUNT3; break; case 3: DiscountPercent = 0; break; case 4: DiscountPercent = 0; break; case 5: DiscountPercent = TIMEDISCOUNT6; break; } //Getting Destination Name and Time From Listbox LocationLabel.Text = DestinationListBox.Items[DestinationIndex].ToString().Substring(0, 17); TimeLabel.Text = TimeListBox.Items[TimeIndex].ToString().Substring(0, 6); //Additional- Booking Status Information BookingStatusLabel.Text = "Not Confirmed"; //Performing Calculations NoOfGuestsLabel.Text = NoOfGuestsLabel1.Text = NoOfGuestsLabel2.Text = NoOfGuestTextBox.Text; NoOfGuestsValue = int.Parse(NoOfGuestTextBox.Text); BaseFareLabel.Text = "€ " + BaseFareValue.ToString(); FareBeforeTimeDiscount = NoOfGuestsValue * BaseFareValue; BaseFareTotalLabel.Text = "€ " + FareBeforeTimeDiscount.ToString(); //Time Based Discount if (DiscountPercent != 0) { TimeDiscountPanel.Visible = true; DiscountTimeLabel.Text = DiscountPercent.ToString() + " %"; TimeDiscountValue = FareBeforeTimeDiscount * (DiscountPercent / 100m); TotalDiscountTimeLabel.Text = "€ " + TimeDiscountValue.ToString("n2"); TotalDiscountTimeLabel.ForeColor = Color.Red; } else { TimeDiscountPanel.Visible = false; TotalDiscountTimeLabel.Text = ""; TimeDiscountValue = 0.0m; } // After Time Based Discount TotalBusFare = FareBeforeTimeDiscount - TimeDiscountValue; //(A) TotalBusFareLabel.Text = "€ " + TotalBusFare.ToString(); //(A) //Hotel Selection Calculation if (HotelPriceValue != 0) { HotelBookingGroupBox.Visible = true; HotelPreferenceLabel.Text = HotelPreference; HotelPriceLabel.Text = "€ " + HotelPriceValue.ToString(); TotalHotelCharge = HotelPriceValue * NoOfGuestsValue; HotelTotalLabel.Text = "€ " + TotalHotelCharge.ToString(); } else { HotelBookingGroupBox.Visible = false; TotalHotelCharge = 0; } //Packed Lunch Cost Calculation if (LunchCheckBox.Checked) { PackedLunchGroupBox.Visible = true; PackedLunchLabel.Text = "€ " + LUNCHCHARGE.ToString(); TotalLunchCharge = NoOfGuestsValue * LUNCHCHARGE; LunchPreferenceLabel.Text = LunchPreference; PackedLunchTotalLabel.Text = "€ " + TotalLunchCharge.ToString(); } else { PackedLunchGroupBox.Visible = false; TotalLunchCharge = 0.0m; } //Before Special Discount Calculation (B) TotalOptionalCostLabel.Text = "€ " + (TotalHotelCharge + TotalLunchCharge).ToString("n2"); TotalPayableCharge = TotalBusFare + TotalHotelCharge + TotalLunchCharge; //If No.og Guests are more than 3, // Hotel and Packed Lunch are selected // User will be eligible for 7.5% discount on booking price if (NoOfGuestsValue >= 3 && HotelPriceValue != 0 && LunchCheckBox.Checked == true) { SpecialDiscountPanel.Visible = true; SpecialDiscountLabel.Text = SPECIALDISCOUNT.ToString("n2") + " %"; SpecialDiscountValue = TotalPayableCharge * (SPECIALDISCOUNT / 100m); //0.075m TotalPayableCharge = TotalPayableCharge - SpecialDiscountValue; //(B) SpecialDiscountTotalLabel.Text = "€ " + SpecialDiscountValue.ToString("n2"); SpecialDiscountTotalLabel.ForeColor = Color.Red; } else { SpecialDiscountPanel.Visible = false; } //Final Amount ( A+ B ) TotalPayableLabel.Text = "€ " + TotalPayableCharge.ToString("n2"); TotalPayableLabel.ForeColor = Color.Green; //Generating Message to for Popup based on User Selections StringMessage = "\n Selected Destination : " + LocationLabel.Text + "\n Selected Depart. Time : " + TimeLabel.Text + "\n Provided No.of Guest : " + NoOfGuestsLabel.Text + "\n\nBus Booking Charges : " + TotalBusFareLabel.Text; if (HotelPriceValue != 0) { StringMessage = StringMessage + "\nHotel Booking Charges : " + HotelTotalLabel.Text; } if (LunchCheckBox.Checked) { StringMessage = StringMessage + "\nPacked Lunch Charges : " + PackedLunchTotalLabel.Text; } StringMessage = StringMessage + "\n\nFinal Booking Cost : " + TotalPayableLabel.Text + "\n\nDo you want to proceed with current selection booking(Yes) or Change Selection(No)?"; DialogRe = MessageBox.Show(StringMessage, "Booking Cost", MessageBoxButtons.YesNo, MessageBoxIcon.Information); //Taking User input for Proceeding with the booking if (DialogRe == DialogResult.Yes) { //If Yes, Displaying Breakup of Booking will be displayed this.Text = "Booking of" + LocationLabel.Text + " for " + NoOfGuestTextBox.Text + " Guests"; //Setting Master Data for Current Booking CurrentTotalBusFare = TotalBusFare; CurrentTotalOptional = TotalHotelCharge + TotalLunchCharge; CurrentTotalPayableLabel = TotalPayableCharge; //Making GUI Changes TourCostGroupBox.Visible = true; BookingStatusLabel.ForeColor = Color.Red; HighlightPanel.Location = new Point(2, 2); DisplayPanel.Visible = true; DisplayPanel.Location = new Point(12, 203); DisplayButton.Visible = false; ModifyBookingButton.Location = BookButton.Location; ModifyBookingButton.Visible = true; BookButton.Location = DisplayButton.Location; BookButton.Enabled = true; if (BookButton.Visible == false) { BookButton.Location = DisplayButton.Location; BookButton.Visible = true; ModifyBookingButton.Location = new Point(3, 104); ModifyBookingButton.Enabled = true; } BookButton.Focus(); SelectOptionsPanel.Visible = false; //Showing Tooltip on Book Button 'Click to Confirm Booking' toolTip1.Show(toolTip1.GetToolTip(BookButton), BookButton); toolTip1.ToolTipTitle = "Next Step"; } } } } else if (value < 0)//If user provides Negative Number { MessageBox.Show("Please enter positive number", "Negative no. of guests not allowed", MessageBoxButtons.OK, MessageBoxIcon.Error); } else//if user provides value '0' in No of guests { MessageBox.Show("Please enter atleast 1 guest", "Atleast 1 guest required", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch//if Invalid input provided { MessageBox.Show("Invalid Input Provided. Please provide a Number", "Correct Input Required", MessageBoxButtons.OK, MessageBoxIcon.Error); NoOfGuestTextBox.Focus(); NoOfGuestTextBox.SelectAll(); } }
public void RegisterBook(BookButton bookButton) { this._bookButton = bookButton; }
public void RegisterBook(BookButton bookButton) { this._bookButton = bookButton; }
public override void OnUIButtonClicked(UIButton uiButton) { BookButton button = (BookButton)uiButton; Events.ReadBook(button.data.id); }