private void BindRowItemList() { SqlParameter[] arrParam = new SqlParameter[1]; arrParam[0] = new SqlParameter("@Action", "SELECT"); DataSet DSRecords = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_RawMaterial_CRUD", arrParam); if (DSRecords.Tables[0].Rows.Count > 0) { DDLItemList.DataSource = DSRecords.Tables[0]; DDLItemList.DataTextField = "Name"; DDLItemList.DataValueField = "ID"; DDLItemList.DataBind(); DDLItemList.Items.Insert(0, new ListItem("Select", "0")); } }
public void BindItemFinishTypeList() { SqlParameter[] arr = new SqlParameter[1]; arr[0] = new SqlParameter("@Action", "SELECT"); DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_FinishMaterial_CRUD", arr); if (ds.Tables[0].Rows.Count > 0) { DDLItemList.DataSource = ds.Tables[0]; DDLItemList.DataTextField = "Name"; DDLItemList.DataValueField = "ID"; DDLItemList.DataBind(); DDLItemList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0")); } }
protected void Page_Load(object sender, EventArgs e) { // Load data for the DropDownList control only once, when the // page is first loaded. if (!IsPostBack) { var jsonPath = Server.MapPath("~\\WeatherHelpFiles\\city.list.json"); var json = File.ReadAllText(jsonPath); DDLItemList dropdownlistJsonItem = JsonConvert.DeserializeObject <DDLItemList>(json); foreach (DDLItem ddlItem in dropdownlistJsonItem.data) { if (ddlItem.country == "LV") { this.DropDownList1.Items.Add(new ListItem(ddlItem.name)); } } } }
protected void ItemList_SelectedIndexChanged(object sender, EventArgs e) { string SelQuery = string.Empty; if (sender == TBSearchBarcode && TBSearchBarcode.Text != string.Empty) { SelQuery = "SELECT * FROM RawMaterial WHERE Barcode='" + TBSearchBarcode.Text.Trim() + "'"; } else if (sender == DDLItemList && DDLItemList.SelectedIndex > 0) { SelQuery = "SELECT * FROM RawMaterial WHERE ID='" + DDLItemList.SelectedValue + "'"; } DataTable DTT = clsConnectionSql.filldt(SelQuery); if (DTT.Rows.Count > 0) { double Quantity = 1.0; double DisPer = 0.00; string[] DArray = new string[6]; string[] DataArray = new string[6]; DArray = SelectDTTable(Convert.ToInt32(DTT.Rows[0]["ID"])); if (DArray[0] == DTT.Rows[0]["ID"].ToString()) { Quantity = Convert.ToDouble(DArray[3]) + Quantity; DataArray = BindInnerData(DTT, Quantity, DisPer); UpdateDTTable(DataArray[0], DataArray); } else { DataArray = BindInnerData(DTT, Quantity, DisPer); InsertDTTable(DataArray); } BindInnerGV(); } DDLItemList.ClearSelection(); TBSearchBarcode.Text = string.Empty; }
protected void GVItemDetail_RowCommand(object sender, GridViewCommandEventArgs e) { try { int recordId = Convert.ToInt32(e.CommandArgument); Session["RecordID"] = recordId; if (e.CommandName == "EditRecord") { SqlParameter[] arr = new SqlParameter[2]; arr[0] = new SqlParameter("@Action", "SELECT_ByID"); arr[1] = new SqlParameter("@ID", recordId); DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemRequestMaster_CRUD", arr); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { MVRequest.ActiveViewIndex = 1; LBLReqNo.Text = dt.Rows[0]["ReqNo"].ToString(); LBLTOtQut.Text = dt.Rows[0]["TotalQty"].ToString(); DDLComLoc.SelectedValue = dt.Rows[0]["ComId"].ToString(); BindComForRequest(); LBLTotVal.Text = dt.Rows[0]["TotalValue"].ToString(); LBReqDate.Text = dt.Rows[0]["ReqDate"].ToString(); txtDelDate.Text = dt.Rows[0]["DeliverDate"].ToString(); BindDDLNGO(DDLComLoc.SelectedValue); DDLNgoLoc.ClearSelection(); DDLNgoLoc.SelectedValue = dt.Rows[0]["NgoId"].ToString(); DDLItemType.ClearSelection(); DDLItemList.ClearSelection(); txtRemarks.Text = dt.Rows[0]["Remark"].ToString(); txtTermCon.Text = dt.Rows[0]["TermAndCondition"].ToString(); BindDDLGodown(DDLComLoc.SelectedValue); DDLDelTo.SelectedValue = dt.Rows[0]["DeliverTo"].ToString(); DDLItemType.SelectedValue = dt.Rows[0]["ItemType"].ToString(); switch (DDLItemType.SelectedValue) { case "1": BindItemKitTypeList(); break; case "2": BindItemFinishTypeList(); break; default: break; } btnSubmit.Text = "Update"; SqlParameter[] arrParam2 = new SqlParameter[2]; arrParam2[0] = new SqlParameter("@Action", "Select_ByReqId"); arrParam2[1] = new SqlParameter("@ReqId", recordId); DataSet DSInner = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemRequestDetail_CRUD", arrParam2); // Bind Table CreateDTTable(); TempDT = ViewState["DTTable"] as DataTable; for (int i = 0; i < DSInner.Tables[0].Rows.Count; i++) { string SelQuery = "SELECT * FROM KitMaterial Where ID='" + DSInner.Tables[0].Rows[i]["ItemId"] + "'"; DataTable DTProduct = clsConnectionSql.filldt(SelQuery); double ItemPrice, Quantity, GTotal; Quantity = Convert.ToDouble(DSInner.Tables[0].Rows[i]["Qty"].ToString()); ItemPrice = Convert.ToDouble(DTProduct.Rows[0]["TotalValue"].ToString()); GTotal = ItemPrice * Quantity; TempDT.Rows.Add(DTProduct.Rows[0]["ID"], DTProduct.Rows[0]["Image"].ToString(), DTProduct.Rows[0]["Name"].ToString(), DTProduct.Rows[0]["ProductCode"].ToString(), DTProduct.Rows[0]["HSNCode"].ToString(), DTProduct.Rows[0]["BarCode"].ToString(), DTProduct.Rows[0]["UOM"].ToString(), Quantity.ToString("0.00"), ItemPrice.ToString("0.00"), GTotal.ToString("0.00")); } GVInner.DataSource = TempDT; GVInner.DataBind(); ViewState["DTTable"] = TempDT; } BindInnerGV(); } else if (e.CommandName == "DeleteRecord") { SqlParameter[] arr = new SqlParameter[2]; arr[0] = new SqlParameter("@Action", "DELETE"); arr[1] = new SqlParameter("@ID", recordId); DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemRequestMaster_CRUD", arr); } if (e.CommandName == "CheckStatus") { SqlParameter[] arr = new SqlParameter[2]; arr[0] = new SqlParameter("@Action", "SELECT_ByID"); arr[1] = new SqlParameter("@ID", recordId); DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemRequestMaster_CRUD", arr); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { if (dt.Rows[0]["ReqStatus"].ToString() == "True") { SqlParameter[] arr1 = new SqlParameter[3]; arr1[0] = new SqlParameter("@Action", "UPDATE_Status"); arr1[1] = new SqlParameter("@ReqStatus", false); arr1[2] = new SqlParameter("@ID", recordId); int result = SqlHelper.ExecuteNonQuery(Connection.connect(), CommandType.StoredProcedure, "SP_ItemRequestMaster_CRUD", arr1); } if (dt.Rows[0]["ReqStatus"].ToString() == "False") { SqlParameter[] arr1 = new SqlParameter[3]; arr1[0] = new SqlParameter("@Action", "UPDATE_Status"); arr1[1] = new SqlParameter("@ReqStatus", true); arr1[2] = new SqlParameter("@ID", recordId); int result = SqlHelper.ExecuteNonQuery(Connection.connect(), CommandType.StoredProcedure, "SP_ItemRequestMaster_CRUD", arr1); } } } BindGVDetail(); } catch (Exception ex) { ShowMessage(ex.Message, MessageType.Error); } }