示例#1
0
        /// <summary>
        /// Occurs when the user clicks on top of the calculate request table button.
        /// </summary>
        /// <param name="sender">Button clicked</param>
        /// <param name="e">Button parameters</param>
        private void btCalculate_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbFee.Text) || tbFee.Text.Equals(AppMessages.feePlaceHolder))
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(tbDailyHoursWorked.Text) || tbDailyHoursWorked.Text.Equals(AppMessages.dailyHoursPlaceHolder))
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(tbBonusPercent.Text) || tbBonusPercent.Text.Equals(AppMessages.bonusPlaceHolder))
            {
                return;
            }

            wdmWorkDetails = new WorkDetailsModel();
            wdmWorkDetails.DailyWorkedHours = Convert.ToDecimal(tbDailyHoursWorked.Text);
            wdmWorkDetails.DailyWorkHours   = Convert.ToDecimal(AppParameters.DailyWorkHours);
            wdmWorkDetails.WorkMonth        = calWorkDays.SelectedDates.Count > 0 ? calWorkDays.SelectedDates[0] : DateTime.Today;
            wdmWorkDetails.WorkedDays       = calWorkDays.SelectedDates.Count;

            bfmPayment             = new BonusFeeModel();
            bfmPayment.workDetails = wdmWorkDetails;
            if (ConfigurationManager.AppSettings.AllKeys.Contains("Currency"))
            {
                bfmPayment.Currency = ConfigurationManager.AppSettings.Get("Currency");
            }
            bfmPayment.BonusPercent = Convert.ToDecimal(tbBonusPercent.Text);
            bfmPayment.MonthlyFee   = Convert.ToDecimal(tbFee.Text);

            PaymentTable = new TableBuilder(bfmPayment);
            dgPayMintAble.ItemsSource = PaymentTable.GenerateTable();
            gFinalTable.Visibility    = Visibility.Visible;
        }