public void BindAddonProductToUpdate()
        {
            AddonProductsModal model = client.EditAddonProductbyID(ProductID, ParlourId);

            if (model == null)
            {
                Response.Write("<script>alert('Sorry!you are not authorized to perform edit on this Branch.');</script>");
            }
            else
            {
                ProductID           = model.pkiProductID;
                txtDescription.Text = model.ProductDesc;
                txtPremium.Text     = model.ProductCost.ToString("#,0.00");
                txtCover.Text       = model.ProductCover.ToString("#,0.00");
                chkongoing.Checked  = false;
                if (model.IsProductOngoing == 1)
                {
                    chkongoing.Checked = true;
                }
                chkLaybye.Checked = false;
                if (model.IsProductLaybye == 1)
                {
                    chkLaybye.Checked = true;
                }
                txtAddonName.Text = model.ProductName;

                btnSubmite.Text = "Update";
            }
        }
        protected void btnSubmite_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                AddonProductsModal model;
                model = client.GetAddonProductByID(txtAddonName.Text, ParlourId);
                if (model != null && ProductID == new Guid("00000000-0000-0000-0000-000000000000"))
                {
                    ShowMessage(ref lblMessage, MessageType.Danger, "Addon Product Already Exists.");
                }
                else
                {
                    model = new AddonProductsModal();
                    model.pkiProductID     = ProductID;
                    model.DateCreated      = System.DateTime.Now;
                    model.UserID           = UserID.ToString();
                    model.ProductDesc      = txtDescription.Text;
                    model.ProductCost      = Convert.ToDecimal(txtPremium.Text);
                    model.ProductCover     = Convert.ToDecimal(txtCover.Text);
                    model.IsProductOngoing = 0;
                    if (chkongoing.Checked)
                    {
                        model.IsProductOngoing = 1;
                    }
                    model.IsProductLaybye = 0;
                    if (chkLaybye.Checked)
                    {
                        model.IsProductLaybye = 1;
                    }
                    model.Parlourid    = ParlourId;
                    model.LastModified = System.DateTime.Now;
                    model.ModifiedUser = UserName;
                    model.ProductName  = txtAddonName.Text;



                    //================================================================
                    Guid retID = client.SaveAddonProductDetails(model);
                    ProductID = retID;

                    ShowMessage(ref lblMessage, MessageType.Success, "Addon Product Details successfully saved");
                    BindAddonProductList();
                    ClearControl();
                }
                lblMessage.Visible = true;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "goToTab512", "goToTab(5)", true);
            }
        }
Exemple #3
0
 public static Guid SaveAddonProductDetails(AddonProductsModal model)
 {
     return(ToolsSetingDAL.SaveAddonProductDetails(model));
 }