public void FillGrid() { DataTable dt = objOptionCategory.GetOptionCategoryTrueAll(StrCompId.ToString()); Session["dtoptionCate"] = dt; Session["dtFilter"] = dt; GvOptionCategory.DataSource = dt; GvOptionCategory.DataBind(); lblTotalRecords.Text = Resources.Attendance.Total_Records + " : " + dt.Rows.Count.ToString(); AllPageCode(); }
public static string[] GetCompletionList(string prefixText, int count, string contextKey) { Inv_OptionCategoryMaster ObjOptCat = new Inv_OptionCategoryMaster(); DataTable dt = new DataView(ObjOptCat.GetOptionCategoryTrueAll(HttpContext.Current.Session["CompId"].ToString()), "EName='" + prefixText.ToString() + "'", "", DataViewRowState.CurrentRows).ToTable(); string[] text = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { text[i] = dt.Rows[i]["EName"].ToString(); } return(text); }
protected void btnSave_Click(object sender, EventArgs e) { DateTime dt = DateTime.ParseExact(txtDate.Text, "dd/MM/yyyy", null); string SubProductId = "0"; string ProductId = new DataView(ObjInvProductMaster.GetProductMasterTrueAll(StrCompId.ToString()), "EProductName like '" + txtProductId.Text.Trim() + "%'", "", DataViewRowState.CurrentRows).ToTable().Rows[0]["ProductId"].ToString(); if (txtSubProduct.Text != "") { if (txtSubProduct.Text != "0") { SubProductId = new DataView(ObjInvProductMaster.GetProductMasterTrueAll(StrCompId.ToString()), "EProductName like '" + txtSubProduct.Text.Trim() + "%'", "", DataViewRowState.CurrentRows).ToTable().Rows[0]["ProductId"].ToString(); } } if (ProductId == "") { ProductId = "0"; } if (SubProductId == "") { ProductId = "0"; } if (txtOption.Text == "") { DisplayMessage("Enter Option"); txtOption.Text = ""; txtOption.Focus(); return; } if (txtOptCatId.Text == "") { DisplayMessage("Enter Option Category"); txtOptCatId.Text = ""; txtOptCatId.Focus(); return; } if (txtShortDesc.Text == "") { DisplayMessage("Enter Option Short Description"); txtShortDesc.Text = ""; txtShortDesc.Focus(); return; } if (txtUnitPrice.Text == "") { DisplayMessage("Enter Unit Price"); txtUnitPrice.Text = ""; txtUnitPrice.Focus(); return; } if (txtQty.Text == "") { DisplayMessage("Enter Quantity"); txtQty.Text = ""; txtQty.Focus(); return; } string OptionCateId = string.Empty; if (txtOptCatId.Text != "") { OptionCateId = new DataView(ObjOpCate.GetOptionCategoryTrueAll(StrCompId.ToString()), "EName='" + txtOptCatId.Text.Trim() + "'", "", DataViewRowState.CurrentRows).ToTable().Rows[0]["OptionCategoryId"].ToString(); } if (hdnDetailEdit.Value == "") { DataTable dtPS = new DataView(ObjInvBOM.BOM_All(StrCompId.ToString()), "OptionId='" + txtOption.Text.Trim() + "' and OptionCategoryId='" + OptionCateId.Trim() + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dtPS.Rows.Count != 0) { DisplayMessage("Option Id & Option Category Already Exists"); txtOptCatId.Text = ""; txtOption.Text = ""; txtOption.Focus(); return; } ObjInvBOM.Insert_BOM(StrCompId.ToString(), "1", ProductId.Trim(), dt.ToString().Trim(), ddlTransType.SelectedValue.ToString().Trim(), SubProductId.ToString().Trim(), txtModelNo.Text.ToString().Trim(), txtOption.Text.ToString().Trim(), txtOptionDesc.Text.ToString().Trim(), txtShortDesc.Text.ToString().Trim(), OptionCateId.ToString().Trim(), txtUnitPrice.Text.ToString().Trim(), txtQty.Text.ToString().Trim(), "", "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), StrUserId.ToString(), DateTime.Now.ToString(), StrUserId.ToString(), DateTime.Now.ToString()); } else { DataTable dtPSID = new DataView(ObjInvBOM.BOM_ById(StrCompId.ToString(), hdnDetailEdit.Value.ToString()), "OptionId='" + txtOption.Text.Trim() + "' and OptionCategoryId='" + OptionCateId.Trim() + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dtPSID.Rows.Count == 0) { DataTable dtPS = new DataView(ObjInvBOM.BOM_All(StrCompId), "OptionId='" + txtOption.Text.Trim() + "' and OptionCategoryId='" + OptionCateId.Trim() + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dtPS.Rows.Count != 0) { DisplayMessage("Option Id & Option Category Already Exists"); txtOptCatId.Text = ""; txtOption.Text = ""; txtOption.Focus(); return; } } ObjInvBOM.Update_BOM(hdnDetailEdit.Value.ToString(), StrCompId.ToString().Trim(), "1", ProductId.ToString().Trim(), dt.ToString().Trim(), ddlTransType.SelectedValue.ToString().Trim(), SubProductId.ToString().Trim(), txtModelNo.Text.ToString().Trim(), txtOption.Text.ToString().Trim(), txtOptionDesc.Text.ToString().Trim(), txtShortDesc.Text.ToString().Trim(), OptionCateId.ToString().Trim(), txtUnitPrice.Text.ToString().Trim(), txtQty.Text.ToString().Trim(), "", "", "", "", "", "", true.ToString(), DateTime.Now.ToString(), true.ToString(), StrUserId.ToString(), DateTime.Now.ToString()); } ddlTransType.Enabled = false; txtDate.Enabled = false; txtModelNo.Enabled = false; txtProductId.Enabled = false; Reset_Child(); fillGrid(); pnlChlidGrid.Visible = true; rdoOption.Focus(); }