Exemplo n.º 1
0
        public static bool UpdateActivityPro(Guid id, string buytime, string num, string imagepath, string desimgpath)
        {
            using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
            {
                try
                {
                    List <ActivityPro> list = entitys.ActivityProes.Where(a => a.ID == id).ToList();
                    if (list.Count > 0)
                    {
                        ActivityPro att = list[0];
                        att.BUYTIME    = buytime;
                        att.NUM        = int.Parse(num);
                        att.IMAGEPATH  = imagepath;
                        att.DESIMGPATH = desimgpath;
                        //将实体对象加入EF对象容器中,并获取伪包装类对象
                        DbEntityEntry <ActivityPro> entry = entitys.Entry <ActivityPro>(att);
                        entry.State = System.Data.Entity.EntityState.Modified;
                        entitys.SaveChanges();
                    }
                    return(true);
                }
                catch (Exception)
                {
                    return(false);

                    throw;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the logistics.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="logistics">The logistics.</param>
        /// <returns></returns>
        /// 创建人:李允智
        /// 创建时间:2015/9/23
        /// 描述:更新物流单号
        public static bool UpdateLogistics(Guid id, string logistics)
        {
            using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
            {
                List <OrderInfo> orderInfoList = (from a in entitys.OrderInfoes select a).Where(a => a.ID == id).ToList();
                try
                {
                    OrderInfo oi = orderInfoList[0];
                    oi.LOGISTICS = logistics;
                    oi.ISPRINTED = true;
                    //将实体对象加入EF对象容器中,并获取伪包装类对象
                    DbEntityEntry <OrderInfo> entry = entitys.Entry <OrderInfo>(oi);
                    //将包装类对象 的状态设置为 Unchanged
                    entry.State = System.Data.Entity.EntityState.Modified;
                    entry.Property(a => a.LOGISTICS).IsModified = true;
                    entry.Property(a => a.ISPRINTED).IsModified = true;
                    entitys.SaveChanges();
                    return(true);
                }
                catch (DbEntityValidationException dbEx)
                {
                    return(false);

                    throw;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates the activity.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="buytime">The buytime.</param>
        /// <param name="num">The number.</param>
        /// <param name="type">The type.</param>
        /// <param name="code">The code.</param>
        /// <returns></returns>
        /// 创建人:李允智
        /// 创建时间:2015/9/10
        /// 描述:编辑活动
        public static bool UpdateActivity(Guid id, string name, string type, string code)
        {
            using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
            {
                try
                {
                    Activity att = new Activity();
                    att.NAME = name;
                    att.TYPE = int.Parse(type);
                    att.CODE = code;
                    att.ID   = id;
                    //将实体对象加入EF对象容器中,并获取伪包装类对象
                    DbEntityEntry <Activity> entry = entitys.Entry <Activity>(att);
                    //将包装类对象 的状态设置为 Unchanged
                    entry.State = System.Data.Entity.EntityState.Modified;
                    entry.Property(a => a.NAME).IsModified = true;
                    entry.Property(a => a.TYPE).IsModified = true;
                    entry.Property(a => a.CODE).IsModified = true;
                    entitys.SaveChanges();
                    return(true);
                }
                catch (Exception)
                {
                    return(false);

                    throw;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Resets the activity.
        /// </summary>
        /// <param name="ID">The identifier.</param>
        /// <returns></returns>
        /// 创建人:李允智
        /// 创建时间:2015/9/16
        /// 描述:重置活动 开启新的抢购
        public static bool ResetActivity(Guid ID)
        {
            using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
            {
                try
                {
                    List <Model.OrderInfo> orderList = (from a in entitys.OrderInfoes select a).Where(a => a.ACTIVITYID == ID).ToList();
                    if (orderList.Count != 0)
                    {
                        foreach (Model.OrderInfo item in orderList)
                        {
                            OrderInfo order = item;
                            order.ISHISTORY = true;
                            //将实体对象加入EF对象容器中,并获取伪包装类对象
                            DbEntityEntry <OrderInfo> entry = entitys.Entry <OrderInfo>(order);
                            //将包装类对象 的状态设置为 Unchanged
                            entry.State = System.Data.Entity.EntityState.Modified;
                            entry.Property(a => a.ISHISTORY).IsModified = true;
                            entitys.SaveChanges();
                        }
                    }
                    return(true);
                }
                catch (DbEntityValidationException dbEx)
                {
                    return(false);

                    throw;
                }
            }
        }
Exemplo n.º 5
0
        public static bool UpdatePayOrder(bool inter, bool intersuccess, string orderid, string paydate, string usernum, string amount)
        {
            using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
            {
                List <OrderInfo> orderInfoList = (from a in entitys.OrderInfoes select a).Where(a => a.ORDERID == orderid).ToList();
                try
                {
                    OrderInfo oi = orderInfoList[0];
                    oi.INTERFACE   = inter;
                    oi.INTERSUCCES = intersuccess;
                    oi.PAYDATE     = paydate;
                    oi.USERNUM     = usernum;
                    oi.AMOUNT      = int.Parse(amount);
                    //将实体对象加入EF对象容器中,并获取伪包装类对象
                    DbEntityEntry <OrderInfo> entry = entitys.Entry <OrderInfo>(oi);
                    //将包装类对象 的状态设置为 Unchanged
                    entry.State = System.Data.Entity.EntityState.Modified;
                    entry.Property(a => a.INTERFACE).IsModified   = true;
                    entry.Property(a => a.INTERSUCCES).IsModified = true;
                    entry.Property(a => a.PAYDATE).IsModified     = true;
                    entry.Property(a => a.USERNUM).IsModified     = true;
                    entry.Property(a => a.AMOUNT).IsModified      = true;
                    entitys.SaveChanges();
                    return(true);
                }
                catch (DbEntityValidationException dbEx)
                {
                    return(false);

                    throw;
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Updates the poll.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="title">The title.</param>
        /// <param name="color">The color.</param>
        /// <param name="price">The price.</param>
        /// <param name="memberprice">The memberprice.</param>
        /// <param name="imgpath">The imgpath.</param>
        /// <param name="smalltitle">The smalltitle.</param>
        /// <param name="code">The code.</param>
        /// <param name="des">The DES.</param>
        /// <returns></returns>
        /// 创建人:李允智
        /// 创建时间:2015/9/14
        /// 描述:更新投票数
        public static bool UpdatePoll(Guid ID)
        {
            using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
            {
                try
                {
                    List <Model.BestCherryInfo> list = WebBLL.GetCherry(ID);
                    if (list.Count != 0)
                    {
                        BestCherryInfo bci  = list[0];
                        int            poll = 0;
                        if (list[0].POLL != null)
                        {
                            poll = (int)list[0].POLL;
                        }
                        bci.POLL = poll + 1;
                        //将实体对象加入EF对象容器中,并获取伪包装类对象
                        DbEntityEntry <BestCherryInfo> entry = entitys.Entry <BestCherryInfo>(bci);
                        //将包装类对象 的状态设置为 Unchanged
                        entry.State = System.Data.Entity.EntityState.Modified;
                        entry.Property(a => a.POLL).IsModified = true;
                        entitys.SaveChanges();
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (DbEntityValidationException dbEx)
                {
                    return(false);

                    throw;
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Updates the icbc cherry information.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="title">The title.</param>
        /// <param name="color">The color.</param>
        /// <param name="price">The price.</param>
        /// <param name="memberprice">The memberprice.</param>
        /// <param name="imgpath">The imgpath.</param>
        /// <param name="smalltitle">The smalltitle.</param>
        /// <param name="code">The code.</param>
        /// <param name="des">The DES.</param>
        /// <returns></returns>
        /// 创建人:李允智
        /// 创建时间:2015/9/10
        /// 描述:更新商品信息
        public static bool UpdateICBCCherryInfo(Guid id, string title, string color, string price, string memberprice, string imgpath, string smalltitle, string code, string des)
        {
            using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
            {
                try
                {
                    BestCherryInfo bci = new BestCherryInfo();
                    bci.ID          = id;
                    bci.TITLE       = title;
                    bci.COLOR       = color;
                    bci.PRICE       = int.Parse(price);
                    bci.MEMBERPRICE = int.Parse(memberprice);
                    bci.IMAGEPATH   = imgpath;
                    bci.SMALLTITLE  = smalltitle;
                    bci.CODE        = code;
                    //将实体对象加入EF对象容器中,并获取伪包装类对象
                    DbEntityEntry <BestCherryInfo> entry = entitys.Entry <BestCherryInfo>(bci);
                    //将包装类对象 的状态设置为 Unchanged
                    entry.State = System.Data.Entity.EntityState.Modified;
                    entry.Property(a => a.TITLE).IsModified       = true;
                    entry.Property(a => a.CODE).IsModified        = true;
                    entry.Property(a => a.COLOR).IsModified       = true;
                    entry.Property(a => a.PRICE).IsModified       = true;
                    entry.Property(a => a.MEMBERPRICE).IsModified = true;
                    entry.Property(a => a.IMAGEPATH).IsModified   = true;
                    entry.Property(a => a.SMALLTITLE).IsModified  = true;
                    entitys.SaveChanges();
                    return(true);
                }
                catch (Exception)
                {
                    return(false);

                    throw;
                }
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Updates the poll.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="title">The title.</param>
 /// <param name="color">The color.</param>
 /// <param name="price">The price.</param>
 /// <param name="memberprice">The memberprice.</param>
 /// <param name="imgpath">The imgpath.</param>
 /// <param name="smalltitle">The smalltitle.</param>
 /// <param name="code">The code.</param>
 /// <param name="des">The DES.</param>
 /// <returns></returns>
 /// 创建人:李允智
 /// 创建时间:2015/9/14
 /// 描述:更新投票数
 public static bool UpdatePoll(Guid ID)
 {
     using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
     {
         try
         {
             List<Model.BestCherryInfo> list = WebBLL.GetCherry(ID);
             if (list.Count != 0)
             {
                 BestCherryInfo bci = list[0];
                 int poll = 0;
                 if (list[0].POLL != null)
                 {
                     poll = (int)list[0].POLL;
                 }
                 bci.POLL = poll + 1;
                 //将实体对象加入EF对象容器中,并获取伪包装类对象
                 DbEntityEntry<BestCherryInfo> entry = entitys.Entry<BestCherryInfo>(bci);
                 //将包装类对象 的状态设置为 Unchanged
                 entry.State = System.Data.Entity.EntityState.Modified;
                 entry.Property(a => a.POLL).IsModified = true;
                 entitys.SaveChanges();
                 return true;
             }
             else
             {
                 return false;
             }
         }
         catch (DbEntityValidationException dbEx)
         {
             return false;
             throw;
         }
     }
 }
Exemplo n.º 9
0
 public static bool UpdatePayOrder(bool inter, bool intersuccess, string orderid, string paydate, string usernum, string amount)
 {
     using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
     {
         List<OrderInfo> orderInfoList = (from a in entitys.OrderInfoes select a).Where(a => a.ORDERID == orderid).ToList();
         try
         {
             OrderInfo oi = orderInfoList[0];
             oi.INTERFACE = inter;
             oi.INTERSUCCES = intersuccess;
             oi.PAYDATE = paydate;
             oi.USERNUM = usernum;
             oi.AMOUNT = int.Parse(amount);
             //将实体对象加入EF对象容器中,并获取伪包装类对象
             DbEntityEntry<OrderInfo> entry = entitys.Entry<OrderInfo>(oi);
             //将包装类对象 的状态设置为 Unchanged
             entry.State = System.Data.Entity.EntityState.Modified;
             entry.Property(a => a.INTERFACE).IsModified = true;
             entry.Property(a => a.INTERSUCCES).IsModified = true;
             entry.Property(a => a.PAYDATE).IsModified = true;
             entry.Property(a => a.USERNUM).IsModified = true;
             entry.Property(a => a.AMOUNT).IsModified = true;
             entitys.SaveChanges();
             return true;
         }
         catch (DbEntityValidationException dbEx)
         {
             return false;
             throw;
         }
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Updates the logistics.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="logistics">The logistics.</param>
 /// <returns></returns>
 /// 创建人:李允智
 /// 创建时间:2015/9/23
 /// 描述:更新物流单号
 public static bool UpdateLogistics(Guid id,string logistics)
 {
     using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
     {
         List<OrderInfo> orderInfoList = (from a in entitys.OrderInfoes select a).Where(a => a.ID == id).ToList();
         try
         {
             OrderInfo oi = orderInfoList[0];
             oi.LOGISTICS = logistics;
             oi.ISPRINTED = true;
             //将实体对象加入EF对象容器中,并获取伪包装类对象
             DbEntityEntry<OrderInfo> entry = entitys.Entry<OrderInfo>(oi);
             //将包装类对象 的状态设置为 Unchanged
             entry.State = System.Data.Entity.EntityState.Modified;
             entry.Property(a => a.LOGISTICS).IsModified = true;
             entry.Property(a => a.ISPRINTED).IsModified = true;
             entitys.SaveChanges();
             return true;
         }
         catch (DbEntityValidationException dbEx)
         {
             return false;
             throw;
         }
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// Updates the icbc cherry information.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="title">The title.</param>
 /// <param name="color">The color.</param>
 /// <param name="price">The price.</param>
 /// <param name="memberprice">The memberprice.</param>
 /// <param name="imgpath">The imgpath.</param>
 /// <param name="smalltitle">The smalltitle.</param>
 /// <param name="code">The code.</param>
 /// <param name="des">The DES.</param>
 /// <returns></returns>
 /// 创建人:李允智
 /// 创建时间:2015/9/10
 /// 描述:更新商品信息
 public static bool UpdateICBCCherryInfo(Guid id, string title, string color, string price, string memberprice, string imgpath, string smalltitle, string code, string des)
 {
     using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
     {
         try
         {
             BestCherryInfo bci = new BestCherryInfo();
             bci.ID = id;
             bci.TITLE = title;
             bci.COLOR = color;
             bci.PRICE = int.Parse(price);
             bci.MEMBERPRICE = int.Parse(memberprice);
             bci.IMAGEPATH = imgpath;
             bci.SMALLTITLE = smalltitle;
             bci.CODE = code;
             //将实体对象加入EF对象容器中,并获取伪包装类对象
             DbEntityEntry<BestCherryInfo> entry = entitys.Entry<BestCherryInfo>(bci);
             //将包装类对象 的状态设置为 Unchanged
             entry.State = System.Data.Entity.EntityState.Modified;
             entry.Property(a => a.TITLE).IsModified = true;
             entry.Property(a => a.CODE).IsModified = true;
             entry.Property(a => a.COLOR).IsModified = true;
             entry.Property(a => a.PRICE).IsModified = true;
             entry.Property(a => a.MEMBERPRICE).IsModified = true;
             entry.Property(a => a.IMAGEPATH).IsModified = true;
             entry.Property(a => a.SMALLTITLE).IsModified = true;
             entitys.SaveChanges();
             return true;
         }
         catch (Exception)
         {
             return false;
             throw;
         }
     }
 }
Exemplo n.º 12
0
 public static bool UpdateActivityPro(Guid id, string buytime, string num, string imagepath, string desimgpath)
 {
     using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
     {
         try
         {
             List<ActivityPro> list = entitys.ActivityProes.Where(a => a.ID == id).ToList();
             if (list.Count>0)
             {
                 ActivityPro att = list[0];
                 att.BUYTIME = buytime;
                 att.NUM = int.Parse(num);
                 att.IMAGEPATH = imagepath;
                 att.DESIMGPATH = desimgpath;
                 //将实体对象加入EF对象容器中,并获取伪包装类对象
                 DbEntityEntry<ActivityPro> entry = entitys.Entry<ActivityPro>(att);
                 entry.State = System.Data.Entity.EntityState.Modified;
                 entitys.SaveChanges();
             }
             return true;
         }
         catch (Exception)
         {
             return false;
             throw;
         }
     }
 }
Exemplo n.º 13
0
 /// <summary>
 /// Updates the activity.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="buytime">The buytime.</param>
 /// <param name="num">The number.</param>
 /// <param name="type">The type.</param>
 /// <param name="code">The code.</param>
 /// <returns></returns>
 /// 创建人:李允智
 /// 创建时间:2015/9/10
 /// 描述:编辑活动
 public static bool UpdateActivity(Guid id, string name, string type, string code)
 {
     using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
     {
         try
         {
             Activity att = new Activity();
             att.NAME = name;
             att.TYPE = int.Parse(type);
             att.CODE = code;
             att.ID = id;
             //将实体对象加入EF对象容器中,并获取伪包装类对象
             DbEntityEntry<Activity> entry = entitys.Entry<Activity>(att);
             //将包装类对象 的状态设置为 Unchanged
             entry.State = System.Data.Entity.EntityState.Modified;
             entry.Property(a => a.NAME).IsModified = true;
             entry.Property(a => a.TYPE).IsModified = true;
             entry.Property(a => a.CODE).IsModified = true;
             entitys.SaveChanges();
             return true;
         }
         catch (Exception)
         {
             return false;
             throw;
         }
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// Resets the activity.
 /// </summary>
 /// <param name="ID">The identifier.</param>
 /// <returns></returns>
 /// 创建人:李允智
 /// 创建时间:2015/9/16
 /// 描述:重置活动 开启新的抢购
 public static bool ResetActivity(Guid ID)
 {
     using (Model.BestCherryEntities entitys = new Model.BestCherryEntities())
     {
         try
         {
             List<Model.OrderInfo> orderList = (from a in entitys.OrderInfoes select a).Where(a => a.ACTIVITYID == ID).ToList();
             if (orderList.Count != 0)
             {
                 foreach (Model.OrderInfo item in orderList)
                 {
                     OrderInfo order = item;
                     order.ISHISTORY = true;
                     //将实体对象加入EF对象容器中,并获取伪包装类对象
                     DbEntityEntry<OrderInfo> entry = entitys.Entry<OrderInfo>(order);
                     //将包装类对象 的状态设置为 Unchanged
                     entry.State = System.Data.Entity.EntityState.Modified;
                     entry.Property(a => a.ISHISTORY).IsModified = true;
                     entitys.SaveChanges();
                 }
             }
             return true;
         }
         catch (DbEntityValidationException dbEx)
         {
             return false;
             throw;
         }
     }
 }