//Item Grid Bind #region [Item Category Grid Bind] private void BindItemGrid() { try { EWA_Supplier objEWA = new EWA_Supplier(); BL_Supplier objBL = new BL_Supplier(); // objEWA.CategoryId = ddlCategory.SelectedValue; objEWA.OrgId = orgId; DataSet ds = objBL.BindItemGrid_BL(objEWA); if (ds.Tables[0].Rows.Count == 0 || ds == null) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GrdItem.DataSource = ds; GrdItem.DataBind(); int columncount = GrdItem.Rows[0].Cells.Count; GrdItem.Rows[0].Cells.Clear(); GrdItem.Rows[0].Cells.Add(new TableCell()); GrdItem.Rows[0].Cells[0].ColumnSpan = columncount; GrdItem.Rows[0].Cells[0].Text = "No Records Found"; } else { GrdItem.DataSource = ds; GrdItem.DataBind(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Check Data #region [Check Data] private int CheckData() { int i = 0; try { EWA_Supplier objEWA = new EWA_Supplier(); BL_Supplier objBL = new BL_Supplier(); objEWA.SupplierName = txtSupplierName.Text.Trim(); i = objBL.CheckDuplicateSupplier_BL(objEWA); return(i); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); return(0); } }
//SupplierCategory Link #region SupplierSupplierLinkButtonClick protected void lnkBtnSupplierName_Click(object sender, EventArgs e) { try { lock (this) { BL_Supplier objBL = new BL_Supplier(); EWA_Supplier objEWA = new EWA_Supplier(); LinkButton lnkBtnId = (LinkButton)sender; GridViewRow grdrow = lnkBtnId.NamingContainer as GridViewRow; // lnkBtnId = (LinkButton)grdrow.Cells[0].FindControl("SupplierId"); ViewState["SupplierId"] = GrdSupplier.DataKeys[grdrow.RowIndex].Value.ToString(); objEWA.SupplierId = Convert.ToInt32(ViewState["SupplierId"]); objEWA.OrgId = orgId; DataSet ds = objBL.BindSupplierData_BL(objEWA); txtSupplierName.Text = GrdSupplier.DataKeys[grdrow.RowIndex].Values["SupplierName"].ToString(); //ddlCategory.SelectedValue = GrdSupplier.DataKeys[grdrow.RowIndex].Values["CategoryId"].ToString(); txtMobileNo.Text = GrdSupplier.DataKeys[grdrow.RowIndex].Values["MobileNo"].ToString(); txtPhoneNo.Text = GrdSupplier.DataKeys[grdrow.RowIndex].Values["PhoneNo"].ToString(); txtFaxNo.Text = GrdSupplier.DataKeys[grdrow.RowIndex].Values["FaxNo"].ToString(); txtEmailId.Text = GrdSupplier.DataKeys[grdrow.RowIndex].Values["EmailId"].ToString(); txtWebsite.Text = GrdSupplier.DataKeys[grdrow.RowIndex].Values["Website"].ToString(); txtAddress.Text = GrdSupplier.DataKeys[grdrow.RowIndex].Values["Address"].ToString(); if (ds.Tables[1].Rows.Count >= 0) { ViewState["SuppItem"] = ds; GrdItem.DataSource = ds.Tables[2]; GrdItem.DataBind(); } else { BindItemGrid(); } callUpdate(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }