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; } } }
/// <summary> /// Inserts the activity pro. /// </summary> /// <param name="activityID">The activity identifier.</param> /// <param name="procode">The procode.</param> /// <param name="proid">The proid.</param> /// <param name="buytime">The buytime.</param> /// <param name="num">The number.</param> /// <param name="imagepath">The imagepath.</param> /// <returns></returns> /// 创建人:李允智 /// 创建时间:2015/9/11 /// 描述:插入活动商品 public static bool InsertActivityPro(Guid activityID, string procode, Guid proid, string buytime, string num, string imagepath, string desimgpath) { using (Model.BestCherryEntities entitys = new Model.BestCherryEntities()) { try { ActivityPro att = new ActivityPro(); att.ID = Guid.NewGuid(); att.ACTIVITYID = activityID; att.PROCODE = procode; att.PROID = proid; att.BUYTIME = buytime; att.NUM = int.Parse(num); att.IMAGEPATH = imagepath; att.DESIMGPATH = desimgpath; entitys.ActivityProes.Add(att); entitys.SaveChanges(); return(true); } catch (Exception) { return(false); throw; } } }
/// <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; } } }
/// <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; } } }
/// <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; } } }
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; } } }
/// <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; } } }
/// <summary> /// Deletes the activity. /// </summary> /// <param name="ID">The identifier.</param> /// <returns></returns> /// 创建人:李允智 /// 创建时间:2015/9/16 /// 描述:根据ID删除活动 public static bool DelActivity(Guid ID) { using (Model.BestCherryEntities entitys = new Model.BestCherryEntities()) { List<Activity> activityList = (from a in entitys.Activities select a).Where(a => a.ID == ID).ToList(); try { if (activityList.Count >= 1) { Activity deleteActivity = activityList[0]; entitys.Activities.Attach(deleteActivity); entitys.Activities.Remove(deleteActivity); entitys.SaveChanges(); } return true; } catch (Exception) { return false; throw; } } }
/// <summary> /// Inserts 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 InsertActivity(string name, string type, string code) { using (Model.BestCherryEntities entitys = new Model.BestCherryEntities()) { try { Activity att = new Activity(); att.ID = Guid.NewGuid(); att.NAME = name; att.TYPE = int.Parse(type); att.CODE = code; entitys.Activities.Add(att); entitys.SaveChanges(); return(true); } catch (Exception) { return(false); throw; } } }
/// <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; } } }
/// <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; } } }
/// <summary> /// Inserts the order. /// </summary> /// <param name="consignee">The consignee.</param> /// <param name="membernum">The membernum.</param> /// <param name="mobile">The mobile.</param> /// <param name="receiver_state">The receiver_state.</param> /// <param name="receiver_city">The receiver_city.</param> /// <param name="receiver_district">The receiver_district.</param> /// <param name="address">The address.</param> /// <param name="orderlist">The orderlist.</param> /// <param name="orderid">The orderid.</param> /// <param name="allPrice">All price.</param> /// <returns></returns> /// 创建人:李允智 /// 创建时间:2015/9/10 /// 描述:提交订单信息 public static bool InsertOrder(string consignee, string membernum, string mobile, string receiver_state, string receiver_city, string receiver_district, string address, string orderlist, string orderid, string allPrice, int type, Guid activityid, string remark) { using (Model.BestCherryEntities entitys = new Model.BestCherryEntities()) { try { OrderInfo oi = new OrderInfo(); oi.ID = Guid.NewGuid(); oi.SENDORDERTIME = DateTime.Now; oi.CONSIGNEE = consignee; oi.MOBILE = mobile; oi.MEMBERNUM = membernum; oi.RECEIVER_STATE = receiver_state; oi.RECEIVER_CITY = receiver_city; oi.RECEIVER_DISTRICT = receiver_district; oi.ADDRESS = address; oi.ORDERLIST = orderlist; oi.INTERFACE = false; oi.INTERSUCCES = false; oi.ORDERID = orderid; oi.ALLPRICE = int.Parse(allPrice); oi.TYPE = type; oi.ACTIVITYID = activityid; oi.ISHISTORY = false; oi.REMARK = remark; entitys.OrderInfoes.Add(oi); entitys.SaveChanges(); return(true); } catch (DbEntityValidationException dbEx) { return(false); throw; } } }
/// <summary> /// Deletes the activity pro. /// </summary> /// <param name="ID">The identifier.</param> /// <returns></returns> /// 创建人:李允智 /// 创建时间:2015/9/14 /// 描述:删除活动商品 public static bool DeleteActivityPro(Guid ID) { using (Model.BestCherryEntities entitys = new Model.BestCherryEntities()) { List <ActivityPro> activityProList = (from a in entitys.ActivityProes select a).Where(a => a.ID == ID).ToList(); try { if (activityProList.Count >= 1) { ActivityPro deleteActivityProes = activityProList[0]; entitys.ActivityProes.Attach(deleteActivityProes); entitys.ActivityProes.Remove(deleteActivityProes); entitys.SaveChanges(); } return(true); } catch (Exception) { return(false); throw; } } }
/// <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; } } }
/// <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; } } }
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; } } }
/// <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; } } }
/// <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; } } }
/// <summary> /// Inserts the order. /// </summary> /// <param name="consignee">The consignee.</param> /// <param name="membernum">The membernum.</param> /// <param name="mobile">The mobile.</param> /// <param name="receiver_state">The receiver_state.</param> /// <param name="receiver_city">The receiver_city.</param> /// <param name="receiver_district">The receiver_district.</param> /// <param name="address">The address.</param> /// <param name="orderlist">The orderlist.</param> /// <param name="orderid">The orderid.</param> /// <param name="allPrice">All price.</param> /// <returns></returns> /// 创建人:李允智 /// 创建时间:2015/9/10 /// 描述:提交订单信息 public static bool InsertOrder(string consignee, string membernum, string mobile, string receiver_state, string receiver_city, string receiver_district, string address, string orderlist, string orderid, string allPrice, int type, Guid activityid,string remark) { using (Model.BestCherryEntities entitys = new Model.BestCherryEntities()) { try { OrderInfo oi = new OrderInfo(); oi.ID = Guid.NewGuid(); oi.SENDORDERTIME = DateTime.Now; oi.CONSIGNEE = consignee; oi.MOBILE = mobile; oi.MEMBERNUM = membernum; oi.RECEIVER_STATE = receiver_state; oi.RECEIVER_CITY = receiver_city; oi.RECEIVER_DISTRICT = receiver_district; oi.ADDRESS = address; oi.ORDERLIST = orderlist; oi.INTERFACE = false; oi.INTERSUCCES = false; oi.ORDERID = orderid; oi.ALLPRICE = int.Parse(allPrice); oi.TYPE = type; oi.ACTIVITYID = activityid; oi.ISHISTORY = false; oi.REMARK = remark; entitys.OrderInfoes.Add(oi); entitys.SaveChanges(); return true; } catch (DbEntityValidationException dbEx) { return false; throw; } } }
/// <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; } } }
/// <summary> /// Inserts the activity pro. /// </summary> /// <param name="activityID">The activity identifier.</param> /// <param name="procode">The procode.</param> /// <param name="proid">The proid.</param> /// <param name="buytime">The buytime.</param> /// <param name="num">The number.</param> /// <param name="imagepath">The imagepath.</param> /// <returns></returns> /// 创建人:李允智 /// 创建时间:2015/9/11 /// 描述:插入活动商品 public static bool InsertActivityPro(Guid activityID, string procode, Guid proid, string buytime, string num, string imagepath,string desimgpath) { using (Model.BestCherryEntities entitys = new Model.BestCherryEntities()) { try { ActivityPro att = new ActivityPro(); att.ID = Guid.NewGuid(); att.ACTIVITYID = activityID; att.PROCODE = procode; att.PROID = proid; att.BUYTIME = buytime; att.NUM = int.Parse(num); att.IMAGEPATH = imagepath; att.DESIMGPATH = desimgpath; entitys.ActivityProes.Add(att); entitys.SaveChanges(); return true; } catch (Exception) { return false; throw; } } }
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; } } }
/// <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; } } }
/// <summary> /// Inserts 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 InsertActivity(string name, string type, string code) { using (Model.BestCherryEntities entitys = new Model.BestCherryEntities()) { try { Activity att = new Activity(); att.ID = Guid.NewGuid(); att.NAME = name; att.TYPE = int.Parse(type); att.CODE = code; entitys.Activities.Add(att); entitys.SaveChanges(); return true; } catch (Exception) { return false; throw; } } }