示例#1
0
        private void butIncrease_Click(object sender, System.EventArgs e)
        {
            int percent = 0;

            if (textPercent.Text == "")
            {
                MsgBox.Show(this, "Please enter a percent first.");
                return;
            }
            try{
                percent = System.Convert.ToInt32(textPercent.Text);
            }
            catch {
                MsgBox.Show(this, "Percent is not a valid number.");
                return;
            }
            if (percent < -99 || percent > 99)
            {
                MsgBox.Show(this, "Percent must be between -99 and 99.");
                return;
            }
            if (!MsgBox.Show(this, true, "This will overwrite all values of the current fee schedule showing in the main window.  For this reason, you should be working on a copy.  Are you sure you want to continue?"))
            {
                return;
            }

            int round = 0;

            if (radioDime.Checked)
            {
                round = 1;
            }
            if (radioPenny.Checked)
            {
                round = 2;
            }
            Fees.Increase(SchedNum, percent, round);
            Fees.RefreshCache();
            for (int i = 0; i < Fees.Listt.Count; i++)
            {
                if (Fees.Listt[i].FeeSched != SchedNum)
                {
                    continue;
                }
                if (Fees.Listt[i].Amount == 0)
                {
                    continue;
                }
                SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + ProcedureCodes.GetStringProcCode(Fees.Listt[i].CodeNum)
                                          + ", " + Lan.g(this, "Fee") + ": " + Fees.Listt[i].Amount.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + ": " + FeeScheds.GetDescription(Fees.Listt[i].FeeSched)
                                          + ". " + Lan.g(this, "Fee increased by") + " " + ((float)percent / 100.0f).ToString("p") + " " + Lan.g(this, " using the increase button in the Fee Tools window.")
                                          , Fees.Listt[i].CodeNum);
            }
            DialogResult = DialogResult.OK;
        }