protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.lblErrorMessage.Text.Length != 0)
        {
            this.lblErrorMessage.Text = "";
        }

        if (this.txtBrandName.Text.Length == 0)
        {
            this.lblErrorMessage.Text = "* Invalid Brand Name";
            return;
        }

        ProductBrandInfoDTO pbDto = Populate();

        try
        {
            IProductBrandBL pbFacade = Facade.GetInstance().GetPBBlImp();
            pbFacade.AddProductBrand(pbDto);

            this.lblErrorMessage.Text = "Data Save Successfully.";

            this.hfPrimaryKey.Value = "";
            this.txtBrandCode.Text  = "";
            this.txtBrandName.Text  = "";
            this.btnAdd.Text        = "Save";
            GridView1.DataBind();
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }
Example #2
0
    private void DropDownListBrand(Facade facade)
    {
        IProductBrandBL            brandList  = facade.GetProductBrandDataList();
        List <ProductBrandInfoDTO> oBrandList = brandList.GetProductBrand();

        int i = 0;

        DDLBrand.Items.Clear();
        DDLBrand.Items.Add("(Select Any Brand)");
        this.DDLBrand.Items[i].Value = "00000000-0000-0000-0000-000000000000";
        foreach (ProductBrandInfoDTO newDto in oBrandList)
        {
            i++;
            this.DDLBrand.Items.Add(newDto.PB_Name);
            this.DDLBrand.Items[i].Value = newDto.PrimaryKey.ToString();
        }
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            int         index = e.RowIndex;
            GridViewRow row   = GridView1.Rows[index];

            ProductBrandInfoDTO pbDto = new ProductBrandInfoDTO();

            DataKey dk = GridView1.DataKeys[index];
            this.hfPrimaryKey.Value = dk.Value.ToString();
            pbDto.PrimaryKey        = (Guid)TypeDescriptor.GetConverter(pbDto.PrimaryKey).ConvertFromString(this.hfPrimaryKey.Value);

            IProductBrandBL pbFacade = Facade.GetInstance().GetPBBlImp();
            pbFacade.DelProductBrand(pbDto);
            this.hfPrimaryKey.Value = "";
            GridView1.DataBind();
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }