protected void btnAdd_Click(object sender, EventArgs e) { try { if (this.lblErrorMessage.Text.Length != 0) { this.lblErrorMessage.Text = ""; } if (this.txtPU_Name.Text.Length == 0) { this.lblErrorMessage.Text = "Unit Name field can not be blank. Please Insert"; txtPU_Name.Focus(); return; } ProductUnitInfoDTO pudto = Populate(); IProductUnitBL puFacade = Facade.GetInstance().GetPUBLImp(); puFacade.addNewProductUnit(pudto); this.lblErrorMessage.Text = "Data Save Successfully."; this.txtPU_PK.Value = ""; this.txtPU_Code.Text = ""; //this.txtPU_Code.Text = pudto.PU_Code; this.txtPU_Name.Text = ""; this.btnAdd.Text = "Save"; GridView1.DataBind(); } catch (Exception Exp) { lblErrorMessage.Text = cls.ErrorString(Exp); } }
private void DropDownListUnit(Facade facade) { IProductUnitBL unitList = facade.GetProductUnitDataList(); List <ProductUnitInfoDTO> oUnitList = unitList.GetProductUnitInfo(); int i = 0; ddlProductUnit.Items.Clear(); ddlProductUnit.Items.Add("(Select any unit)"); this.ddlProductUnit.Items[i].Value = ""; foreach (ProductUnitInfoDTO newDto in oUnitList) { i++; this.ddlProductUnit.Items.Add(newDto.PU_Name); this.ddlProductUnit.Items[i].Value = newDto.PrimaryKey.ToString(); } }