public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); if (hxsc.UserInfo.FirstOrDefault(o => o.Userid == Userid) == null) { return(SetError("用户不存在!")); } OrderH orderH = hxsc.OrderH.FirstOrDefault(o => o.OrderhId == orderid); if (orderH == null) { return(SetError("订单不存在!")); } if (orderH.Start == 0) { SetError("未付款订单不能退货!"); } var orderDlist = (from od in hxsc.OrderD where od.Orderhid == orderid select od).ToList(); foreach (var item in Contenttxt) { if (orderDlist.Find(o => o.Itemid == item.Itemid) == null) { return(SetError("订单图书不存在")); } } ReturnedH returnedH = new ReturnedH() { Amt = Contenttxt.Sum(o => o.Amt), Orderid = orderid, Source = key, State = 0, Userid = Userid, CreateTime = DateTime.Now, }; hxsc.ReturnedH.AddObject(returnedH); hxsc.SaveChanges(); foreach (var item in Contenttxt) { ReturnedD returnedD = new ReturnedD() { Amt = item.Amt, Createtime = DateTime.Now, Itemid = item.Itemid, Returnedid = returnedH.ReturnedId, Serial = "", State = 0 }; hxsc.ReturnedD.AddObject(returnedD); } hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); if (hxsc.UserInfo.FirstOrDefault(u => u.Userid == Userid) == null) { return(SetError("用户不存在!")); } if (hxsc.Item.FirstOrDefault(u => u.Itemid == itemid) == null) { return(SetError("图书不存在!")); } Bookmark Bookmark = new Bookmark() { Createtime = DateTime.Now, Itemid = itemid, Position = Position, Userid = Userid, Source = key }; hxsc.Bookmark.AddObject(Bookmark); hxsc.SaveChanges(); DataPack = new Layer() { Bookmarkid = Bookmark.Bookmarkid }; return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); if (hxsc.UserInfo.FirstOrDefault(u => u.Userid == Userid) == null) { return(SetError("用户不存在")); } if (hxsc.Item.FirstOrDefault(u => u.Itemid == ItemId) == null) { return(SetError("书本不存在!")); } Favorites Favorites = new EfModel.Favorites() { Createtime = DateTime.Now, DelTime = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue, ItmeId = ItemId, Source = key, State = 0, Userid = Userid }; hxsc.Favorites.AddObject(Favorites); hxsc.SaveChanges(); Layer layer = new Layer(); layer.favoritesid = Favorites.FavoritesId; DataPack = layer; return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); var userinfo = hxsc.UserInfo.FirstOrDefault(o => o.Userid == Userid); if (userinfo == null) { return(SetError("用户不存在!")); } if (hxsc.Item.FirstOrDefault(u => u.Itemid == itemid) == null) { return(SetError("书本不存在!")); } Clickrecord clickre = new Clickrecord() { Createtime = DateTime.Now, Itemid = itemid, Source = key, Userid = Userid }; hxsc.Clickrecord.AddObject(clickre); hxsc.SaveChanges(); DataPack = new Layer() { Clickrecordid = clickre.Clickrecordid }; return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); var userinfo = hxsc.UserInfo.FirstOrDefault(o => o.Userid == User_id); if (userinfo == null) { return(SetError("用户不存在!")); } userinfo.Sex = sex; userinfo.Balance = balance; userinfo.Birthday = birthday; userinfo.CityId = cityid; userinfo.CountryId = countryid; userinfo.ImageUrl = imageurl; userinfo.Phone = phone; userinfo.RegionId = regionid; userinfo.Start = start; userinfo.Street = street; userinfo.UserName = username; userinfo.WorkDetail = workdetail; userinfo.WorkId = workid; userinfo.ProvinceId = provinceid; hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); if (hxsc.UserInfo.FirstOrDefault(u => u.Userid == Userid) == null) { return(SetError("用户不存在!")); } if (hxsc.Item.FirstOrDefault(u => u.Itemid == Itemid) == null) { return(SetError("图书不存在!")); } Comments comments = new Comments() { Commentstxt = Connentstxt, Createtime = DateTime.Now, Itemid = Itemid, Source = key, Star = Star, Parentscommentsid = Parentscommentsid, Userid = Userid }; hxsc.Comments.AddObject(comments); hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); if (hxsc.UserInfo.FirstOrDefault(u => u.Userid == Userid) == null) { return(SetError("用户不存在!")); } if (hxsc.Item.FirstOrDefault(u => u.Itemid == Itemid) == null) { return(SetError("图书不存在!")); } Shoppingbasket shopingbasket = new Shoppingbasket() { Createtime = DateTime.Now, Itemid = Itemid, Source = key, State = 0, Userid = Userid }; hxsc.Shoppingbasket.AddObject(shopingbasket); hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); if (hxsc.UserInfo.FirstOrDefault(o => o.Userid == Userid) == null) { return(SetError("用户不存在!")); } if (hxsc.Mail.FirstOrDefault(o => o.Mailid == mailid) == null) { return(SetError("邮件不存在!")); } UseriMail userMail = hxsc.UseriMail.FirstOrDefault(o => o.Userid == Userid && o.Mailid == mailid); if (userMail != null) { return(SetError("该邮件已订阅,不需要再订阅!")); } userMail = new UseriMail() { Mailid = mailid, Source = key, State = state, Userid = Userid }; hxsc.UseriMail.AddObject(userMail); hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); var userinfo = hxsc.UserInfo.FirstOrDefault(o => o.Userid == Userid); if (userinfo == null) { return SetError("用户不存在!"); } Bill Bill = new Bill() { Amt = Amt, Bank = Bank, Countryid = Countryid, Createtime = DateTime.Now, Isexpend = Isexpend, Orderid = Orderid, Purpose = Purpose, Source = key, Userid = Userid }; hxsc.Bill.AddObject(Bill); hxsc.SaveChanges(); DataPack = new Layer() { Billid = Bill.Billid }; return true; }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); if (hxsc.UserInfo.Count() > 0) { var userinfo = hxsc.UserInfo.FirstOrDefault(o => o.Userna == userna); if (userinfo != null) { return(SetError("此用户名已被使用,请更换一个用户名!")); } } pwd = CryptoHelper.MD5_Encrypt(pwd, CryptoHelper.Key, Encoding.UTF8); UserInfo userInfo = new UserInfo() { Userid = System.Guid.NewGuid().ToString().Replace("-", ""), Pwd = pwd, Userna = userna, }; hxsc.UserInfo.AddObject(userInfo); hxsc.SaveChanges(); outDate od = new outDate() { userid = userInfo.Userid }; DataPack = od; return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); Favorites Favorites = hxsc.Favorites.FirstOrDefault(o => o.FavoritesId == faboritesid); if (Favorites == null) { SetError("此收藏不存在"); } Favorites.State = 0; hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); Bookmark Bookmark = hxsc.Bookmark.FirstOrDefault(u => u.Bookmarkid == Bookmarkid); if (Bookmark == null) { return(SetError("书签不存在!")); } Bookmark.Position = Position; hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); Shoppingbasket Shoppingbasket = hxsc.Shoppingbasket.FirstOrDefault(u => u.Shoppingbasketid == shoppingbasketid); if (Shoppingbasket == null) { return(SetError("购物车中商品不存在!")); } Shoppingbasket.State = 1; hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); var userinfo = hxsc.UserInfo.FirstOrDefault(o => o.Userid == userid); if (userinfo == null) { return(SetError("用户不存在!")); } pwd = CryptoHelper.MD5_Encrypt(pwd, CryptoHelper.Key, Encoding.UTF8); userinfo.Pwd = pwd; hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); Mail mail = hxsc.Mail.FirstOrDefault(o => o.Mailid == mailid); if (mail == null) { return(SetError("邮件不存在!")); } hxsc.Mail.DeleteObject(mail); hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); var userinfo = hxsc.UserInfo.FirstOrDefault(o => o.Userid == userid); if (userinfo == null) { return(SetError("用户不存在!")); } OrderH orderH = new OrderH() { Amt = itemArr.Sum(o => o.amt), CreateTime = DateTime.Now, UserId = userid, Start = 0, Source = key, Discount = 0, ReceiveAddress = Receiveaddress, Realamt = itemArr.Sum(o => o.price), Phone = Phone, OrderhId = Guid.NewGuid().ToString().Replace("-", "") }; hxsc.OrderH.AddObject(orderH); foreach (var itemn in itemArr) { OrderD orderD = new OrderD() { Amt = itemn.amt, Createtime = DateTime.Now, Discount = itemn.discount, Itemid = itemn.itemid, Start = 0, Serial = itemn.serial, Realamt = itemn.realamt, Price = itemn.price, Number = itemn.number, Orderhid = orderH.OrderhId }; hxsc.OrderD.AddObject(orderD); } hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); Invoice Invoice = hxsc.Invoice.FirstOrDefault(u => u.InvoiceId == invoiceid); if (Invoice == null) { return(SetError("发票不存在!")); } if (state < 0 || state > 2) { return(SetError("发票状态不正确!")); } Invoice.State = state; hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); Mail mail = new Mail() { Classify = classify, Contenttxt = Contenttxt, Genre = genre, Levelx = levelx, Parentsmailid = parentsmailid, Source = key }; hxsc.Mail.AddObject(mail); hxsc.SaveChanges(); DataPack = new Layer() { mailid = mail.Mailid }; return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); ReturnedH ReturnedH = hxsc.ReturnedH.FirstOrDefault(o => o.ReturnedId == returnedid); if (ReturnedH == null) { return(SetError("退货单不存在!")); } if (ReturnedH.State != 0) { return(SetError("已经退货!")); } OrderH orderH = hxsc.OrderH.FirstOrDefault(o => o.OrderhId == ReturnedH.Orderid); if (orderH == null) { return(SetError("订单不存在!")); } if (orderH.Start == 0) { return(SetError("未付款订单不能退货!")); } var returnedD = (from o in hxsc.ReturnedD where o.Returnedid == returnedid select o).ToList(); ReturnedH.State = state; foreach (var item in returnedD) { item.State = state; OrderD orderD = hxsc.OrderD.FirstOrDefault(o => o.Itemid == item.Itemid); if (orderD != null) { orderD.Start = 3; } } hxsc.SaveChanges(); return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); if (hxsc.UserInfo.FirstOrDefault(u => u.Userid == Userid) == null) { return(SetError("用户不存在!")); } string[] orderidlist = Orderid.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (orderidlist.Length == 0) { SetError("订单号不能为空!"); } var orderList = (from o in hxsc.OrderH where orderidlist.Any(oid => oid == o.OrderhId) select o).ToList(); if (orderList.Count < orderidlist.Length) { SetError("有订单不存在!"); } var orderh = orderList.Find(u => u.UserId != Userid); if (orderh != null) { SetError(string.Format("订单号{0}不属于您!", orderh.OrderhId)); } double pricecount = (double)orderList.Sum(o => o.Amt); if ((double)Amt > pricecount) { SetError("发票金额大于订单总金额!"); } Invoice invoice = new Invoice() { Account = Account, Amt = Amt, Bank = Bank, Companyaddress = Companyaddress, Createtime = DateTime.Now, Orderid = Orderid, Phone = Phone, Source = key, State = 0, Tax = Tax, Unit = Unit, Userid = Userid }; hxsc.Invoice.AddObject(invoice); hxsc.SaveChanges(); DataPack = new Layer() { invoiceid = invoice.InvoiceId }; return(true); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); Item item = new Item() { Author = author, Booknumber = booknumber, Chief = chief, Cip = cip, Cnmarc = cnmarc, Code = code, Compilingmethodid = compilingmethodid, CoverDesign = Coverdesign, Coverurl = coverurl, Createtime = DateTime.Now, Deitoracquiring = deitoracquiring, Deitorplanning = deitoracquiring, Directoryid = directoryid, Draw = draw, Ebook = Ebook, Edition = edition, Editiontiem = editiontiem, Editorcharge = editorcharge, Editorcopy = editorcopy, Filerul = filerul, Firsteditiontime = firsteditiontime, Isbn = isbn, Itemkey = itemkey, Itemna = itemna, Languageid = languageid, Maxnumber = maxnumber, Number = number, Originalcountryid = originalcountryid, Originallanguageid = originallanguageid, Originalna = originalna, Originalprice = originalprice, OverallDesign = overalldesign, Pagenumber = pagenumber, PlateDesign = Platedesign, Press = Press, Price = price, Printing = printing, Published = Published, Reader = reader, ShelfTime = Shelftime, Start = start, Timex = timex, Translator = translator, Typesetting = Typesetting, Undertime = Undertime, Volume = Volume, Volumesize = Volumesize, Wordsnumber = wordsnumber, Itemno = itemno, }; hxsc.Item.AddObject(item); hxsc.SaveChanges(); DataPack = new Layer() { itemid = item.Itemid }; return(true); }
protected void Commit() { hxsc.SaveChanges(); }
public override bool TakeAction() { HXSCEntities hxsc = new HXSCEntities(); string[] itemidArr = itemidList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (itemidArr.Length == 0) { return(SetError("图书信息不能为空!")); } foreach (var sitemid in itemidArr) { int itemid = 0; int.TryParse(sitemid, out itemid); Item item = hxsc.Item.FirstOrDefault(o => o.Itemid == itemid); if (item == null) { return(SetError("图书信息不存在!")); } OrderD orderD = new OrderD() { Amt = item.Price, Createtime = DateTime.Now, Discount = 1, Itemid = itemid, Number = 1, Orderhid = "", Price = item.Price, Realamt = item.Price, Serial = 0, Start = 0 }; list.Add(orderD); } OrderH orderH = new OrderH() { Amt = 0, CreateTime = DateTime.Now, Discount = 0, Express = "", ExpressNo = "", ExpressTime = DateTime.Now, Phone = "", Realamt = 0, ReceiveAddress = "", Source = key, Start = 0, UserId = userid }; hxsc.OrderH.AddObject(orderH); hxsc.SaveChanges(); foreach (var item in list) { item.Orderhid = orderH.OrderhId; hxsc.OrderD.AddObject(item); } hxsc.SaveChanges(); return(true); }