protected void btnSave_Click(object sender, EventArgs e) { CarrierInvoiceProfileFeeSchedule fee = null; int profileID = Convert.ToInt32(ViewState["profileID"]); // record id int id = Convert.ToInt32(ViewState["ID"]); if (id == 0) { fee = new CarrierInvoiceProfileFeeSchedule(); fee.CarrierInvoiceProfileID = profileID; } else { fee = CarrierInvoiceProfileFeeScheduleManager.Get(id); } if (fee != null) { try { fee.FlatFee = Convert.ToDecimal(txtFlatFee.Value == null ? "0" : txtFlatFee.Value); fee.MinimumFee = Convert.ToDecimal(txtMinimumAmount.Value == null ? "0" : txtMinimumAmount.Value); fee.PercentFee = Convert.ToDecimal(txtPercentFee.Value == null ? "0" : txtPercentFee.Value); fee.RangeAmountFrom = Convert.ToDecimal(txtAmountFrom.Value == null ? "0" : txtAmountFrom.Value); fee.RangeAmountTo = Convert.ToDecimal(txtAmountTo.Value == null ? "0" : txtAmountTo.Value); fee.FlatCatPercent = Convert.ToDecimal(txtFlatCatPercent.Value == null ? "0" : txtFlatCatPercent.Value); fee.FlatCatFee = Convert.ToDecimal(txtFlatCatFee.Value == null ? "0" : txtFlatCatFee.Value); CarrierInvoiceProfileFeeScheduleManager.Save(fee); showFeeScheduleGrid(); bindFeeSchedule(profileID); } catch (Exception ex) { Core.EmailHelper.emailError(ex); } } }
private void copyProfileFeeSchedule(List <CarrierInvoiceProfileFeeSchedule> feeSchedules, int carrierInvoiceProfileID) { if (feeSchedules != null && feeSchedules.Count > 0) { foreach (CarrierInvoiceProfileFeeSchedule feeSchedule in feeSchedules) { CarrierInvoiceProfileFeeSchedule copyFeeSchedule = new CarrierInvoiceProfileFeeSchedule(); copyFeeSchedule.CarrierInvoiceProfileID = carrierInvoiceProfileID; copyFeeSchedule.FlatFee = feeSchedule.FlatFee; copyFeeSchedule.MinimumFee = feeSchedule.MinimumFee; copyFeeSchedule.PercentFee = feeSchedule.PercentFee; copyFeeSchedule.RangeAmountFrom = feeSchedule.RangeAmountFrom; copyFeeSchedule.RangeAmountTo = feeSchedule.RangeAmountTo; CarrierInvoiceProfileFeeScheduleManager.Save(copyFeeSchedule); } } }