/// <summary> /// 删除所有的物品种类 /// </summary> /// <returns>通过布尔值判断操作是否成功。</returns> public bool deleteAllGoodsTypes() { string sqltext = "delete from goodstype"; int i = DBTools.exenonquerySQL(sqltext, new List <SqlParameter> ()); if (i > 0) { return(true); } else { return(false); } }
/// <summary> /// 获取指定编号的物品的 /// </summary> /// <param name="GoodsNum">物品编号</param> /// <returns></returns> public int GoodsCountByNum(string GoodsNum) { string sqltext = "select sum(amount) from Amount where goodsNum='" + GoodsNum + "'"; object obj = DBTools.exescalarSQL(sqltext, new List <SqlParameter>()); if (obj == null || obj.ToString() == "") { return(0); } else { return(int.Parse(obj.ToString())); } }
/// <summary> /// 删除所有房间. /// </summary> /// <returns>通过布尔类型判断操作是否成功.</returns> public bool deleteAllRooms() { string sqltext = string.Format("delete from room"); int i = DBTools.exenonquerySQL(sqltext, new List <SqlParameter>()); if (i > 0) { return(true); } else { return(false); } }
/// <summary> /// 删除所有库存。 /// </summary> public bool deleteAmounts() { string sqltext = "delete from amount"; int i = DBTools.exenonquerySQL(sqltext, new List <SqlParameter>()); if (i > 0) { return(true); } else { return(false); } }
/// <summary> /// 查找是否有相同名字的数据包 /// </summary> /// <param name="dataCopyName"></param> /// <returns>true为存在,false为不存在</returns> public bool HaveSameDataCopyName(string dataCopyName) { string sqltext = "select * from datacopy where dataName=@dataName"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@dataName", dataCopyName); para.Add(sqlpara1); SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para); while (sdr.Read()) { sdr.Close(); DBTools.DBClose(); return(true); } return(false); }
/// <summary> /// 判断是否有相同名称的供货商. /// </summary> /// <param name="nname">供货商名称</param> /// <returns>有,则返回true;没有,则返回false</returns> public bool hasProviderOfName(string nname) { Model.Provider pro = new Model.Provider(); string sqltext = "select * from provider where providerName=@providerName"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@providerName", nname); para.Add(sqlpara1); SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para); while (sdr.Read()) { sdr.Close(); DBTools.DBClose(); return(true); } return(false); }
/// <summary> /// 通过编号,删除某个库位. /// </summary> public bool deletePositionByNum(string posinum) { string sqltext = "delete from position where positionNum=@positionNum"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@positionNum", posinum); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 删除全部收货商. /// </summary> /// <param name="nname">收货商名称</param> /// <returns>通过布尔类型判断操作是否成功.</returns> public bool deleteAllReceivers(string nname) { string sqltext = "delete from receiver where 1=1"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@receiverName", nname); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 修改所有以参数depar的ID为上级部门的部门的上级部门为"无" /// </summary> /// <param name="depar">Department对象</param> /// <returns>修改成功或失败返回True或False</returns> public int updateParentDepartName(Model.Department depart) { string sqltext = "update department set parentdepartName='无' where parentdepartName=@departId"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@departId", depart.DepartId); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i > 0) { return(i); } else { return(0); } }
/// <summary> /// 通过名称,删除某个供货商. /// </summary> /// <param name="nname">供货商名称</param> /// <returns>通过布尔类型判断操作是否成功.</returns> public bool deleteProviderByName(string nname) { string sqltext = "delete from provider where providerName=@providerName"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@providerName", nname); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 通过库存ID,删除某条信息。 /// </summary> /// <param name="outid">出库id</param> /// <returns>通过布尔类型判断操作是否成功.</returns> public bool deleteOutById(string outid) { string sqltext = "delete from outout where outID=@outID"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@outID", outid); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 根据部门ID,删除某个部门。 /// </summary> /// /// <param name="did">部门ID。</param> /// <returns>通过布尔值判断操作是否成功。</returns> public bool deleteDepartById(string did) { string sqltext = "delete from department where departId=@departId"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@departId", did); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 删除某个房间编号的房间. /// </summary> /// <param name="nnum">房间编号</param> /// <returns>通过布尔类型判断操作是否成功.</returns> public bool deleteRoomByNum(string nnum) { string sqltext = "delete from room where roomNum=@roomNum"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@roomNum", nnum); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 通过ID,删除某个库位类型. /// </summary> public bool deletePositionTypeByid(string posityid) { string sqltext = "delete from positiontype where positionTypeId=@positionTypeId"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@positionTypeId", posityid); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 根据入库ID,删除某条信息。 /// </summary> /// <param name="iid">入库ID</param> public bool deleteInById(string iid) { string sqltext = "delete from inin where inID=@inID"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@inID", iid); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 根据公告ID,删除某条公告。 /// </summary> /// <param name="iid">公告ID</param> public bool deleteNoticeById(string iid) { string sqltext = "delete from notice where noticeId=@noticeId"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@noticeId", iid); para.Add(sqlpara1); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 是否已经有相同名称的部门。 /// </summary> /// <param name="nname">部门名称</param> /// <returns>有,则返回true;没有,则返回false。</returns> public bool hasDepartOfName(string nname) { Model.Department depar = new Model.Department(); string sqltext = "select * from department where departName=@departName"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@departName", nname); para.Add(sqlpara1); SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para); while (sdr.Read()) { sdr.Close(); DBTools.DBClose(); return(true); } return(false); }
/// <summary> /// 是否已有相同编号的员工. /// </summary> /// <returns>如果有,则返回True;没有,则返回False.</returns> public bool hasStaffOfNum(string staffnum) { Model.staff staff = new Model.staff(); string sqltext = "select * from staff where staffNum=@staffNum"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@staffNum", staffnum); para.Add(sqlpara1); SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para); while (sdr.Read()) { sdr.Close(); DBTools.DBClose(); return(true); } return(false); }
/// <summary> /// 获取所有库存对象。 /// </summary> public List <Model.Amount> getAllAmounts() { List <Model.Amount> amount = new List <Model.Amount>(); string sqltext = "select * from amount"; SqlDataReader sdr = DBTools.exereaderSQL(sqltext, new List <SqlParameter>()); while (sdr.Read()) { Model.Amount a = new Model.Amount(); a.PositionNum = sdr["positionNum"].ToString(); a.GoodsNum = sdr["goodsNum"].ToString(); a.Amounts = double.Parse(sdr["amount"].ToString()); a.AmountPer = sdr["per"].ToString(); amount.Add(a); } sdr.Close(); DBTools.DBClose(); return(amount); }
/// <summary> /// 获取所有部门对象。 /// </summary> public List <Model.Department> getAllDeparts() { List <Model.Department> depar = new List <Model.Department>(); string sqltext = "select * from department"; SqlDataReader sdr = DBTools.exereaderSQL(sqltext, new List <SqlParameter>()); while (sdr.Read()) { Model.Department d = new Model.Department(); d.DepartId = sdr["departId"].ToString(); d.DepartName = sdr["departName"].ToString(); d.SysUser = new DAL.SysUserDAO().getUserByNum(sdr["staffNum"].ToString()); //d.ParentdepartName = new DAL.DepartmentDAO().getDepartById(sdr["parentdepartName"].ToString()); depar.Add(d); } sdr.Close(); DBTools.DBClose(); return(depar); }
/// <summary> /// 是否已有相同房间编号的房间对象. /// </summary> /// <param name="nnum">房间编号</param> /// <returns>有,则返回True;没有,则返回False.</returns> public bool hasRoomOfNum(string nnum) { Model.Room room = new Model.Room(); string sqltext = "select * from room where roomNum=@roomNum"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@roomNum", nnum); para.Add(sqlpara1); SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para); while (sdr.Read()) { sdr.Close(); DBTools.DBClose(); return(true); } return(false); }
/// <summary> /// 更新某个库位.库位编号不可更改. /// </summary> /// <param name="posi">库位对象.</param> public bool update(Model.Position posi) { string sqltext = "update Position set rest=@rest where positionNum=@positionNum"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@positionNum", posi.PositionNum); SqlParameter sqlpara11 = new SqlParameter("@Rest", posi.Rest); para.Add(sqlpara1); para.Add(sqlpara11); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 获取所有系统用户. /// </summary> /// <returns>用户对象的泛型列表.</returns> public List <Model.SysUser> getAllUsers() { List <Model.SysUser> sysuser = new List <Model.SysUser>(); string sqltext = "select * from sysuser"; SqlDataReader sdr = DBTools.exereaderSQL(sqltext, new List <SqlParameter> ()); while (sdr.Read()) { Model.SysUser s = new Model.SysUser(); s.UserId = sdr["userId"].ToString(); s.StaffNum = sdr["staffNum"].ToString(); s.Staff = new DAL.StaffDAO().getStaffByNum(s.StaffNum); s.Password = sdr["password"].ToString(); s.Job = sdr["job"].ToString(); sysuser.Add(s); } sdr.Close(); DBTools.DBClose(); return(sysuser); }
/// <summary> /// 添加一个库位.库位编号是主键. /// </summary> /// <param name="posi">库位对象.</param> /// <returns>通过布尔类型判断操作是否成功.</returns> public bool addPosition(Model.Position posi) { string sqltext = "insert position(num,positionNum,chestNum,roomNum,positionTypeId,goodsTypes,M,Height,Rest,remark,createTime,updateTime) values(@num,@positionNum,@chestNum,@roomNum,@positionTypeId,@goodsTypes,@M,@Height,@Rest,@remark,@createTime,@updateTime)"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara = new SqlParameter("@num", posi.Num); SqlParameter sqlpara1 = new SqlParameter("@positionNum", posi.PositionNum); SqlParameter sqlpara2 = new SqlParameter("@chestNum", posi.ChestNum); SqlParameter sqlpara3 = new SqlParameter("@roomNum", posi.RoomNum); SqlParameter sqlpara4 = new SqlParameter("@positionTypeId", posi.PositiontypeId); SqlParameter sqlpara5 = new SqlParameter("@goodsTypes", posi.GoodsTypes); SqlParameter sqlpara51 = new SqlParameter("@M", posi.M); SqlParameter sqlpara52 = new SqlParameter("@Height", posi.Height); SqlParameter sqlpara53 = new SqlParameter("@Rest", posi.Rest); SqlParameter sqlpara6 = new SqlParameter("@remark", posi.Remark); SqlParameter sqlpara7 = new SqlParameter("@createTime", posi.CreateTime.ToString()); SqlParameter sqlpara8 = new SqlParameter("@updateTime", posi.UpdateTime.ToString()); para.Add(sqlpara); para.Add(sqlpara1); para.Add(sqlpara2); para.Add(sqlpara3); para.Add(sqlpara4); para.Add(sqlpara5); para.Add(sqlpara51); para.Add(sqlpara52); para.Add(sqlpara53); para.Add(sqlpara6); para.Add(sqlpara7); para.Add(sqlpara8); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }
/// <summary> /// 获取所有的日志对象 /// </summary> /// <returns>日志对象泛型集合</returns> public List <Model.SysLog> getAllLogs() { List <Model.SysLog> sys = new List <Model.SysLog>(); string sqltext = "select * from syslog"; SqlDataReader sdr = DBTools.exereaderSQL(sqltext, new List <SqlParameter> ()); while (sdr.Read()) { Model.SysLog s = new Model.SysLog(); s.LogId = sdr["logId"].ToString(); s.UserId = sdr["userId"].ToString(); s.SysUser = new DAL.SysUserDAO().getUserById(s.UserId); s.IpAddress = sdr["ipAddress"].ToString(); s.ActionTime = DateTime.Parse(sdr["actionTime"].ToString()); s.Column = sdr["column"].ToString(); s.ActionType = sdr["actionType"].ToString(); sys.Add(s); } sdr.Close(); DBTools.DBClose(); return(sys); }
/// <summary> /// 获取所有的公告对象。 /// </summary> public List <Model.Notice> getAllNotices() { List <Model.Notice> notice = new List <Model.Notice>(); string sqltext = "select * from notice"; SqlDataReader sdr = DBTools.exereaderSQL(sqltext, new List <SqlParameter> ()); while (sdr.Read()) { Model.Notice n = new Model.Notice(); n.NoticeId = sdr["noticeId"].ToString(); n.Subject = sdr["subject"].ToString(); n.Title = sdr["title"].ToString(); n.Body = sdr["body"].ToString(); n.SysUser = new DAL.SysUserDAO().getUserById(sdr["userId"].ToString()); n.CreateTime = DateTime.Parse(sdr["createTime"].ToString()); n.UpdateTime = DateTime.Parse(sdr["publishTime"].ToString()); notice.Add(n); } sdr.Close(); DBTools.DBClose(); return(notice); }
/// <summary> /// 获取所有的物品类型。 /// </summary> /// <returns>GoodsType的list集合</returns> public List <Model.GoodsType> getAllGoodsTypes() { List <Model.GoodsType> goodtype = new List <Model.GoodsType>(); string sqltext = "select * from goodstype"; SqlDataReader sdr = DBTools.exereaderSQL(sqltext, new List <SqlParameter> ()); while (sdr.Read()) { Model.GoodsType dt = new Model.GoodsType(); dt.GoodsTypeNum = sdr["goodsTypeNum"].ToString(); dt.GoodsTypeName = sdr["goodsTypeName"].ToString(); dt.ParentTypeNum = sdr["parentTypeNum"].ToString(); dt.GoodsTypeCondition = sdr["goodsTypeCondition"].ToString(); dt.Remark = sdr["remark"].ToString(); dt.CreateTime = DateTime.Parse(sdr["createTime"].ToString()); dt.UpdateTime = DateTime.Parse(sdr["updateTime"].ToString()); goodtype.Add(dt); } sdr.Close(); DBTools.DBClose(); return(goodtype); }
/// <summary> /// 根据部门ID,获取某个部门对象。 /// </summary> /// <param name="iid">部门ID</param> public Model.Department getDepartById(string iid) { Model.Department depar = null; string sqltext = "select * from department where departId=@departId"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara1 = new SqlParameter("@departId", iid); para.Add(sqlpara1); SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para); while (sdr.Read()) { depar = new Model.Department(); depar.DepartId = sdr["departId"].ToString(); depar.DepartName = sdr["departName"].ToString(); depar.StaffNum = sdr["staffNum"].ToString(); depar.ParentdepartName = sdr["parentdepartName"].ToString(); } sdr.Close(); DBTools.DBClose(); return(depar); }
/// <summary> /// 获取所有的库位类型. /// </summary> /// <returns>库位类型对象泛型集合.</returns> public List <Model.PositionType> getAllPositionsType() { List <Model.PositionType> posity = new List <Model.PositionType>(); string sqltext = "select * from positiontype"; SqlDataReader sdr = DBTools.exereaderSQL(sqltext, new List <SqlParameter>()); while (sdr.Read()) { Model.PositionType p = new Model.PositionType(); p.PositionTypeId = sdr["positionTypeId"].ToString(); p.PositionTypeName = sdr["positionTypeName"].ToString(); p.Length = sdr["length"].ToString(); p.Width = sdr["width"].ToString(); p.Height = sdr["height"].ToString(); p.Remark = sdr["remark"].ToString(); posity.Add(p); } sdr.Close(); DBTools.DBClose(); return(posity); }
/// <summary> /// 添加一种物品。 /// </summary> /// <param name="goods">物品对象</param> /// <returns>通过布尔值判断操作是否成功。</returns> public bool addGoods(Model.Goods goods) { string sqltext = "insert goods(num,goodsNum,goodsTypeNum,goodsName,goodsStyle,goodsColor,goodsSmell,goodsShape,per,condition,max) values(@num,@goodsNum,@goodsTypeNum,@goodsName,@goodsStyle,@goodsColor,@goodsSmell,@goodsShape,@per,@condition,@max)"; List <SqlParameter> para = new List <SqlParameter>(); SqlParameter sqlpara = new SqlParameter("@num", goods.Num); SqlParameter sqlpara1 = new SqlParameter("@goodsNum", goods.GoodsNum); SqlParameter sqlpara2 = new SqlParameter("@goodsTypeNum", goods.GoodsTypeNum); SqlParameter sqlpara3 = new SqlParameter("@goodsName", goods.GoodsName); SqlParameter sqlpara4 = new SqlParameter("@goodsStyle", goods.GoodsStyle); SqlParameter sqlpara5 = new SqlParameter("@goodsColor", goods.GoodsColor); SqlParameter sqlpara6 = new SqlParameter("@goodsSmell", goods.GoodsSmell); SqlParameter sqlpara7 = new SqlParameter("@goodsShape", goods.GoodsShape); SqlParameter sqlpara8 = new SqlParameter("@per", goods.GoodsPer); SqlParameter sqlpara9 = new SqlParameter("@condition", goods.GoodsCondition); SqlParameter sqlpara10 = new SqlParameter("@max", goods.Max); para.Add(sqlpara); para.Add(sqlpara1); para.Add(sqlpara2); para.Add(sqlpara3); para.Add(sqlpara4); para.Add(sqlpara5); para.Add(sqlpara6); para.Add(sqlpara7); para.Add(sqlpara8); para.Add(sqlpara9); para.Add(sqlpara10); int i = DBTools.exenonquerySQL(sqltext, para); if (i == 1) { return(true); } else { return(false); } }