protected void Page_Load(object sender, EventArgs e) { Session["Local"] = "料架设定"; if (!IsPostBack) { SubinventoryDC subdc = new SubinventoryDC(); List <string> list = subdc.getAllSubinventory(); DropDownList1.DataSource = list; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, "ALL"); RegionDC dc = new RegionDC(); DataSet ds = dc.getEnableRegion(); if (ds != null) { DropDownList2.DataSource = ds.Tables[0].DefaultView; DropDownList2.DataValueField = "region_name"; DropDownList2.DataBind(); Region_key.DataSource = ds.Tables[0].DefaultView; Region_key.DataValueField = "region_name"; Region_key.DataBind(); Region_key2.DataSource = ds.Tables[0].DefaultView; Region_key2.DataValueField = "region_name"; Region_key2.DataBind(); } DropDownList2.Items.Insert(0, "ALL"); Region_key.Items.Insert(0, "--------select--------"); } }
//联动 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { DropDownList2.Items.Clear(); RegionDC dc = new RegionDC(); string sub_name = DropDownList1.SelectedValue; DataSet ds = null; if (sub_name.Equals("ALL")) { ds = dc.getEnableRegion(); } else { ds = dc.getRegion_nameBySub_name(DropDownList1.SelectedValue); } if (ds != null) { DropDownList2.DataSource = ds.Tables[0].DefaultView; DropDownList2.DataValueField = "region_name"; DropDownList2.DataBind(); DropDownList2.Items.Insert(0, "ALL"); } else { PageUtil.showToast(this, "数据异常!"); } }
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) { RegionDC DC = new RegionDC(); int i = 1; int subinventory = 0; try { subinventory = int.Parse(DropDownList3.SelectedValue); } catch (Exception ex) { i = 0; } if (i == 1) { DataSet data = DC.getRegion_nameBySubinventory_key(subinventory); if (data != null) { DropDownList4.DataValueField = "region_name"; DropDownList4.DataSource = data.Tables[0].DefaultView; DropDownList4.DataBind(); } else { PageUtil.showToast(this.Page, "数据载入出错"); } DropDownList4.Items.Insert(0, "请选择区域"); } }
/*得到并关联仓库(select标签)*/ public void ProcessRequest(HttpContext context) { RegionDC region_dc = new RegionDC(); List <string> list = new List <string>(); DataSet ds = region_dc.getRegion_nameBySubinventory_name(context.Request["warehouse_name"]); string json = toJson(ds); context.Response.ContentType = "text/plain"; context.Response.Write(json); }
//获取GridView内容 //private DataTable GetGridViewData(DataTable table) //{ // table.Columns.Add(new DataColumn("Po_no")); // table.Columns.Add(new DataColumn("Line_num")); // table.Columns.Add(new DataColumn("Item_name")); // table.Columns.Add(new DataColumn("RECEIPT_NO")); // table.Columns.Add(new DataColumn("Rcv_qty")); // table.Columns.Add(new DataColumn("RETURN_qty")); // table.Columns.Add(new DataColumn("VENDOR_CODE")); // foreach (GridViewRow row in GridView1.Rows) // { // DataRow sourseRow = table.NewRow(); // sourseRow["Po_no"] = row.Cells[0].Text; // sourseRow["Item_name"] = row.Cells[1].Text; // sourseRow["RECEIPT_NO"] = row.Cells[2].Text; // sourseRow["Line_num"] = row.Cells[3].Text; // sourseRow["Rcv_qty"] = row.Cells[4].Text; // sourseRow["RETURN_qty"] = row.Cells[5].Text; // sourseRow["VENDOR_CODE"] = row.Cells[6].Text; // table.Rows.Add(sourseRow); // } // return table; //} //联动 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { DropDownList2.Items.Clear(); RegionDC regionDC = new RegionDC(); string text = DropDownList1.SelectedValue.ToString(); DataSet ds2 = regionDC.getRegion_nameBySub_name(text); if (ds2 != null) { DropDownList2.DataSource = ds2.Tables[0].DefaultView; DropDownList2.DataValueField = "region_key"; DropDownList2.DataTextField = "region_name"; DropDownList2.DataBind(); } //else // PageUtil.showAlert(this, "区域载入出错!"); DropDownList2.Items.Insert(0, "--选择区域--"); }
public void ProcessRequest(HttpContext context) { RegionDC regionDC = new RegionDC(); DataSet ds = regionDC.getRegion_nameBySubinventory_name(context.Request["name"]); List <string> modellist = new List <string>(); if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { modellist.Add(dr["region_name"].ToString()); } } string json = toJson(modellist); context.Response.ContentType = "text/plain"; context.Response.Write(json); }
/** * * 查询区域表信息* * ***/ protected void Select(object sender, EventArgs e) { //获取前台数据 string REGION_NAME = region_name.Value; Re_Leng(REGION_NAME, "区域名"); string SUBINVENTORY_KEY = Request.Form["subinventory_name"]; if (SUBINVENTORY_KEY == "ALL") { SUBINVENTORY_KEY = ""; } string CREATE_BY = create_by.Value; string ENABLED = enabled.Value; if (ENABLED == "ALL") { ENABLED = ""; } //查询区域表数据 RegionDC regionDC = new RegionDC(); DataSet ds = new DataSet(); ds = regionDC.searchRegionByFourParameters(REGION_NAME, SUBINVENTORY_KEY, CREATE_BY, ENABLED); if (ds == null) { if (REGION_NAME == string.Empty && SUBINVENTORY_KEY == string.Empty && CREATE_BY == string.Empty && ENABLED == string.Empty) { PageUtil.showToast(this, "区域表中无任何数据!"); } else { PageUtil.showToast(this, "区域表中无符合条件的数据!"); } } else { Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); } }
/** * * 删除区域表信息* * * **/ protected void Delete(object sender, EventArgs e) { //取主键(区域)的值 string REGION_KEY1 = Request.Form["region_key3"]; //删除区域数据 RegionDC regionDC3 = new RegionDC(); DataSet ds = new DataSet(); try { ds = regionDC3.deleteRegionById(REGION_KEY1); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); PageUtil.showToast(this, "删除区域表信息成功!"); } catch { PageUtil.showAlert(this, "删除区域表信息失败!"); } }
/** * * 修改区域表信息* * ***/ protected void Update(object sender, EventArgs e) { //获取输入的数据 string REGION_KEY = Request.Form["region_key2"]; string REGION_NAME2 = Request.Form["region_name2"]; Re_Leng(REGION_NAME2, "区域名"); string SUBINVENTORY_KEY2 = Request.Form["subinventory_name2"]; string ENABLED2 = Request.Form["enabled2"]; string DESCRIPTION2 = Request.Form["description2"]; Des_Leng(DESCRIPTION2, "描述"); string UPDATE_BY2 = Session["LoginName"].ToString(); //判断更改者是否为空 if (Session["LoginId"] == null) { PageUtil.showToast(this, "更改者为空!"); return; } //修改数据 RegionDC regionDC2 = new RegionDC(); DataSet ds = new DataSet(); try { ds = regionDC2.updateRegion(REGION_KEY, REGION_NAME2, SUBINVENTORY_KEY2, UPDATE_BY2, ENABLED2, DESCRIPTION2); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); PageUtil.showToast(this, "修改区域表信息成功!"); } catch { PageUtil.showToast(this, "修改区域表信息失败!"); } }
/** * * 新增区域表信息* * ***/ protected void Insert(object sender, EventArgs e) { //获取输入的数据 string REGION_NAME1 = region_name1.Value; Re_Leng(REGION_NAME1, "区域名"); string SUBINVENTORY_KEY1 = Request.Form["subinventory_name1"]; string ENABLED1 = enabled1.Value; string DESCRIPTION1 = description1.Value; Des_Leng(DESCRIPTION1, "描述"); string CREATE_BY1 = Session["LoginName"].ToString(); //选择库别 if (SUBINVENTORY_KEY1 == "-----请选择库别-----") { PageUtil.showToast(this, "请选择库别!"); return; } //判断区域名是否全为空 if (REGION_NAME1 == string.Empty) { PageUtil.showToast(this, "区域名不能为空!"); return; } //判断创建者是否为空 if (Session["LoginId"] == null) { PageUtil.showToast(this, "创建者为空!"); return; } //将数据插入数据表 RegionDC regionDC1 = new RegionDC(); DataSet ds = new DataSet(); ds = regionDC1.searchRegionByFourParameters(REGION_NAME1, "", "", ""); if (ds != null) { PageUtil.showToast(this, "该区域已存在!"); } else { try { ds = regionDC1.insertRegion(REGION_NAME1, SUBINVENTORY_KEY1, CREATE_BY1, ENABLED1, DESCRIPTION1); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); } catch { PageUtil.showAlert(this, "新增区域表信息失败!"); } } region_name1.Value = String.Empty; description1.Value = String.Empty; }