コード例 #1
0
 public IQueryable<Item> ItemGetByBuyer(IQueryable<Item> items, User buyer)
 {
     return from ord in yikuData.Orders
                 where ord.UID == buyer.UID && items.Contains(ord.Item)
                 orderby ord.OrID
                 select ord.Item;
 }
コード例 #2
0
 public UserCreateStatus UserCreate(string name, string password, string address, string consignee, string tel, string zipcode, bool overwrite = false)
 {
     try
     {
         User user = GetUser(name);
         if (user != null)
         {
             if (!overwrite) return UserCreateStatus.AlreadyExist;
             if (password != null) user.PSW = password;
             if (address != null) user.Address = address;
             if (consignee != null) user.Consignee = consignee;
             if (tel != null) user.Tel = tel;
             if (zipcode != null) user.ZipCode = zipcode;
         }
         else
         {
             user = new User();
             user.PSW = password;
             user.Name = name;
             user.Address = address;
             user.Consignee = consignee;
             user.Tel = tel;
             user.ZipCode = zipcode;
             user.ROLE = "User";
             user.Exist = true;
             Add(user);
         }
         return UserCreateStatus.Succeed;
     }
     catch{
         return UserCreateStatus.Faild;
     }
 }
コード例 #3
0
ファイル: MyYikuController.cs プロジェクト: solamiku/Yiku
        public ActionResult profile(User user)
        {
            UpdateModel(yikuData.UserCurrent);
            yikuData.Save();

            ViewData["MyYiku"] = "profile";
            return View(yikuData.UserCurrent);
        }
コード例 #4
0
 public bool UserChangePassword(User user, string pswOld, string pswNew)
 {
     if (UserExist(user) && user.PSW.Trim() == pswOld)
     {
         user.PSW = pswNew;
         return true;
     }
     return false;
 }
コード例 #5
0
        //T_Collection Set
        public T_Collection AddCollection(User user, Item item)
        {
            T_Collection tco = GetT_Collection(item, user);
            if (tco == null) tco = new T_Collection();
            else return tco;

            tco.UID = user.UID;
            tco.IID = item.IID;
            Add(tco);
            return tco;
        }
コード例 #6
0
        public Order OrderCreate(User user, Item item, string Cut, int count = 1)
        {
            Order order = new Order();
            order.UID = user.UID;
            order.IID = item.IID;
            order.Count = count;
            order.Cut = Cut;
            order.Time = DateTime.Now;
            order.Cost = item.Price * count;
            order.State = "buy";
            Add(order);

            return order;
        }
コード例 #7
0
 public T_Shopping DeleteShopping(User user, Item item, int count)
 {
     T_Shopping tsh = GetT_Shopping(item, user);
     if (tsh != null)
     {
         if (tsh.Count <= count) Delete(tsh);
         else
         {
             tsh.Count -= count;
             return tsh;
         }
     }
     return null;
 }
コード例 #8
0
        public Item ItemCreate(User publisher, string name, string detail, int stock, decimal price, string cutType)
        {
            Item item = new Item();
            item.PublisherID = publisher.UID;
            item.Name = name;
            item.Detail = detail;
            item.Stock = stock;
            item.Volume = 0;
            item.Price = price;
            item.TimeCreate = DateTime.Now;
            item.Cut = cutType;
            item.Exist = true;
            Add(item);

            return item;
        }
コード例 #9
0
 public T_Shopping AddShopping(User user, Item item, int Count, string Cut = null)
 {
     T_Shopping tsh = GetT_Shopping(item, user);
     if (tsh == null)
     {
         tsh = new T_Shopping();
         tsh.UID = user.UID;
         tsh.IID = item.IID;
         tsh.Count = Count;
         tsh.Cut = Cut;
         Add(tsh);
     }
     else
     {
         tsh.Count += Count;
         if (Cut != null)
             tsh.Cut = Cut;
     }
     return tsh;
 }
コード例 #10
0
 public T_Collection GetT_Collection(Item item, User user)
 {
     return yikuData.T_Collection.SingleOrDefault(tco => tco.IID == item.IID && tco.UID == user.UID );
 }
コード例 #11
0
 public IQueryable<Order> OrderGetBySeller(User buyer)
 {
     return OrderGetBySeller(yikuData.Orders, buyer);
 }
コード例 #12
0
 public void DeleteShopping(User user, Item item)
 {
     T_Shopping tsh = GetT_Shopping(item, user);
     if (tsh != null)
         Delete(tsh);
 }
コード例 #13
0
 //T_Shopping Set
 public T_Shopping AddShopping(User user, Item item)
 {
     return AddShopping(user, item, 1, null);
 }
コード例 #14
0
 public bool UserExist(User user)
 {
     if(user != null)
         return user.Exist;
     return false;
 }
コード例 #15
0
 public IQueryable<Item> ItemGetShoppingItem(User buyer)
 {
     return from tsh in yikuData.T_Shopping
            where tsh.UID == buyer.UID
            orderby tsh.IID
            select tsh.Item;
 }
コード例 #16
0
 //publisher
 public IQueryable<Item> GetItems(User user)
 {
     return from i in yikuData.Items
            where i.PublisherID == user.UID
            select i;
 }
コード例 #17
0
 public T_Shopping GetT_Shopping(Item item, User user)
 {
     return yikuData.T_Shopping.SingleOrDefault(tsh => tsh.IID == item.IID && tsh.UID == user.UID );
 }
コード例 #18
0
 public IQueryable<Item> ItemGetByBuyer(User buyer)
 {
     return ItemGetByBuyer(yikuData.Items, buyer);
 }
コード例 #19
0
 public IQueryable<T_Shopping> GetT_Shopping(User user)
 {
     return from tsh in yikuData.T_Shopping
            where tsh.UID == user.UID
            select tsh;
 }
コード例 #20
0
 public IQueryable<Order> GetOrders(User buyer)
 {
     return OrderGetByBuyer(buyer);
 }
コード例 #21
0
ファイル: YikuData.Designer.cs プロジェクト: solamiku/Yiku
 /// <summary>
 /// 创建新的 User 对象。
 /// </summary>
 /// <param name="uID">UID 属性的初始值。</param>
 /// <param name="name">Name 属性的初始值。</param>
 /// <param name="point">Point 属性的初始值。</param>
 /// <param name="exist">Exist 属性的初始值。</param>
 /// <param name="pSW">PSW 属性的初始值。</param>
 /// <param name="rOLE">ROLE 属性的初始值。</param>
 public static User CreateUser(global::System.Int32 uID, global::System.String name, global::System.Int64 point, global::System.Boolean exist, global::System.String pSW, global::System.String rOLE)
 {
     User user = new User();
     user.UID = uID;
     user.Name = name;
     user.Point = point;
     user.Exist = exist;
     user.PSW = pSW;
     user.ROLE = rOLE;
     return user;
 }
コード例 #22
0
 public IQueryable<Order> OrderGetByBuyer(IQueryable<Order> orders, User buyer)
 {
     return from order in orders
            where order.UID == buyer.UID
            select order;
 }
コード例 #23
0
ファイル: YikuData.Designer.cs プロジェクト: solamiku/Yiku
 /// <summary>
 /// 用于向 Users EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
コード例 #24
0
 public IQueryable<Order> OrderGetBySeller(IQueryable<Order> orders, User seller)
 {
     return from order in orders
            where order.Item.PublisherID == seller.UID
            select order;
 }
コード例 #25
0
 public IQueryable<Item> ItemGetBySeller(User seller)
 {
     return ItemGetBySeller(yikuData.Items, seller);
 }
コード例 #26
0
 public void DeleteCollection(User user, Item item)
 {
     T_Collection tco = GetT_Collection(item, user);
     if( tco != null)
         Delete(tco);
 }
コード例 #27
0
 public IQueryable<Item> ItemGetBySeller(IQueryable<Item> items, User seller)
 {
     return from i in items
            where i.PublisherID == seller.UID
            orderby i.IID
            select i;
 }
コード例 #28
0
 public IQueryable<T_Collection> GetT_Collections(User user)
 {
     return from tco in yikuData.T_Collection
            where tco.UID == user.UID
            select tco;
 }
コード例 #29
0
ファイル: CurrentUser.cs プロジェクト: solamiku/Yiku
 public static bool UserIsCurrent(User user)
 {
     return UserCurrent.UID == user.UID;
 }