/// <summary> /// 得到一个对象实体 /// </summary> public WMS_Database.WH_LaneModel GetModel(string WH_Lane_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 "); strSql.Append(" WH_Lane_ID,WH_WareHouse_ID,WH_Lane_Name,WH_Lane_Remark,WH_Lane_Reserve1,WH_Lane_Reserve2,WH_Lane_Reserve3,WH_Lane_Reserve4,WH_Lane_Reserve5 "); strSql.Append(" from WH_Lane "); strSql.Append(" where WH_Lane_ID='" + WH_Lane_ID + "' "); WMS_Database.WH_LaneModel model = new WMS_Database.WH_LaneModel(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
/// <summary> /// 得到一个对象实体 /// </summary> public WMS_Database.WH_LaneModel DataRowToModel(DataRow row) { WMS_Database.WH_LaneModel model = new WMS_Database.WH_LaneModel(); if (row != null) { if (row["WH_Lane_ID"] != null) { model.WH_Lane_ID = row["WH_Lane_ID"].ToString(); } if (row["WH_WareHouse_ID"] != null) { model.WH_WareHouse_ID = row["WH_WareHouse_ID"].ToString(); } if (row["WH_Lane_Name"] != null) { model.WH_Lane_Name = row["WH_Lane_Name"].ToString(); } if (row["WH_Lane_Remark"] != null) { model.WH_Lane_Remark = row["WH_Lane_Remark"].ToString(); } if (row["WH_Lane_Reserve1"] != null) { model.WH_Lane_Reserve1 = row["WH_Lane_Reserve1"].ToString(); } if (row["WH_Lane_Reserve2"] != null) { model.WH_Lane_Reserve2 = row["WH_Lane_Reserve2"].ToString(); } if (row["WH_Lane_Reserve3"] != null) { model.WH_Lane_Reserve3 = row["WH_Lane_Reserve3"].ToString(); } if (row["WH_Lane_Reserve4"] != null) { model.WH_Lane_Reserve4 = row["WH_Lane_Reserve4"].ToString(); } if (row["WH_Lane_Reserve5"] != null) { model.WH_Lane_Reserve5 = row["WH_Lane_Reserve5"].ToString(); } } return model; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(WMS_Database.WH_LaneModel model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(WMS_Database.WH_LaneModel model) { return(dal.Add(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(WMS_Database.WH_LaneModel model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.WH_Lane_ID != null) { strSql1.Append("WH_Lane_ID,"); strSql2.Append("'" + model.WH_Lane_ID + "',"); } if (model.WH_WareHouse_ID != null) { strSql1.Append("WH_WareHouse_ID,"); strSql2.Append("'" + model.WH_WareHouse_ID + "',"); } if (model.WH_Lane_Name != null) { strSql1.Append("WH_Lane_Name,"); strSql2.Append("'" + model.WH_Lane_Name + "',"); } if (model.WH_Lane_Remark != null) { strSql1.Append("WH_Lane_Remark,"); strSql2.Append("'" + model.WH_Lane_Remark + "',"); } if (model.WH_Lane_Reserve1 != null) { strSql1.Append("WH_Lane_Reserve1,"); strSql2.Append("'" + model.WH_Lane_Reserve1 + "',"); } if (model.WH_Lane_Reserve2 != null) { strSql1.Append("WH_Lane_Reserve2,"); strSql2.Append("'" + model.WH_Lane_Reserve2 + "',"); } if (model.WH_Lane_Reserve3 != null) { strSql1.Append("WH_Lane_Reserve3,"); strSql2.Append("'" + model.WH_Lane_Reserve3 + "',"); } if (model.WH_Lane_Reserve4 != null) { strSql1.Append("WH_Lane_Reserve4,"); strSql2.Append("'" + model.WH_Lane_Reserve4 + "',"); } if (model.WH_Lane_Reserve5 != null) { strSql1.Append("WH_Lane_Reserve5,"); strSql2.Append("'" + model.WH_Lane_Reserve5 + "',"); } strSql.Append("insert into WH_Lane("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); int rows = DbHelperSQL.ExecuteSql(strSql.ToString()); if (rows > 0) { return true; } else { return false; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(WMS_Database.WH_LaneModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update WH_Lane set "); if (model.WH_WareHouse_ID != null) { strSql.Append("WH_WareHouse_ID='" + model.WH_WareHouse_ID + "',"); } else { strSql.Append("WH_WareHouse_ID= null ,"); } if (model.WH_Lane_Name != null) { strSql.Append("WH_Lane_Name='" + model.WH_Lane_Name + "',"); } else { strSql.Append("WH_Lane_Name= null ,"); } if (model.WH_Lane_Remark != null) { strSql.Append("WH_Lane_Remark='" + model.WH_Lane_Remark + "',"); } else { strSql.Append("WH_Lane_Remark= null ,"); } if (model.WH_Lane_Reserve1 != null) { strSql.Append("WH_Lane_Reserve1='" + model.WH_Lane_Reserve1 + "',"); } else { strSql.Append("WH_Lane_Reserve1= null ,"); } if (model.WH_Lane_Reserve2 != null) { strSql.Append("WH_Lane_Reserve2='" + model.WH_Lane_Reserve2 + "',"); } else { strSql.Append("WH_Lane_Reserve2= null ,"); } if (model.WH_Lane_Reserve3 != null) { strSql.Append("WH_Lane_Reserve3='" + model.WH_Lane_Reserve3 + "',"); } else { strSql.Append("WH_Lane_Reserve3= null ,"); } if (model.WH_Lane_Reserve4 != null) { strSql.Append("WH_Lane_Reserve4='" + model.WH_Lane_Reserve4 + "',"); } else { strSql.Append("WH_Lane_Reserve4= null ,"); } if (model.WH_Lane_Reserve5 != null) { strSql.Append("WH_Lane_Reserve5='" + model.WH_Lane_Reserve5 + "',"); } else { strSql.Append("WH_Lane_Reserve5= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where WH_Lane_ID='" + model.WH_Lane_ID + "' "); int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString()); if (rowsAffected > 0) { return true; } else { return false; } }