private void saveRates() { basicRates = new List<CommonTools.CustomerCharge>(); tierRates = new List<CommonTools.Tier>(); surcharges = new List<CommonTools.Surcharge>(); foreach (DataGridViewRow row in basicRateDataGridView.Rows) { if (row.IsNewRow) continue; char serviceType= '1'; switch (row.Cells["Service Type"].Value.ToString()) { case "Minimum Rate": serviceType = '0'; break; case "All Service Rate": serviceType = '1'; break; case "Cooking Only Rate": serviceType = '2'; break; case "Space Heater Only Rate": serviceType = '3'; break; default: serviceType = 'W'; break; } CommonTools.CustomerCharge rate = new CommonTools.CustomerCharge(row.Cells["Tenant Type"].Value.ToString(), serviceType, Convert.ToDecimal(row.Cells["Rate"].Value)); basicRates.Add(rate); } foreach (DataGridViewRow row in surchargeDataGridView1.Rows) { if (row.IsNewRow) continue; int usage = 1; char chargeType = ' '; switch (row.Cells["Usage"].Value.ToString()) { case "Flat Credit/Charge": usage = 1; break; case "By Usage": usage = 2; break; case "By Days": usage = 3; break; case "By Percentage": usage = 4 ; break; default: break; } switch (row.Cells["Charge Type"].Value.ToString()) { case "Generation": chargeType = 'G'; break; case "Delivery": chargeType = 'D'; break; default: break; } CommonTools.Surcharge surcharge = new CommonTools.Surcharge(row.Cells["Surcharge"].Value.ToString(), row.Cells["Tenant Type"].Value.ToString(), chargeType, usage, Convert.ToDecimal(row.Cells["Rate"].Value)); surcharges.Add(surcharge); } foreach (DataGridViewRow row in tierRateDataGridView1.Rows) { if (row.IsNewRow) continue; char chargeType = ' '; switch (row.Cells["Charge Type"].Value.ToString()) { case "Generation": chargeType = 'G'; break; case "Delivery": chargeType = 'D'; break; default: break; } CommonTools.Tier tier = new CommonTools.Tier(chargeType, row.Cells["Tenant Type"].Value.ToString()); tier.setTier(1, Convert.ToDecimal(row.Cells["Tier1"].Value)); tier.setTier(2, Convert.ToDecimal(row.Cells["Tier2"].Value)); tier.setTier(3, Convert.ToDecimal(row.Cells["Tier3"].Value)); tier.setTier(4, Convert.ToDecimal(row.Cells["Tier4"].Value)); tier.setTier(5, Convert.ToDecimal(row.Cells["Tier5"].Value)); tierRates.Add(tier); } switch (this.form.Text) { case "UtilityElectricity": ((UtilityElectricity0)this.form).custCharges = basicRates; ((UtilityElectricity0)this.form).tiers = tierRates; ((UtilityElectricity0)this.form).surcharges = surcharges; break; case "UtilityGas": ((UtilityGas0)this.form).custCharges = basicRates; ((UtilityGas0)this.form).tiers = tierRates; ((UtilityGas0)this.form).surcharges = surcharges; break; case "UtilityWater": ((UtilityWater)this.form).custCharges = basicRates; ((UtilityWater)this.form).tiers = tierRates; ((UtilityWater)this.form).surcharges = surcharges; break; } }
private void saveCustBtn_Click(object sender, EventArgs e) { if (statusCustCharge.Text == "" || !serviceCustCharge.Items.Contains(serviceCustCharge.Text)) { MessageBox.Show("Please enter appropriate values for customer charge."); return; } char service = ' '; if (serviceCustCharge.Text == "All Services") { service = '1'; } else if (serviceCustCharge.Text == "All Electric") { service = '2'; } else if (serviceCustCharge.Text == "Minimum Usage Charge") { service = '0'; } CommonTools.CustomerCharge custCharge = new CommonTools.CustomerCharge(statusCustCharge.Text, service, Convert.ToDecimal(custChargeRate.Text)); custCharges.RemoveAll(item => item.Equals(custCharge)); custCharges.Add(custCharge); storeremoveCC.Text = String.Format("{0}:{1} stored", statusCustCharge.Text, serviceCustCharge.Text); statusBox(); }
private void saveCustBtn_Click(object sender, EventArgs e) { if (statusCustCharge.Text == "") { MessageBox.Show("Please enter a label for customer charge."); return; } try { char service = 'W'; CommonTools.CustomerCharge custCharge = new CommonTools.CustomerCharge(statusCustCharge.Text, service, Convert.ToDecimal(custChargeRate.Text)); custCharges.RemoveAll(item => item.Equals(custCharge)); custCharges.Add(custCharge); statusBox(); } catch { MessageBox.Show("Enter a valid rate."); return; } }
private void saveCustBtn_Click(object sender, EventArgs e) { if (statusCustCharge.Text == "" || !serviceType.Items.Contains(serviceType.Text)) { MessageBox.Show("Please enter a label for customer charge."); return; } char service = mapServiceType(serviceType.Text); CommonTools.CustomerCharge custCharge = new CommonTools.CustomerCharge(statusCustCharge.Text, service, Convert.ToDecimal(custChargeRate.Text)); custCharges.RemoveAll(item => item.Equals(custCharge)); custCharges.Add(custCharge); statusBox(); }