Esempio n. 1
0
        protected void grdSupplierProductCategory_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Guid myRow_Id = Guid.Parse(e.CommandArgument.ToString());

            MDMSVC.DC_Message _msg = new MDMSVC.DC_Message();
            if (e.CommandName.ToString() == "Select")
            {
                dvMsg.Style.Add("display", "none");
                frmSupplierProductCategory.ChangeMode(FormViewMode.Edit);
                var result = _objMaster.GetProductCategoryBySupplier(new MDMSVC.DC_Supplier_ProductCategory()
                {
                    Supplier_ProductCategory_Id = myRow_Id
                });
                frmSupplierProductCategory.DataSource = result;
                frmSupplierProductCategory.DataBind();
                DropDownList ddlProductCategory        = (DropDownList)frmSupplierProductCategory.FindControl("ddlProductCategory");
                DropDownList ddlProductCategorySubType = (DropDownList)frmSupplierProductCategory.FindControl("ddlProductCategorySubType");
                //HtmlInputCheckBox chckbIsDefaultSupplier = (HtmlInputCheckBox)frmSupplierProductCategory.FindControl("chckbIsDefaultSupplier");
                BindProductCategory(ddlProductCategory);

                if (result != null)
                {
                    if (result.Count > 0)
                    {
                        if (ddlProductCategory != null)
                        {
                            ddlProductCategory.Items.FindByText(result[0].ProductCategory).Selected = true;
                        }
                        BindProductCategorySubType(ddlProductCategorySubType, ddlProductCategory.SelectedValue.ToString());
                        if (ddlProductCategorySubType != null)
                        {
                            ddlProductCategorySubType.Items.FindByText(result[0].ProductCategorySubType).Selected = true;
                        }
                        //if (chckbIsDefaultSupplier != null)
                        // chckbIsDefaultSupplier.Checked = Convert.ToBoolean(result[0].IsDefaultSupplier);
                    }
                }
            }
            else if (e.CommandName.ToString() == "SoftDelete")
            {
                _msg = _objMaster.Supplier_ProductCategorySoftDelete(new MDMSVC.DC_Supplier_ProductCategory()
                {
                    Supplier_ProductCategory_Id = myRow_Id,
                    IsActive  = false,
                    Edit_Date = DateTime.Now,
                    Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                });
                if (Convert.ToInt32(_msg.StatusCode) == Convert.ToInt32(BootstrapAlertType.Success))
                {
                    frmSupplierProductCategory.ChangeMode(FormViewMode.Insert);
                    frmSupplierProductCategory.DataBind();
                    BindSupplierProductCategoryGrid();
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Supplier Product Category has been deleted successfully", BootstrapAlertType.Success);
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode);
                }
                BindPageData();
            }

            else if (e.CommandName.ToString() == "UnDelete")
            {
                _msg = _objMaster.Supplier_ProductCategorySoftDelete(new MDMSVC.DC_Supplier_ProductCategory()
                {
                    Supplier_ProductCategory_Id = myRow_Id,
                    IsActive  = true,
                    Edit_Date = DateTime.Now,
                    Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                });
                if (Convert.ToInt32(_msg.StatusCode) == Convert.ToInt32(BootstrapAlertType.Success))
                {
                    frmSupplierProductCategory.ChangeMode(FormViewMode.Insert);
                    frmSupplierProductCategory.DataBind();
                    BindSupplierProductCategoryGrid();
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Supplier Product Category has been retrived successfully", BootstrapAlertType.Success);
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode);
                }
                BindPageData();
            }
        }