/// <summary> /// 添加一个客户 /// 返回 true 表示成功,否侧数据已存在 /// </summary> /// <param name="_customer"></param> /// <returns></returns> public bool AddData(Renting_Management_System.Models.CustomerMod _customer) { customer = new Renting_Management_System.Models.CustomerMod(); customer = SelectByID(_customer.CustomerID); if (customer == null) { StringBuilder insertStr = new StringBuilder(); insertStr.Append("Insert Into [Customer]"); insertStr.Append("(客户编号,客户类代码,客户名称,性别,出生日期,证件类代码,证件号码,客户地址,联系方式,客户状态,客户描述,客户拒绝)"); insertStr.Append("Values ('"); insertStr.Append(_customer.CustomerID + "','"); insertStr.Append(_customer.CustomerTypeCode + "','"); insertStr.Append(_customer.CustomerName + "','"); insertStr.Append(_customer.Sex + "','"); insertStr.Append(_customer.BirthDate.ToShortDateString() + "','"); insertStr.Append(_customer.CertificateTypeCode + "','"); insertStr.Append(_customer.CertificateNumber + "','"); insertStr.Append(_customer.CustomerAddress + "','"); insertStr.Append(_customer.CustomerContact + "','"); insertStr.Append(_customer.CustomerState + "','"); insertStr.Append(_customer.CustomerDescription + "','"); insertStr.Append(_customer.CustomerDeny.ToString()); insertStr.Append("')"); da = new DBConnection(); da.InsertQuery(insertStr.ToString()); return true; } else { return false; } }
/// <summary> /// 添加一个用户 /// 返回 true 表示成功 /// 返回 false 表示该数据已存在 /// </summary> /// <param name="_user"></param> /// <returns></returns> public bool AddData(Renting_Management_System.Models.UserMod _user) { user = new Renting_Management_System.Models.UserMod(); user = SelectByID(_user.UserID); if (user == null) { StringBuilder insertStr = new StringBuilder(); insertStr.Append("Insert Into [User] "); insertStr.Append("(用户编号,用户名称,性别,出生日期,用户密码,用户类代码,证件类代码,证件号码,联系方式,用户地址,用户描述,用户拒绝)"); insertStr.Append(" Values ('"); insertStr.Append(_user.UserID + "','"); insertStr.Append(_user.UserName + "','"); insertStr.Append(_user.Sex + "','"); insertStr.Append(_user.BirthDate.Date.ToShortDateString()+ "','"); insertStr.Append(_user.UserPassword + "','"); insertStr.Append(_user.UserTypeCode + "','"); insertStr.Append(_user.CertificateTypeCode + "','"); insertStr.Append(_user.CertificateNumber + "','"); insertStr.Append(_user.UserContact + "','"); insertStr.Append(_user.UserAddress + "','"); insertStr.Append(_user.UserDescription + "','"); insertStr.Append(_user.UserDeny.ToString()); insertStr.Append("')"); da = new DBConnection(); da.InsertQuery(insertStr.ToString()); return true; } else { return false; } }
/// <summary> /// 添加一个租借的记录 /// 返回 true 表示成功,否侧该记录已存在 /// </summary> /// <param name="_rent"></param> /// <returns></returns> public bool AddData(Renting_Management_System.Models.RentMod _rent) { rent = new Renting_Management_System.Models.RentMod(); rent =SelectBy_CustomerID_N_ImageID(_rent.CustomerID, _rent.ImageID); if (rent == null) { StringBuilder insertStr = new StringBuilder(); insertStr.Append("Insert Into [Rent](影像编号,客户编号,用户编号,出租数量,出租日期,归还日期,出租押金,归还状态,描述)"); insertStr.Append("Values ('"); insertStr.Append(_rent.ImageID + "','"); insertStr.Append(_rent.CustomerID + "','"); insertStr.Append(_rent.UserID + "',"); insertStr.Append(_rent.QuantityOfRent + ",'"); insertStr.Append(_rent.RentDate.ToShortDateString() + "','"); insertStr.Append(_rent.ReturnDate.ToShortDateString() + "',"); insertStr.Append(_rent.Deposit + ",'"); insertStr.Append(_rent.ReturnState + "','"); insertStr.Append(_rent.Description + "'"); da = new DBConnection(); da.InsertQuery(insertStr.ToString()); return true; } else { return false; } }
/// <summary> /// 添加一个影像的信息 /// 返回 true 表示成功,否侧该影像已存在 /// </summary> /// <param name="_image"></param> /// <returns></returns> public bool AddData(Renting_Management_System.Models.ImageMod _image) { image = new Renting_Management_System.Models.ImageMod(); image = SelectByID(_image.ImageID); if (image != null) { return false; } else { StringBuilder insertStr = new StringBuilder(); insertStr.Append("Insert Into [Image] (影像编号,影像名称,用户编号,影类代码,地点代码,影像原价,影像租价,库存数量,货架号,出租状态,影像描述) "); insertStr.Append("Values ('"); insertStr.Append(_image.ImageID + "','"); insertStr.Append(_image.ImageName + "','"); insertStr.Append(_image.UserID + "','"); insertStr.Append(_image.ImageTypeCode + "','"); insertStr.Append(_image.LocalCode + "',"); insertStr.Append(_image.ImageCostPrice + ","); insertStr.Append(_image.ImageRentalPrice + ","); insertStr.Append(_image.StorageQuantity + ",'"); insertStr.Append(_image.ShelvesNumber + "','"); insertStr.Append(_image.RentState + "','"); insertStr.Append(_image.ImageDescription); insertStr.Append("')"); da = new DBConnection(); da.InsertQuery(insertStr.ToString()); return true; } }
/// <summary> /// 登录系统,返回 true 表示正确 /// </summary> /// <param name="_user"></param> /// <returns></returns> public bool Login(Renting_Management_System.Models.UserMod _user) { Renting_Management_System.Models.UserMod user = new Renting_Management_System.Models.UserMod(); Renting_Management_System.DAL.UserDAL userDAL = new Renting_Management_System.DAL.UserDAL(); user = userDAL.SelectByID(_user.UserID); if (user != null) { if (user.UserPassword == _user.UserPassword && user.UserTypeCode == _user.UserTypeCode) { return true; } else { return false; } } else { return false; } }
/// <summary> /// 删除一个地点 /// 返回 true 表示成功 /// 返回 false 表示数据不存在 /// </summary> /// <param name="_local"></param> /// <returns></returns> public bool DeleteData(Renting_Management_System.Models.LocalMod _local) { local = new Renting_Management_System.Models.LocalMod(); local = SelectData(_local.LocalCode); if (local != null) { da = new DBConnection(); StringBuilder deleteStr = new StringBuilder(); deleteStr.Append("Delete From [Local] "); deleteStr.Append("Where 地点代码 = '"); deleteStr.Append(_local.LocalCode); deleteStr.Append("'"); da.DeleteQuery(deleteStr.ToString()); return true; } else return false; }
/// <summary> /// 删除一个影像 /// 返回 true 表示成功,否侧数据不存在 /// </summary> /// <param name="_image"></param> /// <returns></returns> public bool DeleteData(Renting_Management_System.Models.ImageMod _image) { image = new Renting_Management_System.Models.ImageMod(); image = SelectByID(_image.ImageID); if (image == null) { return false; } else { StringBuilder deleteStr = new StringBuilder(); deleteStr.Append("Delete From [Image] "); deleteStr.Append("Where 影像编号 = '"); deleteStr.Append(_image.ImageID); deleteStr.Append("'"); da = new DBConnection(); da.DeleteQuery(deleteStr.ToString()); return true; } }
/// <summary> /// 删除一个客户 /// 返回 true 表示成功,否侧数据不存在 /// </summary> /// <param name="_customer"></param> /// <returns></returns> public bool DeleteData(Renting_Management_System.Models.CustomerMod _customer) { customer = new Renting_Management_System.Models.CustomerMod(); customer = SelectByID(_customer.CustomerID); if (customer != null) { StringBuilder deleteStr = new StringBuilder(); deleteStr.Append("Delete From [Customer]"); deleteStr.Append("Where 客户编号 = '"); deleteStr.Append(_customer.CustomerID); deleteStr.Append("'"); da = new DBConnection(); da.DeleteQuery(deleteStr.ToString()); return true; } else { return false; } }
/// <summary> /// 删除一个影类 /// 返回 true 表示成功; /// 返回 false 表示该类不存在 /// </summary> /// <param name="uType"></param> /// <returns></returns> public bool DeleteData(Renting_Management_System.Models.ImageTypeMod _imageType) { type = new Renting_Management_System.Models.ImageTypeMod(); type = SelectData(_imageType.ImageTypeCode); if (type != null) { da = new DBConnection(); StringBuilder deleteStr = new StringBuilder(); deleteStr.Append("Delete From [ImageType] "); deleteStr.Append("Where 影类代码 = '"); deleteStr.Append(_imageType.ImageTypeCode); deleteStr.Append("'"); da.DeleteQuery(deleteStr.ToString()); return true; } else return false; }
/// <summary> /// 添加一个影类 /// 返回 true 表示成功 /// 返回 false 表示数据已存在 /// </summary> /// <param name="uType"></param> /// <returns></returns> public bool AddData(Renting_Management_System.Models.ImageTypeMod _imageType) { type = new Renting_Management_System.Models.ImageTypeMod(); type = SelectData(_imageType.ImageTypeCode); if (type == null) { da = new DBConnection(); StringBuilder insertStr = new StringBuilder(); insertStr.Append("Insert Into [ImageType] (影类代码,影类名称) "); insertStr.Append("Values ('"); insertStr.Append(_imageType.ImageTypeCode + "','"); insertStr.Append(_imageType.ImageTypeName); insertStr.Append("')"); da.InsertQuery(insertStr.ToString()); return true; } else return false; }
/// <summary> /// 添加一个地点 /// 返回 true 表示成功 /// 返回 false 表示数据已存在 /// </summary> /// <param name="_local"></param> /// <returns></returns> public bool AddData(Renting_Management_System.Models.LocalMod _local) { local = new Renting_Management_System.Models.LocalMod(); local = SelectData(_local.LocalCode); if (local == null) { da = new DBConnection(); StringBuilder insertStr = new StringBuilder(); insertStr.Append("Insert Into [Local] (地点代码,地点名称) "); insertStr.Append("Values ('"); insertStr.Append(_local.LocalCode + "','"); insertStr.Append(_local.LocalName); insertStr.Append("')"); da.InsertQuery(insertStr.ToString()); return true; } else return false; }
/// <summary> /// 删除一个租借记录 /// 返回 true 表示成功,否侧该记录不存在 /// </summary> /// <param name="_rent"></param> /// <returns></returns> public bool DeletData(Renting_Management_System.Models.RentMod _rent) { rent = new Renting_Management_System.Models.RentMod(); rent =SelectBy_CustomerID_N_ImageID(_rent.CustomerID, _rent.ImageID); if (rent != null) { StringBuilder deleteStr = new StringBuilder(); deleteStr.Append("Delete From [Rent]"); deleteStr.Append("Where 客户编号 = '"); deleteStr.Append(_rent.CustomerID); deleteStr.Append("' And 影像编号 = '"); deleteStr.Append(_rent.ImageID); deleteStr.Append("'"); da = new DBConnection(); da.DeleteQuery(deleteStr.ToString()); return true; } else { return false; } }
/// <summary> /// 修改一个用户 /// 返回 true 表示成功,否则表示该用户信息不存在 /// </summary> /// <param name="_user"></param> /// <returns></returns> public bool ModifyData(Renting_Management_System.Models.UserMod _user) { user = new Renting_Management_System.Models.UserMod(); user = SelectByID(_user.UserID); if (user == null) { return false; } else { StringBuilder updateStr = new StringBuilder(); updateStr.Append("Update [User] "); updateStr.Append("Set "); updateStr.Append("用户名称 = '"); updateStr.Append(_user.UserName + "'"); updateStr.Append(",性别 = '"); updateStr.Append(_user.Sex + "'"); updateStr.Append(",出生日期 = '"); updateStr.Append(_user.BirthDate.ToShortDateString()); updateStr.Append("',用户密码 = '"); updateStr.Append(_user.UserPassword + "'"); updateStr.Append(",用户类代码 = '"); updateStr.Append(_user.UserTypeCode + "'"); updateStr.Append(",证件类代码 = '"); updateStr.Append(_user.CertificateTypeCode + "'"); updateStr.Append(",证件号码 = '"); updateStr.Append(_user.CertificateNumber + "'"); updateStr.Append(",联系方式 = '"); updateStr.Append(_user.UserContact + "'"); updateStr.Append(",用户地址 = '"); updateStr.Append(_user.UserAddress + "'"); updateStr.Append(",用户描述 = '"); updateStr.Append(_user.UserDescription + "'"); updateStr.Append(",用户拒绝 = '"); updateStr.Append(_user.UserDeny.ToString()); updateStr.Append("'"); updateStr.Append("Where 用户编号 = '"); updateStr.Append(_user.UserID + "'"); da = new DBConnection(); da.UpdateQuery(updateStr.ToString()); return true; } }
/// <summary> /// 修改一个租借的记录 /// 返回 true 表示成功,否侧该记录不存在 /// </summary> /// <param name="_rent"></param> /// <returns></returns> public bool ModifyData(Renting_Management_System.Models.RentMod _rent) { rent = new Renting_Management_System.Models.RentMod(); rent =SelectBy_CustomerID_N_ImageID(_rent.CustomerID, _rent.ImageID); if (rent != null) { StringBuilder updateStr = new StringBuilder(); updateStr.Append("Update [Rent]"); updateStr.Append("Set "); updateStr.Append("用户编号 = '"); updateStr.Append(_rent.UserID); updateStr.Append("',出租数量 = "); updateStr.Append(_rent.QuantityOfRent); updateStr.Append(",出租日期 = '"); updateStr.Append(_rent.RentDate.ToShortDateString()); updateStr.Append("',归还日期 = '"); updateStr.Append(_rent.ReturnDate.ToShortDateString()); updateStr.Append("',出租押金 = "); updateStr.Append(_rent.Deposit); updateStr.Append(",归还状态 = '"); updateStr.Append(_rent.ReturnState); updateStr.Append("',描述 = '"); updateStr.Append(_rent.Description); updateStr.Append("'"); updateStr.Append("Where 客户编号 = '"); updateStr.Append(_rent.CustomerID); updateStr.Append("' And 影像编号 = '"); updateStr.Append(_rent.ImageID); updateStr.Append("'"); da = new DBConnection(); da.UpdateQuery(updateStr.ToString()); return true; } else { return false; } }
/// <summary> /// 修改一个客户的记录 /// 返回 true 表示成功,否侧表示数据不存在 /// </summary> /// <param name="_customer"></param> /// <returns></returns> public bool ModifyData(Renting_Management_System.Models.CustomerMod _customer) { customer = new Renting_Management_System.Models.CustomerMod(); customer = SelectByID(_customer.CustomerID); if (customer != null) { StringBuilder updateStr = new StringBuilder(); updateStr.Append("Update [Customer] "); updateStr.Append("Set "); updateStr.Append("客户类代码 = '"); updateStr.Append(_customer.CustomerTypeCode + "'"); updateStr.Append(",客户名称 = '"); updateStr.Append(_customer.CustomerName + "'"); updateStr.Append(",性别 = '"); updateStr.Append(_customer.Sex + "'"); updateStr.Append(",出生日期 = '"); updateStr.Append(_customer.BirthDate.ToShortDateString()); updateStr.Append("',证件类代码 = '"); updateStr.Append(_customer.CertificateTypeCode + "'"); updateStr.Append(",证件号码 = '"); updateStr.Append(_customer.CertificateNumber + "'"); updateStr.Append(",客户地址 = '"); updateStr.Append(_customer.CustomerAddress + "'"); updateStr.Append(",联系方式 = '"); updateStr.Append(_customer.CustomerContact + "'"); updateStr.Append(",客户状态 = '"); updateStr.Append(_customer.CustomerState + "'"); updateStr.Append(",客户描述 = '"); updateStr.Append(_customer.CustomerDescription + "'"); updateStr.Append(",客户拒绝 = '"); updateStr.Append(_customer.CustomerDeny.ToString() + "'"); updateStr.Append("Where 客户编号 = '"); updateStr.Append(_customer.CustomerID + "'"); da = new DBConnection(); da.UpdateQuery(updateStr.ToString()); return true; } else { return false; } }
/// <summary> /// 修改一个地点名称 /// 返回 true 表示成功 /// 返回 false 表示数据不存在 /// </summary> /// <param name="_local"></param> /// <returns></returns> public bool ModifyData(Renting_Management_System.Models.LocalMod _local) { local = new Renting_Management_System.Models.LocalMod(); local = SelectData(_local.LocalCode); if (local != null) { da = new DBConnection(); StringBuilder modifyStr = new StringBuilder(); modifyStr.Append("Update [Local]"); modifyStr.Append("Set 地点名称 = '"); modifyStr.Append(_local.LocalName); modifyStr.Append("'"); modifyStr.Append("Where 地点代码 = '"); modifyStr.Append(_local.LocalCode); modifyStr.Append("'"); da.UpdateQuery(modifyStr.ToString()); return true; } else return false; }
/// <summary> /// 修改一个影像的记录 /// 返回 true 表示成功,否侧数据不存在 /// </summary> /// <param name="_image"></param> /// <returns></returns> public bool ModifyData(Renting_Management_System.Models.ImageMod _image) { image = new Renting_Management_System.Models.ImageMod(); image = SelectByID(_image.ImageID); if (image == null) { return false; } else { StringBuilder updateStr = new StringBuilder(); updateStr.Append("Update [Image] "); updateStr.Append("Set "); updateStr.Append("影像名称 = '"); updateStr.Append(_image.ImageName); updateStr.Append("',用户编号 = '"); updateStr.Append(_image.UserID); updateStr.Append("',影类代码 = '"); updateStr.Append(_image.ImageTypeCode); updateStr.Append("',地点代码 = '"); updateStr.Append(_image.LocalCode); updateStr.Append("',影像原价 = "); updateStr.Append(_image.ImageCostPrice); updateStr.Append(",影像租价 = "); updateStr.Append(_image.ImageRentalPrice); updateStr.Append(",库存数量 = "); updateStr.Append(_image.StorageQuantity); updateStr.Append(",货架号 = '"); updateStr.Append(_image.ShelvesNumber); updateStr.Append("',出租状态 = '"); updateStr.Append(_image.RentState); updateStr.Append("',影像描述 = '"); updateStr.Append(_image.ImageDescription); updateStr.Append("'"); updateStr.Append("Where 影像编号 = '"); updateStr.Append(_image.ImageID); updateStr.Append("'"); da = new DBConnection(); da.UpdateQuery(updateStr.ToString()); return true; } }
/// <summary> /// 修改一个影类名称 /// 返回 true 表示成功 /// 返回 false 表示该类不存在 /// </summary> /// <param name="uType"></param> /// <returns></returns> public bool ModifyData(Renting_Management_System.Models.ImageTypeMod _imageType) { type = new Renting_Management_System.Models.ImageTypeMod(); type = SelectData(_imageType.ImageTypeCode); if (type != null) { da = new DBConnection(); StringBuilder modifyStr = new StringBuilder(); modifyStr.Append("Update [ImageType] "); modifyStr.Append("Set 影类名称 = '"); modifyStr.Append(_imageType.ImageTypeName + "'"); modifyStr.Append("Where 影类代码 = '"); modifyStr.Append(_imageType.ImageTypeCode + "'"); da.UpdateQuery(modifyStr.ToString()); return true; } else return false; }
/// <summary> /// 用户是否被拒绝? /// </summary> /// <param name="_user"></param> /// <returns></returns> public bool Deny(Renting_Management_System.Models.UserMod _user) { Renting_Management_System.DAL.UserDAL userDAL = new Renting_Management_System.DAL.UserDAL(); _user = userDAL.SelectByID(_user.UserID); return _user.UserDeny; }