Пример #1
0
        protected void gvFeeProvisions_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int profileID = Convert.ToInt32(ViewState["profileID"]);

            int id = Convert.ToInt32(e.CommandArgument);

            CarrierInvoiceProfileFeeProvision provision = null;

            if (e.CommandName == "DoEdit")
            {
                provision = CarrierInvoiceProfileFeeProvisionManager.Get(id);

                if (provision != null)
                {
                    ViewState["ID"] = id.ToString();

                    txtProvisionAmount.Value = provision.ProvisionAmount;

                    txtProvisionName.Text = provision.ProvisionText;

                    showProvisionPanel();
                }
            }
            else if (e.CommandName == "DoDelete")
            {
                CarrierInvoiceProfileFeeProvisionManager.Delete(id);

                bindProvisions(profileID);
            }
        }
Пример #2
0
        public void bindProvisions(int profileID)
        {
            ViewState["profileID"] = profileID.ToString();

            gvFeeProvisions.DataSource = CarrierInvoiceProfileFeeProvisionManager.GetAll(profileID);

            gvFeeProvisions.DataBind();
        }
Пример #3
0
        private void copyProfileFeeProvision(List <CarrierInvoiceProfileFeeProvision> feeProvisions, int carrierInvoiceProfileID)
        {
            if (feeProvisions != null && feeProvisions.Count > 0)
            {
                foreach (CarrierInvoiceProfileFeeProvision feeProvision in feeProvisions)
                {
                    CarrierInvoiceProfileFeeProvision copyFeeProvision = new CarrierInvoiceProfileFeeProvision();

                    copyFeeProvision.CarrierInvoiceProfileID = carrierInvoiceProfileID;
                    copyFeeProvision.ProvisionText           = feeProvision.ProvisionText;
                    copyFeeProvision.ProvisionAmount         = feeProvision.ProvisionAmount;

                    CarrierInvoiceProfileFeeProvisionManager.Save(copyFeeProvision);
                }
            }
        }
Пример #4
0
        protected void btnProvisionSave_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(ViewState["ID"]);

            int profileID = Convert.ToInt32(ViewState["profileID"]);

            CarrierInvoiceProfileFeeProvision provision = null;

            lblProvisionMessage.Text = string.Empty;

            if (id == 0)
            {
                // new
                provision = new CarrierInvoiceProfileFeeProvision();

                provision.CarrierInvoiceProfileID = profileID;
            }
            else
            {
                provision = CarrierInvoiceProfileFeeProvisionManager.Get(id);
            }

            if (provision != null)
            {
                provision.ProvisionAmount = Convert.ToDecimal(txtProvisionAmount.Value == null ? "0" : txtProvisionAmount.Value);

                provision.ProvisionText = txtProvisionName.Text;

                try {
                    CarrierInvoiceProfileFeeProvisionManager.Save(provision);

                    showProvisionsGrid();

                    bindProvisions(profileID);
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);

                    lblProvisionMessage.Text = "Unable to save provision data.";

                    lblProvisionMessage.Visible = true;
                }
            }
        }