版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
-.z.宠物商店系统的设计与实现作者详情一览表外文名中文名代号Aragorn阿拉贡114-.z.目录TOC\o"1-2"\h\u98151绪论 1114741.1工程开发的背景 1116311.2工程开发的意义120762系统分析与设计 2226492.1工程主要功能描述 293242.2数据库设计 2120033系统实现 551823.1系统首页 599503.2增加宠物种类的功能实现 6297203.3查看购物车功能的实现 14218963.4注册功能实现 4232143.5登录功能实现 44290333.6查看宠物类别详情功能实现 4744173.7删除宠物种类功能实现 51168823.8添加宠物功能实现 53196873.9删除订单功能实现 56112293.10发送订单功能实现 58191153.11修改密码功能实现 59188453.12重新登录功能实现 60203193.13在购物车中添加宠物功能实现 61144023.14删除购物车中宠物功能实现 6818767结论72-.z.1绪论1.1工程开发的背景网上购物,这个逐渐流行于21世纪的购物方式已经为越来越多的人所承受。不管是腰缠万贯的大富翁、时尚的白领丽人还是普通的工薪阶层,其局部人可能都有过上网购物的经历。这其中有的也许仅仅想拥有这种体检的感觉,有的可能将此作为一种“知识人士〞的标志,有的则可能已经将网上购物作为自己日常生活的重要组成局部而取代了传统上街购物的方式。所以此时各种网购软件也就应运而生了。随着社会的开展,人们的生活也越来越好,更多的人愿意养一个宠物来冶一下情操了。而正在此时,我们做软件的程序员应该发现时代的气息、把我时代的走向,做出一款适合群众网购宠物的软件,所以我的宠物商店横空出世了。1.2工程开发的意义首先,对于消费者来说:第一,可以在家“逛商店〞,订货不受时间、地点的限制;第二,获得较大量的商品信息,可以买到当地没有的商品;第三,网上支付较传统拿现金支付更加平安,可防止现金丧失或遭到抢劫;第四,从订货、买货到货物上门无需亲临现场,既省时又省力;第五,由于网上商品省去租店面、召雇员及储存保管等一系列费用,总的来说其价格较一般商场的同类商品更廉价。其次,对于商家来说,由于网上销售没有库存压力、经营本钱低、经营规模不受场地限制等。在将来会有更多的企业选择网上销售,通过互联网对市场信息的及时反应适时调整经营战略,以此提高企业的经济效益和参与国际竞争的能力。再次,对于整个市场经济来说,这种新型的购物模式可在更大的围、更广的层面上以更高的效率实现资源配置。综上可以看出,网上购物突破了传统商务的障碍,无论对消费者、企业还是市场都有着巨大的吸引力和影响力,在新经济时期无疑是到达“多赢〞效果的理想模式。2系统分析与设计2.1工程主要功能描述这是一个网上宠物商店系统,网店里提供了和实体店一样的宠物来供用户观看、购置,具体功能如下:系统的注册功能:在欢送页可以实现用户的注册,注册之后可以登录。登录功能:注册完成后就可以使用刚刚注册的账号进展登录,如果是管理员,登录后实现管理员的功能,如果是普通用户,可以购置宠物。下面来介绍管理员登陆后的功能:宠物类别的添加功能:使用该功能可以添加宠物种类和宠物种类的编号。宠物类别的删除功能:使用该功能可以删除*些宠物种类及其编号。宠物类别的查看功能:使用该功能可以查看所有的宠物种类和他们对应的编号。宠物数量的添加功能:使用该功能可以在一个宠物种类下添加一个具体的宠物,包括此宠物的价格、寿命、重量等等宠物的具体属性。订单发送功能:该功能可以发送顾客已经购置的宠物的订单。订单删除功能:使用该功能可以删除任何顾客的购物车中的订单,不管顾客有没有购置,都可以删除。重新登录功能:使用该功能可以回到登录页面。密码修改功能:该功能可以实现用户密码的修改。现在介绍普通用户的功能:添加宠物的功能:使用该功能可以将任何宠物添加到购物车。删除宠物的功能:该功能可以删除购物车中的宠物。查看购物车功能:该功能可以看见自己目前选定了多少宠物。购置宠物功能:使用该功能可以购置购物车中选定的宠物。修改密码功能:使用该功能可以修改用户的密码。重新登录功能:使用该动能可以回到登录页面。2.2数据库设计1.绘制E-R图进展概念建模。用户表用户表管理宠物类别宠物订单项表订单表订单项表存储订单表供给商表管理管理员普通用户查看添加管理宠物类别宠物订单项表订单表订单项表存储订单表供给商表管理管理员普通用户查看添加2.数据库表设计2-1用户表〔Customer〕编号字段名数据类型是否主见字段意义1userIdint是用户的编号2userNamenvarchar(50)否用户名称3userPasswordnvarchar(50)否用户密码2-2宠物表〔Pets〕编号字段名数据类型是否主见字段意义1PetsIdnvarchar(50)是宠物的编号2PetsNamenvarchar(50)否宠物名称3Weightnvarchar(50)否宠物重量4PetsLifeint否宠物寿命5PurchasePricesmallmoney否宠物价格6RetailPricesmallmoney否宠物零售价7ActualSalePricesmallmoney否宠物售出的实际价格8PetsGenreIdnvarchar(50)否宠物所属种类的编号2-3宠物种类表〔PetsGenre〕编号字段名数据类型是否主见字段意义1PetsGenreIdnvarchar(50)是宠物类别的编号2PetsGenreNamenvarchar(50)否宠物种类名称2-4订单表〔Pets〕编号字段名数据类型是否主见字段意义1PurchaseOrderIdint是订单的编号2TotalMoneymoney否订单价格3PurchaseDateDatetime否订单产生日期4Demonvarchar(50)否顾客评价5SupplierIdint否供给商编号6CustomerIdInt否用户编号7PurchaseOrderItemIdint否订单项编号8Markint否用户是否购置的标记2-5订单项表〔PurchaseOrderItem〕编号字段名数据类型是否主见字段意义1PurchaseOrderItemIdint是订单项的编号2PetsQuanlityInt否宠物数量3TotalPerchaseItemPricemoney否订单项价格4PetsIdnvarchar(50)否宠物编号5PurchaseOrderIdint否订单编号2-6供给商表〔Supplier〕编号字段名数据类型是否主见字段意义1SupplierIdint是供给商的编号2SupplierNamenvarchar(50)否供给商名称3Telephonenvarchar(50)否供给商4Addressnvarchar(50)否供给商地址5Fa*Codenvarchar(50)否供给商6Memonvarchar(50)否供给商备注3系统实现3.1系统首页3.1.1管理员角色首页3.1.2普通用户角色首页3.2增加宠物种类的功能实现3.2.1Model.Models层publicclassPetsGenre{publicstringPetsGenreId{get;set;}publicstringPetsGenreName{get;set;}}3.2.2Model.IRepository层publicinterfaceIPetsGenreRepository{voidAdd(PetsGenrePetsGenre);//addvoidSave(PetsGenrePetsGenre);//savevoidRemove(PetsGenrePetsGenre);//deletePetsGenreFindBy(stringid);//findaccordingtoidList<PetsGenre>FindAll();//findall}3.2.3Repository.Linq层publicclassPetsGenreRepository:IPetsGenreRepository{PetsShopSolutionDataConte*tdb=newPetsShopSolutionDataConte*t();publicvoidAdd(PetsGenrePetsGenre){//将一个类中的信息传到那一个类中R_PetsGenrer_goodGenre=newR_PetsGenre();r_goodGenre.PetsGenreId=PetsGenre.PetsGenreId;r_goodGenre.PetsGenreName=PetsGenre.PetsGenreName;db.R_PetsGenre.InsertOnSubmit(r_goodGenre);db.SubmitChanges();}publicvoidSave(PetsGenrePetsGenre){varr_petsGenre=db.R_PetsGenre.SingleOrDefault<R_PetsGenre>(u=>u.PetsGenreId==PetsGenre.PetsGenreId);r_petsGenre.PetsGenreId=PetsGenre.PetsGenreId;r_petsGenre.PetsGenreName=PetsGenre.PetsGenreName;db.SubmitChanges();}publicvoidRemove(PetsGenrePetsGenre){varr_petsGenre=db.R_PetsGenre.SingleOrDefault<R_PetsGenre>(u=>u.PetsGenreId==PetsGenre.PetsGenreId);db.R_PetsGenre.DeleteOnSubmit(r_petsGenre);db.SubmitChanges();}publicPetsGenreFindBy(stringid){PetsGenrepetsGenre=newPetsGenre();varr_petsGenre=db.R_PetsGenre.SingleOrDefault<R_PetsGenre>(u=>u.PetsGenreId==id);if(r_petsGenre!=null){petsGenre.PetsGenreId=r_petsGenre.PetsGenreId;petsGenre.PetsGenreName=r_petsGenre.PetsGenreName;returnpetsGenre;}else{returnnull;}}publicList<PetsGenre>FindAll(){List<PetsGenre>petsGenres=newList<PetsGenre>();varr_petsGenres=db.R_PetsGenre.ToList();foreach(R_PetsGenrer_petsGenreinr_petsGenres){PetsGenrepetsGenre=newPetsGenre();petsGenre.PetsGenreId=r_petsGenre.PetsGenreId;petsGenre.PetsGenreName=r_petsGenre.PetsGenreName;petsGenres.Add(petsGenre);}returnpetsGenres;}}3.2.4Model.Services层publicclassPetsGenreService{privateIPetsGenreRepository_petsGenreRepository;publicPetsGenreService(IPetsGenreRepositorypetsGenreRepository){_petsGenreRepository=petsGenreRepository;}publicPetsGenreFindBy(stringpetsGenreId){return_petsGenreRepository.FindBy(petsGenreId);}publicboolIsE*isted(stringpetsGenreId){varresult=FindBy(petsGenreId);if(result!=null){returntrue;}else{returnfalse;}}publicList<PetsGenre>FindAll(){return_petsGenreRepository.FindAll();}publicboolIsE*istedName(stringpetsGenreName){varresult=FindAll().Where(u=>u.PetsGenreName==petsGenreName).ToList();if(result.Count>0){returntrue;}else{returnfalse;}}publicintAdd(PetsGenrepetsGenre){if(IsE*isted(petsGenre.PetsGenreId)){return4;}else{_petsGenreRepository.Add(petsGenre);return1;}}publicintSave(PetsGenrepetsGenre){if(IsE*isted(petsGenre.PetsGenreId)){_petsGenreRepository.Save(petsGenre);return2;}else{return5;}}publicintRemove(PetsGenrepetsGenre){if(IsE*isted(petsGenre.PetsGenreId)){_petsGenreRepository.Remove(petsGenre);return3;}else{return6;}}}3.2.5Service.ServiceFactory层publicstaticPetsGenreServiceCreatePetsGenreService(){IPetsGenreRepositorypetsGenreRepoitory=newPetsGenreRepository();returnnewPetsGenreService(petsGenreRepoitory);}3.2.6Infrastructure层publicclassStringHelper{publicstaticboolStringIsNull(stringtest){if(test.Trim()==""){returntrue;}else{returnfalse;}}publicstaticboolStringIsNotNull(stringtest){if(test.Trim()!=""){returntrue;}else{returnfalse;}}3.2.7WebUI.ASPNET层{PetsGenreServicepetsGenreService=ServiceFactory.CreatePetsGenreService();protectedvoidPage_Load(objectsender,EventArgse){}protectedvoidClearData()//此函数可清te*tbo*中的数据{t*tPetsGenreId.Te*t="";t*tPetsGenreName.Te*t="";}protectedboolValidatePage()//此函数可判断te*tbo*中的值是否为空{if(StringHelper.StringIsNull(t*tPetsGenreId.Te*t)){Response.Write("<script>alert('请填写宠物类别号!');</script>");returnfalse;}if(StringHelper.StringIsNull(t*tPetsGenreName.Te*t)){Response.Write("<script>alert('请填写宠物名称!');</script>");returnfalse;}returntrue;}protectedvoidButton1_Click(objectsender,EventArgse)//触发button按钮事件{if(ValidatePage()){Model.Models.PetsGenrepetsGenre=newModel.Models.PetsGenre();petsGenre.PetsGenreId=t*tPetsGenreId.Te*t;petsGenre.PetsGenreName=t*tPetsGenreName.Te*t;intrel=petsGenreService.Add(petsGenre);Response.Write("<script>alert('宠物类别资料已经创立成功!');</script>");ClearData();Response.Redirect("Inde*.asp*");}else{}}}3.3查看购物车功能的实现3.3.1Model.Models层publicclassPurchaseOrderItem{publicintPurchaseOrderItemId{set;get;}publicintPetsQuanlity{set;get;}//publicdecimalPetsPrice{set;get;}publicdecimal"TotalPerchaseItemPrice{set;get;}publicPetsPets{set;get;}//publicList<Pets>PetList{set;get;}publicintPurchaseOrderId{set;get;}publicPurchaseOrderItem(){Pets=newModel.Models.Pets();//PetList=newList<Pets>;//PurchaseOrder=newPurchaseOrder();}}publicclassPurchaseOrder{publicintPurchaseOrderId{set;get;}publicdecimal"TotalMoney{set;get;}publicDateTime"PurchaseDate{set;get;}publicstringDemo{set;get;}publicint"Mark{set;get;}publicSupplierSupplier{set;get;}publicCustomerCustomer{set;get;}//publicList<PurchaseOrderItem>PurchaseOrderItemList{set;get;}publicPurchaseOrderItemPurchaseOrderItem{set;get;}publicPurchaseOrder(){Supplier=newSupplier();Customer=newCustomer();//PurchaseOrderItemList=newList<PurchaseOrderItem>();PurchaseOrderItem=newPurchaseOrderItem();}}publicclassPets{publicstringPetsId{get;set;}publicstringPetsName{get;set;}publicstringWeight{get;set;}publicint"PetsLife{get;set;}publicPetsGenrePetsGenre{get;set;}publicPetsPricePetsPrice{get;set;}publicPets(){PetsGenre=newPetsGenre();PetsPrice=newPetsPrice();}}publicclassCustomer{publicintuserId{set;get;}publicstringuserName{set;get;}publicstringuserPassword{set;get;}}3.3.2Model.IRepository层publicinterfaceIPurchaseOrderRepository{voidAdd(PurchaseOrderpurchaseOrder);voidSave(PurchaseOrderpurchaseOrder);voidRemove(PurchaseOrderpurchaseOrder);PurchaseOrderFindBy(intid);//PurchaseOrderfindby(stringstr);List<PurchaseOrder>FindAll();}publicinterfaceIPurchaseOrderItemRepository{voidAdd(PurchaseOrderItemPurchaseOrderItem);voidRemove(PurchaseOrderItemPurchaseOrderItem);voidSave(PurchaseOrderItemPurchaseOrderItem);PurchaseOrderItemFindBy(intid);List<PurchaseOrderItem>Findall();}publicinterfaceIPetsRepository{voidAdd(Petspets);//addvoidSave(Petspets);//savevoidRemove(Petspets);//deletePetsFindBy(stringid);//findaccordingtoidList<Pets>FindAll();//findall}publicinterfaceICustomerRepository{voidAdd(Customercustomer);voidRemove(Customercustomer);voidSave(Customercustomer);CustomerFindBy(stringusername);List<Customer>FindAll();}3.3.3Repository.Linq层publicclassPurchaseOrderRepository:IPurchaseOrderRepository{PetsShopSolutionDataConte*tdb=newPetsShopSolutionDataConte*t();publicvoidAdd(PurchaseOrderpurchaseOrder){R_PurchaseOrderr_pets=newR_PurchaseOrder();r_pets.CustomerId=purchaseOrder.Customer.userId;r_pets.Demo=purchaseOrder.Demo;r_pets.PurchaseDate=purchaseOrder.PurchaseDate;r_pets.PurchaseOrderId=purchaseOrder.PurchaseOrderId;r_pets.PurchaseOrderItemId=purchaseOrder.PurchaseOrderItem.PurchaseOrderItemId;r_pets.SupplierId=purchaseOrder.Supplier.SupplierId;r_pets.TotalMoney=purchaseOrder.TotalMoney;r_pets.Mark=purchaseOrder.Mark;db.R_PurchaseOrder.InsertOnSubmit(r_pets);db.SubmitChanges();}publicvoidSave(PurchaseOrderpurchaseOrder){varr_purchaseOrder=db.R_PurchaseOrder.SingleOrDefault<R_PurchaseOrder>(u=>u.PurchaseOrderId==purchaseOrder.PurchaseOrderId);r_purchaseOrder.CustomerId=purchaseOrder.Customer.userId;r_purchaseOrder.Demo=purchaseOrder.Demo;r_purchaseOrder.PurchaseDate=purchaseOrder.PurchaseDate;r_purchaseOrder.PurchaseOrderId=purchaseOrder.PurchaseOrderId;r_purchaseOrder.PurchaseOrderItemId=purchaseOrder.PurchaseOrderItem.PurchaseOrderItemId;r_purchaseOrder.SupplierId=purchaseOrder.Supplier.SupplierId;r_purchaseOrder.TotalMoney=purchaseOrder.TotalMoney;r_purchaseOrder.Mark=purchaseOrder.Mark;db.SubmitChanges();}publicvoidRemove(PurchaseOrderpurchaseOrder){varr_purchasseOrder=db.R_PurchaseOrder.SingleOrDefault<R_PurchaseOrder>(u=>u.PurchaseOrderId==purchaseOrder.PurchaseOrderId);db.R_PurchaseOrder.DeleteOnSubmit(r_purchasseOrder);db.SubmitChanges();}publicPurchaseOrderFindBy(intid){PurchaseOrderpurchaseOrder=newPurchaseOrder();varr_purchaseOrder=(fromrindb.R_PurchaseOrder//joinpindb.R_Supplieronr.SupplierIdequalsp.SupplierIdjoinqindb.R_Customeronr.CustomerIdequalsq.userIdjoinsindb.R_PurchaseOrderItemonr.PurchaseOrderItemIdequalss.PurchaseOrderItemIdjoinpindb.R_Petsons.PetsIdequalsp.PetsIdwherer.PurchaseOrderId==idselectnew{id=r.PurchaseOrderId,customerid=r.CustomerId,customername=q.userName,demo=r.Demo,date=r.PurchaseDate,itemid=r.PurchaseOrderItemId,quality=s.PetsQuanlity,supplierid=r.SupplierId,totalmoney=r.TotalMoney,mark=r.Mark,petsid=p.PetsId,petsname=p.PetsName}).FirstOrDefault();//r).FirstOrDefault();if(r_purchaseOrder!=null){//purchaseOrder.Customer.userId=r_purchaseOrder.CustomerId;purchaseOrder.Customer.userId=r_purchaseOrder.customerid;purchaseOrder.Demo=r_purchaseOrder.demo;purchaseOrder.PurchaseDate=r_purchaseOrder.date;purchaseOrder.PurchaseOrderId=r_purchaseOrder.id;purchaseOrder.PurchaseOrderItem.PurchaseOrderItemId=r_purchaseOrder.itemid;purchaseOrder.PurchaseOrderItem.PetsQuanlity=r_purchaseOrder.quality;purchaseOrder.Supplier.SupplierId=r_purchaseOrder.supplierid;purchaseOrder.TotalMoney=r_purchaseOrder.totalmoney;purchaseOrder.Mark=r_purchaseOrder.mark;purchaseOrder.Customer.userName=r_purchaseOrder.customername;purchaseOrder.PurchaseOrderItem.Pets.PetsName=r_purchaseOrder.petsname;purchaseOrder.PurchaseOrderItem.Pets.PetsId=r_purchaseOrder.petsid;returnpurchaseOrder;}else{returnnull;}}publicList<PurchaseOrder>FindAll(){List<PurchaseOrder>purchaseOrders=newList<PurchaseOrder>();varr_purchaseOrders=db.R_PurchaseOrder.ToList();PurchaseOrderItemRepositorypoir=newPurchaseOrderItemRepository();PetsRepositorypr=newPetsRepository();CustomerRepositorycr=newCustomerRepository();PurchaseOrderRepositorypop=newPurchaseOrderRepository();Customercustomer;PurchaseOrderpo;PurchaseOrderItempurchaseOrderItem;Petspets;foreach(R_PurchaseOrderr_PurchaseOrderinr_purchaseOrders){stringstr=pop.FindBy(r_PurchaseOrder.PurchaseOrderId).Customer.userName;//customer=cr.FindBy(r_PurchaseOrder.);purchaseOrderItem=poir.FindBy(r_PurchaseOrder.PurchaseOrderItemId);pets=pr.FindBy(purchaseOrderItem.Pets.PetsId);PurchaseOrderpurchaseOrder=newPurchaseOrder();purchaseOrder.Customer.userId=r_PurchaseOrder.CustomerId;purchaseOrder.Customer.userName=str;purchaseOrder.Demo=r_PurchaseOrder.Demo;purchaseOrder.PurchaseDate=r_PurchaseOrder.PurchaseDate;purchaseOrder.PurchaseOrderId=r_PurchaseOrder.PurchaseOrderId;purchaseOrder.PurchaseOrderItem.PurchaseOrderItemId=r_PurchaseOrder.PurchaseOrderItemId;purchaseOrder.PurchaseOrderItem.PetsQuanlity=purchaseOrderItem.PetsQuanlity;purchaseOrder.PurchaseOrderItem.Pets.PetsId=pets.PetsId;purchaseOrder.PurchaseOrderItem.Pets.PetsName=pets.PetsName;purchaseOrder.Supplier.SupplierId=r_PurchaseOrder.SupplierId;purchaseOrder.TotalMoney=r_PurchaseOrder.TotalMoney;purchaseOrder.Mark=r_PurchaseOrder.Mark;purchaseOrders.Add(purchaseOrder);}returnpurchaseOrders;}}publicclassPetsRepository:IPetsRepository{PetsShopSolutionDataConte*tdb=newPetsShopSolutionDataConte*t();publicvoidAdd(Petspets){R_Petsr_pets=newR_Pets();r_pets.PetsId=pets.PetsId;r_pets.PetsName=pets.PetsName;r_pets.Weight=pets.Weight;r_pets.PetsLife=pets.PetsLife;r_pets.PurchasePrice=pets.PetsPrice.PurchasePrice;r_pets.RetailPrice=pets.PetsPrice.RetailPrice;r_pets.ActualSalePrice=pets.PetsPrice.ActualSalePrice;r_pets.PetsGenreId=pets.PetsGenre.PetsGenreId;db.R_Pets.InsertOnSubmit(r_pets);db.SubmitChanges();}publicvoidSave(Petspets){varr_pets=db.R_Pets.SingleOrDefault<R_Pets>(u=>u.PetsId==pets.PetsId);r_pets.PetsId=pets.PetsId;r_pets.ActualSalePrice=pets.PetsPrice.ActualSalePrice;r_pets.PetsGenreId=pets.PetsGenre.PetsGenreId;r_pets.PetsLife=pets.PetsLife;r_pets.PetsName=pets.PetsName;r_pets.PurchasePrice=pets.PetsPrice.PurchasePrice;r_pets.RetailPrice=pets.PetsPrice.RetailPrice;r_pets.Weight=pets.Weight;db.SubmitChanges();}publicvoidRemove(Petspets){varr_pets=db.R_Pets.SingleOrDefault<R_Pets>(u=>u.PetsId==pets.PetsId);db.R_Pets.DeleteOnSubmit(r_pets);db.SubmitChanges();}publicPetsFindBy(stringid){Petspets=newPets();varr_pets=(fromrindb.R_Petsjoinpindb.R_PetsGenreonr.PetsGenreIdequalsp.PetsGenreIdwherer.PetsId==idselectnew{PetsId=r.PetsId,PetsName=r.PetsName,Weight=r.Weight,PetsLife=r.PetsLife,PurchasePrice=r.PurchasePrice,RetailPrice=r.RetailPrice,ActualSalePrice=r.ActualSalePrice,PetsGenreId=p.PetsGenreId,etsGenreName=p.PetsGenreName}).FirstOrDefault();if(r_pets!=null){pets.PetsId=r_pets.PetsId;pets.PetsName=r_pets.PetsName;pets.Weight=r_pets.Weight;pets.PetsLife=r_pets.PetsLife;pets.PetsPrice.PurchasePrice=r_pets.PurchasePrice;pets.PetsPrice.ActualSalePrice=r_pets.ActualSalePrice;pets.PetsPrice.RetailPrice=r_pets.RetailPrice;pets.PetsGenre.PetsGenreId=r_pets.PetsGenreId;pets.PetsGenre.PetsGenreName=r_pets.etsGenreName;returnpets;}else{returnnull;}}publicList<Pets>FindAll(){List<Pets>petss=newList<Pets>();varr_pets=db.R_Pets.ToList();foreach(R_Petsrpetsinr_pets){Model.Models.PetsGenrepetsGenre;PetsGenreRepositorypetsGenreRepository=newPetsGenreRepository();Petspets=newPets();petsGenre=petsGenreRepository.FindBy(rpets.PetsGenreId);pets.PetsGenre.PetsGenreId=rpets.PetsGenreId;pets.PetsGenre.PetsGenreName=petsGenre.PetsGenreName;pets.PetsId=rpets.PetsId;pets.PetsLife=rpets.PetsLife;pets.PetsName=rpets.PetsName;pets.PetsPrice.ActualSalePrice=rpets.ActualSalePrice;pets.PetsPrice.PurchasePrice=rpets.PurchasePrice;pets.PetsPrice.RetailPrice=rpets.RetailPrice;pets.Weight=rpets.Weight;petss.Add(pets);}returnpetss;}}publicclassPurchaseOrderItemRepository:IPurchaseOrderItemRepository{PetsShopSolutionDataConte*tdb=newPetsShopSolutionDataConte*t();publicvoidAdd(PurchaseOrderItemPurchaseOrderItem){R_PurchaseOrderItemr_purchaseOrderItem=newR_PurchaseOrderItem();r_purchaseOrderItem.PetsId=PurchaseOrderItem.Pets.PetsId;r_purchaseOrderItem.PetsQuanlity=PurchaseOrderItem.PetsQuanlity;r_purchaseOrderItem.PurchaseOrderId=PurchaseOrderItem.PurchaseOrderId;r_purchaseOrderItem.PurchaseOrderItemId=PurchaseOrderItem.PurchaseOrderItemId;r_purchaseOrderItem.TotalPerchaseItemPrice=PurchaseOrderItem.TotalPerchaseItemPrice;db.R_PurchaseOrderItem.InsertOnSubmit(r_purchaseOrderItem);db.SubmitChanges();}publicvoidRemove(PurchaseOrderItemPurchaseOrderItem){varr_purchaseOrderItem=db.R_PurchaseOrderItem.FirstOrDefault<R_PurchaseOrderItem>(u=>u.PurchaseOrderItemId==PurchaseOrderItem.PurchaseOrderItemId);db.R_PurchaseOrderItem.DeleteOnSubmit(r_purchaseOrderItem);db.SubmitChanges();}publicvoidSave(PurchaseOrderItemPurchaseOrderItem){varr_purchaseOrderItem=db.R_PurchaseOrderItem.SingleOrDefault<R_PurchaseOrderItem>(u=>u.PurchaseOrderItemId==PurchaseOrderItem.PurchaseOrderItemId);r_purchaseOrderItem.PetsId=PurchaseOrderItem.Pets.PetsId;r_purchaseOrderItem.PetsQuanlity=PurchaseOrderItem.PetsQuanlity;db.SubmitChanges();}publicPurchaseOrderItemFindBy(intid){PurchaseOrderItempurchaseOrderItem=newPurchaseOrderItem();//varr_purchaseOrderItem=db.R_PurchaseOrderItem.SingleOrDefault<R_PurchaseOrderItem>//(u=>u.PurchaseOrderItemId==id);//if(r_purchaseOrderItem!=null)//{//purchaseOrderItem.Pets.PetsId=r_purchaseOrderItem.PetsId;//purchaseOrderItem.PetsQuanlity=r_purchaseOrderItem.PetsQuanlity;//purchaseOrderItem.PurchaseOrderId=r_purchaseOrderItem.PurchaseOrderId;//purchaseOrderItem.PurchaseOrderItemId=r_purchaseOrderItem.PurchaseOrderItemId;//purchaseOrderItem.TotalPerchaseItemPrice=r_purchaseOrderItem.TotalPerchaseItemPrice;//returnpurchaseOrderItem;//}varr_purchaseOrderItem=(fromrindb.R_PurchaseOrderItemjoinsindb.R_Petsonr.PetsIdequalss.PetsIdwherer.PurchaseOrderItemId==idselectnew
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024版文具采购合同3篇
- 专用木结构工程承包合同书2024年版版B版
- 专业桥架施工包工协议范例(2024版)版B版
- 2025年4S店汽车销售及二手车置换服务合同范本3篇
- 2024跨国技术转让与合作合同
- 专业项目建议书编写委托协议简化版版B版
- 2025年度科研场地租赁合同终止及设备回收协议3篇
- 2025年度老旧小区墙体拆除及改造工程劳务分包合同范本4篇
- 2025年度酒店会议室租赁协议书(含全方位服务套餐)
- 二零二五年度食堂食堂食堂食堂员工餐厅食品安全监管合同
- 金色简约蛇年年终总结汇报模板
- 农用地土壤环境质量类别划分技术指南(试行)(环办土壤2017第97号)
- 反向开票政策解读课件
- 工程周工作计划
- 房地产销售任务及激励制度
- 六年级语文下册14文言文二则《学弈》课件
- 2024年内蒙古中考语文试卷五套合卷附答案
- 并购指南(如何发现好公司)
- 垃圾分类亭合同协议书
- 物权转移协议
- 高三高考地理一轮课时练习:洋流(单选题)
评论
0/150
提交评论