Exemple #1
0
        /// <summary>
        /// Updates the type of the icbc cherry information and.
        /// </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 InsertICBCCherryInfo(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          = Guid.NewGuid();
                    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;
                    entitys.BestCherryInfoes.Add(bci);
                    entitys.SaveChanges();
                    return(true);
                }
                catch (Exception)
                {
                    return(false);

                    throw;
                }
            }
        }
Exemple #2
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;
                }
            }
        }
Exemple #3
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;
                }
            }
        }