public static int StoreHouseDetailInsert(StoreHouseDetail s) { Database db = DatabaseFactory.CreateDatabase("Constr"); string sql = string.Format("insert into t_StoreHouseDetail values('{0}','{1}','{2}','{3}')", s.HouseID, s.SubareaName, s.Description, s.State); int rows = db.ExecuteNonQuery(CommandType.Text, sql); return(rows); }
public static int StoreHouseDetailUpdate(StoreHouseDetail s) { Database db = DatabaseFactory.CreateDatabase("Constr"); string sql = string.Format("update t_StoreHouseDetail set HouseID='{0}' , SubareaName='{1}' , Description='{2}' , State='{3}' where ID='{4}'", s.HouseID, s.SubareaName, s.Description, s.State, s.ID); int rows = db.ExecuteNonQuery(CommandType.Text, sql); return(rows); }
public bool insertNewNode(StoreHouseDetail s) { int rowsAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@HouseID", SqlDbType.Int), new SqlParameter("@SubareaName ", SqlDbType.NVarChar), new SqlParameter("@Description", SqlDbType.NVarChar) }; parameters[0].Value = s.HouseID; parameters[1].Value = s.SubareaName; parameters[2].Value = s.Description; SQLHelper.RunProcedure("p_StoreHouseDetail_insertNewNode", parameters, out rowsAffected); return(1 == rowsAffected); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; if (context.Request["SubareaName"] != null) { StoreHouseDetail s = new StoreHouseDetail(); s.ID = Convert.ToInt32(context.Request["id"]); s.HouseID = Convert.ToInt32(context.Request["houseid"]); s.Description = context.Request["Description"]; s.SubareaName = context.Request["SubareaName"]; s.State = context.Request["State"]; context.Response.Write(StoreHouseDetailManager.StoreHouseDetailUpdate(s) > 0); } }
public static List <StoreHouseDetail> StoreHouseDetailDrop() { Database db = DatabaseFactory.CreateDatabase("Constr"); string sql = string.Format("select * from t_StoreHouse"); DataSet ds = db.ExecuteDataSet(CommandType.Text, sql); List <StoreHouseDetail> ll = new List <StoreHouseDetail>(); foreach (DataRow item in ds.Tables[0].Rows) { StoreHouseDetail sh = new StoreHouseDetail(); sh.HouseID = Convert.ToInt32(item["HouseID"].ToString()); sh.HouseName = item["HouseName"].ToString(); ll.Add(sh); } return(ll); }
public StoreHouseDetail getByID(int ID) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Int) }; parameters[0].Value = ID; StoreHouseDetail detail = new StoreHouseDetail(); SqlDataReader reader = SQLHelper.RunProcedure("p_StoreHouseDetail_getByID", parameters); if (reader.Read()) { detail.ID = reader.GetInt32(reader.GetOrdinal("ID")); detail.HouseID = reader.GetInt32(reader.GetOrdinal("HouseID")); detail.Description = reader.GetString(reader.GetOrdinal("Description")); detail.SubareaName = reader.GetString(reader.GetOrdinal("SubareaName")); } reader.Close(); return(detail); }
public List <StoreHouseDetail> getAll() { List <StoreHouseDetail> list = new List <StoreHouseDetail>(); SqlDataReader reader = SQLHelper.RunProcedure("p_StoreHouseDetail_getAll", null); while (reader.Read()) { StoreHouseDetail item = new StoreHouseDetail(); item.ID = reader.GetInt32(reader.GetOrdinal("ID")); item.HouseID = reader.GetInt32(reader.GetOrdinal("HouseID")); item.Description = reader.GetString(reader.GetOrdinal("Description")); item.SubareaName = reader.GetString(reader.GetOrdinal("SubareaName")); list.Add(item); } reader.Close(); return(list); }
protected void updateButton_Click(object sender, EventArgs e) { string str1 = SubareaName.Text.ToString(); string str2 = Description.Text.ToString(); StoreHouseDetail s = new StoreHouseDetail(); s.SubareaName = str1; s.Description = str2; s.HouseID = int.Parse(StoreHouseDropDownList.SelectedValue.ToString()); s.State = DropDownList1.SelectedValue.ToString(); if (Pageaction.Text.ToString().Equals("edit")) { int id = int.Parse(editID.Text.ToString()); s.ID = id; if (Leyp.SQLServerDAL.Factory.getStoreHouseDetailDAL().updateStoreHouseDetail(s)) { Panel1.Visible = false; HyperLink1.Visible = true; } else { Panel1.Visible = false; HyperLink1.Text = "操作失败!返回列表"; HyperLink1.Visible = true; } } else { if (Leyp.SQLServerDAL.Factory.getStoreHouseDetailDAL().insertNewNode(s)) { Panel1.Visible = false; HyperLink1.Visible = true; } else { Panel1.Visible = false; HyperLink1.Text = "操作失败!可能系信息重复!返回列表"; HyperLink1.Visible = true; } } }
public static List <StoreHouseDetail> StoreHouseDetailID(int id) { Database db = DatabaseFactory.CreateDatabase("Constr"); string sql = string.Format("select tl.HouseID,tl.ID,t.HouseName,tl.SubareaName,tl.Description,tl.State from t_StoreHouse t,t_StoreHouseDetail tl where t.HouseID=tl.HouseID and ID='{0}'", id); DataSet ds = db.ExecuteDataSet(CommandType.Text, sql); List <StoreHouseDetail> ll = new List <StoreHouseDetail>(); foreach (DataRow item in ds.Tables[0].Rows) { StoreHouseDetail sh = new StoreHouseDetail(); sh.HouseID = Convert.ToInt32(item["HouseID"].ToString()); sh.ID = Convert.ToInt32(item["ID"].ToString()); sh.HouseName = item["HouseName"].ToString(); sh.SubareaName = item["SubareaName"].ToString(); sh.Description = item["Description"].ToString(); sh.State = item["State"].ToString(); ll.Add(sh); } return(ll); }
public List <StoreHouseDetail> getListByHouseID(int HouseID) { List <StoreHouseDetail> list = new List <StoreHouseDetail>(); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@HouseID", SqlDbType.Int) }; parameters[0].Value = HouseID; SqlDataReader reader = SQLHelper.RunProcedure("p_StoreHouseDetail_getListByHouseID", parameters); while (reader.Read()) { StoreHouseDetail item = new StoreHouseDetail(); item.ID = reader.GetInt32(reader.GetOrdinal("ID")); item.HouseID = reader.GetInt32(reader.GetOrdinal("HouseID")); item.Description = reader.GetString(reader.GetOrdinal("Description")); item.SubareaName = reader.GetString(reader.GetOrdinal("SubareaName")); list.Add(item); } reader.Close(); return(list); }
/// <summary> /// /// </summary> protected void Databang() { object action = Request.QueryString["action"]; if (action != null) { if (action.ToString().Equals("edit")) { int ID = Int16.Parse(Request.QueryString["ID"].ToString()); StoreHouseDetail s = new StoreHouseDetail(); s = Leyp.SQLServerDAL.Factory.getStoreHouseDetailDAL().getByID(ID); SubareaName.Text = s.SubareaName; Pageaction.Text = "edit"; editID.Text = ID.ToString(); StoreHouseDropDownList.Visible = false; } else if (action.ToString().Equals("del")) { //int ID = Int16.Parse(Request.QueryString["ID"].ToString()); //if (Leyp.SQLServerDAL.Factory.getStoreHouseDetailDAL().deleteNode(ID)) // { Jscript.AjaxAlert(this, " 等待操作"); Response.End(); // } // else // { // Jscript.AjaxAlert(this, " 用户已经使用!不能删除!"); //} } } dataBand(); DropDownListBand(); }
protected void Button1_Click(object sender, EventArgs e) { if (this.TextBox1.Text != null) { StoreHouseDetail s = new StoreHouseDetail(); s.SubareaName = this.TextBox1.Text; s.HouseID = Convert.ToInt32(this.DropDownList1.SelectedValue); s.Description = this.TextBox2.Text; //s.State = this.DropDownList2.Text; if (this.DropDownList2.Text == "正常") { s.State = "Y"; } else { s.State = "N"; } int rows = StoreHouseDetailManager.StoreHouseDetailInsert(s); if (rows > 0) { Response.Write("<script>alert('添加成功!');</script>"); this.DropDownList1.SelectedIndex = 1; this.TextBox1.Text = ""; this.TextBox2.Text = ""; this.DropDownList2.Text = "正常"; } else { Response.Write("<script>alert('添加失败!');</script>"); } } else { Response.Write("<script>alert('库区名称不能为空!');</script>"); } }
public static int StoreHouseDetailUpdate(StoreHouseDetail s) { return(StoreHouseDetailService.StoreHouseDetailUpdate(s)); }
public static int StoreHouseDetailInsert(StoreHouseDetail s) { return(StoreHouseDetailService.StoreHouseDetailInsert(s)); }