Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc     = new HXSCEntities();
            var          billlist = (from c in hxsc.Bill
                                     orderby c.Createtime descending
                                     select c).ToList().FindAll(GetMath);

            List <Layer> layerlist = new List <Layer>();

            foreach (var item in billlist)
            {
                Layer layer = new Layer()
                {
                    amt        = item.Amt,
                    bank       = item.Bank,
                    billid     = item.Billid,
                    countryid  = item.Countryid,
                    createtime = item.Createtime.ToString("yyyy-MM-dd HH:mm:ss"),
                    isexpend   = item.Isexpend,
                    orderid    = item.Orderid,
                    purpose    = item.Purpose,
                    userid     = item.Userid
                };
                layerlist.Add(layer);
            }
            DataPack = layerlist;
            return(true);
        }
Пример #4
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc        = new HXSCEntities();
            var          invoicelist = (from c in hxsc.Invoice
                                        orderby c.Createtime descending
                                        select c).ToList();

            invoicelist = invoicelist.FindAll(GetMatch);

            DataPack = (from o in invoicelist
                        select new
            {
                Account = o.Account,
                Amt = o.Amt,
                Bank = o.Bank,
                Companyaddress = o.Companyaddress,
                Createtime = o.Createtime,
                Orderid = o.Orderid,
                Phone = o.Phone,
                State = o.State,
                Tax = o.Tax,
                Unit = o.Unit,
                Userid = o.Userid
            }).ToList();
            return(true);
        }
Пример #5
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();

            DataPack = (from o in hxsc.OrderD
                        join item in hxsc.Item
                        on o.Itemid equals item.Itemid
                        where o.Orderhid == orderid
                        select new
            {
                amt = o.Amt,
                createtime = o.Createtime,
                discount = o.Discount,
                orderhid = o.Orderhid,
                coverurl = item.Coverurl,
                itemid = o.Itemid,
                itemna = item.Itemna,
                number = o.Number,
                price = o.Price,
                realamt = o.Realamt,
                serial = o.Serial,
                start = o.Start
            }).ToList();
            return(true);
        }
Пример #6
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();
            var          list = (from f in hxsc.Favorites
                                 join item in hxsc.Item
                                 on f.ItmeId equals item.Itemid
                                 where f.State == 0
                                 orderby f.Createtime descending
                                 select new
            {
                Createtime = f.Createtime,
                FavoritesId = f.FavoritesId,
                ItmeId = f.ItmeId,
                State = f.State,
                Userid = f.Userid,
                Itemna = item.Itemna,
                Price = item.Price
            }).ToList();

            if (!string.IsNullOrEmpty(Userid) && createtime == DateTime.MinValue)
            {
                list = list.FindAll(o => o.Userid == Userid);
            }
            else if (string.IsNullOrEmpty(Userid) && createtime != DateTime.MinValue)
            {
                list = list.FindAll(o => o.Createtime > createtime);
            }
            else if (!string.IsNullOrEmpty(Userid) && createtime != DateTime.MinValue)
            {
                list = list.FindAll(o => o.Createtime > createtime && o.Userid == Userid);
            }
            DataPack = list;
            return(true);
        }
Пример #7
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();

            if (hxsc.UserInfo.FirstOrDefault(o => o.Userid == Userid) == null)
            {
                return(SetError("用户不存在!"));
            }

            DataPack = (from um in hxsc.UseriMail
                        join m in hxsc.Mail
                        on um.Mailid equals m.Mailid
                        where um.Userid == Userid
                        select new
            {
                Userid = um.Userid,
                State = um.State,
                Mailid = um.Mailid,
                Genre = m.Genre,
                Classify = m.Classify,
                Contenttxt = m.Contenttxt,
                Levelx = m.Levelx,
                Parentsmailid = m.Parentsmailid
            }).ToList();
            return(true);
        }
Пример #8
0
        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);
        }
Пример #9
0
        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);
        }
Пример #10
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();

            if (hxsc.UserInfo.FirstOrDefault(u => u.Userid == Userid) == null)
            {
                return(SetError("用户不存在!"));
            }
            var listN = (from oh in hxsc.OrderD
                         join o in hxsc.OrderH
                         on oh.Orderhid equals o.OrderhId
                         join i in hxsc.Item
                         on oh.Itemid equals i.Itemid
                         where o.Start == 1 && o.UserId == Userid
                         select new
            {
                Itemna = i.Itemna,
                Itemid = i.Itemid,
                Coverurl = i.Coverurl,
                Orderhid = oh.Orderhid,
                Amt = o.Amt,
            }).ToList();

            DataPack = listN;
            return(true);
        }
Пример #11
0
 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;
 }
Пример #12
0
        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);
        }
Пример #13
0
        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);
        }
Пример #14
0
        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);
        }
Пример #15
0
        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("图书不存在!");
            //}
            var list = (from o in hxsc.Comments
                        orderby o.Createtime descending
                        select o).ToList();

            list = list.FindAll(GetMath);
            var listN = (from o in list
                         select new
            {
                o.Commentsid,
                o.Commentstxt,
                o.Createtime,
                o.Itemid,
                o.Parentscommentsid,
                o.Star,
                o.Userid
            }).ToList();

            DataPack = listN;
            return(true);
        }
Пример #16
0
        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);
        }
Пример #17
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();
            var          list = (from c in hxsc.Shoppingbasket
                                 join i in hxsc.Item
                                 on c.Itemid equals i.Itemid
                                 where c.State == 0
                                 orderby c.Createtime descending
                                 select new
            {
                Shoppingbasketid = c.Shoppingbasketid,
                Userid = c.Userid,
                Itemid = c.Itemid,
                Createtime = c.Createtime,
                Coverurl = i.Coverurl,
                Itemna = i.Itemna
            }).ToList();

            if (!string.IsNullOrEmpty(Userid) && createtime == DateTime.MinValue)
            {
                list = list.FindAll(o => o.Userid == Userid);
            }
            else if (string.IsNullOrEmpty(Userid) && createtime != DateTime.MinValue)
            {
                list = list.FindAll(o => o.Createtime > createtime);
            }
            else if (!string.IsNullOrEmpty(Userid) && createtime != DateTime.MinValue)
            {
                list = list.FindAll(o => o.Createtime > createtime && o.Userid == Userid);
            }
            DataPack = list;
            return(true);
        }
Пример #18
0
        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);
        }
Пример #19
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc     = new HXSCEntities();
            var          userinfo = hxsc.UserInfo.FirstOrDefault(o => o.Userna == userna);

            if (userinfo != null)
            {
                return(SetError("此用户名已被注册,请更换一个用户名!"));
            }
            return(true);
        }
Пример #20
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();

            var userinfo = hxsc.UserInfo.FirstOrDefault(o => o.Phone == phone && o.Verification == verification);

            if (userinfo == null)
            {
                return(SetError("此用户名或密码不正确!"));
            }
            return(true);
        }
Пример #21
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();
            Item         item = hxsc.Item.FirstOrDefault(o => o.Itemid == itemid);

            if (item == null)
            {
                return(SetError("图书信息不存在!"));
            }
            DataPack = item;
            return(true);
        }
Пример #22
0
 private object GetDetail(HXSCEntities hxsc, int ReturnedId)
 {
     return((from o in hxsc.ReturnedD
             where o.Returnedid == ReturnedId
             select new
     {
         itemid = o.Itemid,
         amt = o.Amt,
         createtime = o.Createtime,
         start = o.State
     }).ToList());
 }
Пример #23
0
        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);
        }
Пример #24
0
        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);
        }
Пример #25
0
        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);
        }
Пример #26
0
        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);
        }
Пример #27
0
        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);
        }
Пример #28
0
 protected bool SetHttpContext(HttpContext Context)
 {
     hxsc    = new HXSCEntities();
     context = Context;
     if (context.Request.Params["MethodType"] != null)
     {
         methodTpye = context.Request.Params["MethodType"];
     }
     if (methodTpye == "")
     {
         context.Response.Write("param is error……");
         return(false);
     }
     return(true);
 }
Пример #29
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();

            if (hxsc.UserInfo.FirstOrDefault(u => u.Userid == Userid) == null)
            {
                return(SetError("用户不存在!"));
            }

            var UserInfo = (from o in hxsc.UserInfo
                            where o.Userid == Userid
                            select new { Balance = o.Balance }).FirstOrDefault();

            DataPack = UserInfo;
            return(true);
        }
Пример #30
0
        public override bool TakeAction()
        {
            HXSCEntities hxsc = new HXSCEntities();

            DataPack = (from o in hxsc.Mail
                        select new
            {
                mailid = o.Mailid,
                genre = o.Genre,
                classify = o.Classify,
                Contenttxt = o.Contenttxt,
                levelx = o.Levelx,
                parentsmailid = o.Parentsmailid
            }).ToList();
            return(true);
        }