Exemplo n.º 1
0
 private void InitializeElements()
 {
     classesToFollow  = new List <FormElementRemovable <RadioButtonsFormElement> >();
     addClassButton   = new ButtonFormElement(this, addClassButtonString, AddClassButtonFunction);
     studentBirthDate = new DateFormElement(this, studentBirthDateString);
     studentBirthDate.SetTextBoxOfset(textLength);
     currentDate = new DateFormElement(this, currentDateString);
     currentDate.SetTextBoxOfset(textLength);
     employmentAgencyMediated = new CheckBoxFormElement(this, employmentAgencyMediatedString);
     employmentAgencyMediated.SetWidth(employmentAgencyMediatedTextLength);
     showCostButton = new ButtonFormElement(this, showCostButtonString, ShowCostButtonFunction);
     showCostButton.SetWidth(showCostButtonTextLength);
 }
Exemplo n.º 2
0
 private void InitializeElements()
 {
     rentStartDate               = new DateFormElement(this, rentStartDateString);
     rentStopDate                = new DateFormElement(this, rendStopDateString);
     volume                      = new TextBoxWithLabelFormElement(this, volumeString);
     timesRemoved                = new TextBoxWithLabelFormElement(this, timesRemovedString);
     repeatCustomerCheckBox      = new CheckBox();
     repeatCustomerCheckBox.Text = repeatCustomerCheckBoxString;
     Controls.Add(repeatCustomerCheckBox);
     calculateRentPrice        = new Button();
     calculateRentPrice.Text   = calculateRentPriceString;
     calculateRentPrice.Click += new EventHandler(CalculateRentPriceButtonFunction);
     Controls.Add(calculateRentPrice);
 }
Exemplo n.º 3
0
        private void CalculateRentPriceButtonFunction(object sender, EventArgs e)
        {
            int[] startDate = rentStartDate.GetDate();
            int[] stopDate  = rentStopDate.GetDate();

            int startDay   = startDate[DateFormElement.GetDayIndex()];
            int startMonth = startDate[DateFormElement.GetMonthIndex()];
            int startYear  = startDate[DateFormElement.GetYearIndex()];
            int stopDay    = stopDate[DateFormElement.GetDayIndex()];
            int stopMonth  = stopDate[DateFormElement.GetMonthIndex()];
            int stopYear   = stopDate[DateFormElement.GetYearIndex()];

            int volume;

            try
            {
                volume = int.Parse(this.volume.GetValue());
            }
            catch (FormatException exception)
            {
                volume = 0;
            }
            int timesRemoved;

            try
            {
                timesRemoved = int.Parse(this.timesRemoved.GetValue());
            }
            catch (FormatException exception)
            {
                timesRemoved = 0;
            }

            bool repeatCustomer = repeatCustomerCheckBox.Checked;

            double price = ContainerRent.CalculatePrice(startDay, startMonth, startYear, stopDay, stopMonth, stopYear, volume, timesRemoved, repeatCustomer);

            MessageBox.Show(priceMessageBoxString + price);
        }