public PromotionsDishBean CreatePromotionsDishBean(PromotionsDish bean)
 {
     this.PromotionsDishId     = bean.PromotionsDishId;
     this.TradeNo              = bean.TradeNo;
     this.DishId               = bean.DishId ?? 0;
     this.MarketTypeId         = bean.MarketTypeId;
     this.DishFormat           = bean.DishFormat;
     this.Price                = bean.Price;
     this.StartTime            = bean.StartTime;
     this.EndTime              = bean.EndTime;
     this.StartDate            = bean.StartDate;
     this.EndDate              = bean.EndDate;
     this.Week_1               = bean.Week_1;
     this.Week_2               = bean.Week_2;
     this.Week_3               = bean.Week_3;
     this.Week_4               = bean.Week_4;
     this.Week_5               = bean.Week_5;
     this.Week_6               = bean.Week_6;
     this.Week_0               = bean.Week_0;
     this.Status               = bean.Status;
     this.Usering              = bean.Usering;
     this.CreateDatetime       = bean.CreateDatetime;
     this.CreateBy             = bean.CreateBy;
     this.Deleted              = bean.Deleted;
     this.UpdateDatetime       = bean.UpdateDatetime;
     this.UpdateBy             = bean.UpdateBy;
     this.Dish                 = bean.Dish;
     this.PromotionsDishDetail = bean.PromotionsDishDetail;
     return(this);
 }
        public PromotionsDish CreatePromotionsDish(PromotionsDishBean bean)
        {
            PromotionsDish beanBack = new PromotionsDish();

            beanBack.PromotionsDishId     = bean.PromotionsDishId;
            beanBack.TradeNo              = bean.TradeNo;
            beanBack.DishId               = bean.DishId;
            beanBack.MarketTypeId         = bean.MarketTypeId;
            beanBack.DishFormat           = bean.DishFormat;
            beanBack.Price                = bean.Price;
            beanBack.StartTime            = bean.StartTime;
            beanBack.EndTime              = bean.EndTime;
            beanBack.StartDate            = bean.StartDate;
            beanBack.EndDate              = bean.EndDate;
            beanBack.Week_1               = bean.Week_1;
            beanBack.Week_2               = bean.Week_2;
            beanBack.Week_3               = bean.Week_3;
            beanBack.Week_4               = bean.Week_4;
            beanBack.Week_5               = bean.Week_5;
            beanBack.Week_6               = bean.Week_6;
            beanBack.Week_0               = bean.Week_0;
            beanBack.Status               = bean.Status;
            beanBack.Usering              = bean.Usering;
            beanBack.CreateDatetime       = bean.CreateDatetime;
            beanBack.CreateBy             = bean.CreateBy;
            beanBack.Deleted              = bean.Deleted;
            beanBack.UpdateDatetime       = bean.UpdateDatetime;
            beanBack.UpdateBy             = bean.UpdateBy;
            beanBack.Dish                 = bean.Dish;
            beanBack.PromotionsDishDetail = bean.PromotionsDishDetail;
            return(beanBack);
        }
Example #3
0
 public PromotionsDishDetailBean CreatePromotionsDishDetailBean(PromotionsDishDetail bean)
 {
     this.Id = bean.Id;
     this.PromotionsDishId = bean.PromotionsDishId;
     this.DishId           = bean.DishId;
     this.DishNumber       = bean.DishNumber;
     this.DishFormat       = bean.DishFormat;
     this.CreateDatetime   = bean.CreateDatetime;
     this.CreateBy         = bean.CreateBy;
     this.Deleted          = bean.Deleted;
     this.Status           = bean.Status;
     this.UpdateDatetime   = bean.UpdateDatetime;
     this.UpdateBy         = bean.UpdateBy;
     this.PromotionsDish   = bean.PromotionsDish;
     return(this);
 }
        public PromotionsDish CreatePromotionsDishObject(PromotionsDishDetailBean[] promotionsDishDetailBean)
        {
            PromotionsDish beanBack = CreatePromotionsDish(this);

            beanBack.Status = 1;
            beanBack.PromotionsDishDetail.Clear();
            if (promotionsDishDetailBean != null && promotionsDishDetailBean.Length > 0)
            {
                foreach (var element in promotionsDishDetailBean)
                {
                    element.CreateBy       = SubjectUtils.GetAuthenticationId();
                    element.CreateDatetime = DateTime.Now;
                    element.Status         = 1;
                    beanBack.PromotionsDishDetail.Add(element.CreatePromotionsDishDetail(element));
                }
            }

            return(beanBack);
        }
Example #5
0
        //修改菜品促销规则
        public void UpdatePromotionsDishFun()
        {
            //数据组装
            PromotionsDish PD = PromotionsDishBean.CreatePromotionsDishObject(SelectDishLists.ToArray());
            //修改数据
            bool flag = _DataService.UpdatePromotionsDish(PD);

            if (flag)
            {
                IsNotEdit = false;
                PromotionsDishBean.IsModify     = false;
                PromotionsDishSelected.IsModify = false;
                SetSelectDishesModify(SelectDishLists);
                //Init();
                MessageBox.Show("数据修改成功");
            }
            else
            {
                MessageBox.Show("数据修改失败");
            }
        }
        public bool UpdatePromotionsDish(PromotionsDish PD) {

            using (ChooseDishesEntities entities = new ChooseDishesEntities())
            {
                var type = entities.PromotionsDish.Include(bt => bt.PromotionsDishDetail).SingleOrDefault(bt => bt.Deleted == 0 && bt.PromotionsDishId == PD.PromotionsDishId );
                if (type != null)
                {
                    type.DishId = PD.DishId;
                    type.DishFormat = PD.DishFormat;
                    type.Price = PD.Price;
                    type.StartTime = PD.StartTime;
                    type.EndTime = PD.EndTime;
                    type.StartDate = PD.StartDate;
                    type.EndDate = PD.EndDate;
                    type.Week_1 = PD.Week_1;
                    type.Week_2 = PD.Week_2;
                    type.Week_3 = PD.Week_3;
                    type.Week_4 = PD.Week_4;
                    type.Week_5 = PD.Week_5;
                    type.Week_6 = PD.Week_6;
                    type.Week_0 = PD.Week_0;
                    type.Usering = PD.Usering;
                    type.UpdateBy = SubjectUtils.GetAuthenticationId();
                    type.UpdateDatetime = DateTime.Now;
                    List<PromotionsDishDetail> list = type.PromotionsDishDetail.ToList();
                    for (int i = 0; i < list.Count; i++)
                    {
                        list[i].Deleted = 1;
                        list[i].UpdateBy = SubjectUtils.GetAuthenticationId();
                        list[i].UpdateDatetime = DateTime.Now;
                    }
                    entities.SaveChanges();
                    
                    List<PromotionsDishDetail> listnew = PD.PromotionsDishDetail.ToList();
                    for (int i = 0; i < listnew.Count; i++) {
                        listnew[i].PromotionsDishId = type.PromotionsDishId;
                        listnew[i].PromotionsDish = null;
                        entities.PromotionsDishDetail.Add(listnew[i]);
                        entities.SaveChanges();
                    }
                    return true;
                }
                return false;
            }
        }
 public PromotionsDish CreateCopyPromotionsDish(PromotionsDish bean){
     PromotionsDish beanBack = new PromotionsDish();
     beanBack.TradeNo = DateTime.Now.ToString("yyyyMMddhhmmss");
     beanBack.DishId = bean.DishId;
     beanBack.MarketTypeId = bean.MarketTypeId;
     beanBack.DishFormat = bean.DishFormat;
     beanBack.Price = bean.Price;
     beanBack.StartTime = bean.StartTime;
     beanBack.EndTime = bean.EndTime;
     beanBack.StartDate = bean.StartDate;
     beanBack.EndDate = bean.EndDate;
     beanBack.Week_1 = bean.Week_1;
     beanBack.Week_2 = bean.Week_2;
     beanBack.Week_3 = bean.Week_3;
     beanBack.Week_4 = bean.Week_4;
     beanBack.Week_5 = bean.Week_5;
     beanBack.Week_6 = bean.Week_6;
     beanBack.Week_0 = bean.Week_0;
     beanBack.Status = 1;
     beanBack.Usering = 0;
     beanBack.CreateDatetime = DateTime.Now;
     beanBack.CreateBy = SubjectUtils.GetAuthenticationId();
     beanBack.Deleted = 0;
     
     return beanBack;
 }
 //新增促销条目
 public PromotionsDish SavePromotionsDish(PromotionsDish PD)
 {
     if (PD == null) {
         return null;
     }
     using (ChooseDishesEntities entities = new ChooseDishesEntities())
     {
         entities.PromotionsDish.Add(PD);
         entities.SaveChanges();
         //foreach (var elem in element.BargainDishPrice) { 
         //    elem.BargainDishId = element.Id;
         //    entities.BargainDishPrice.Add(elem);
         //    entities.SaveChanges();
         //}
         return PD;
     }
 }
        public PromotionsDishDetailBean CreatePromotionsDishDetailBean(PromotionsDishDetail bean)
        {
            this.Id = bean.Id;
            this.PromotionsDishId = bean.PromotionsDishId;
            this.DishId = bean.DishId;
            this.DishNumber = bean.DishNumber;
            this.DishFormat = bean.DishFormat;
            this.CreateDatetime = bean.CreateDatetime;
            this.CreateBy = bean.CreateBy;
            this.Deleted = bean.Deleted;
            this.Status = bean.Status;
            this.UpdateDatetime = bean.UpdateDatetime;
            this.UpdateBy = bean.UpdateBy;
            this.PromotionsDish = bean.PromotionsDish;
            return this;

        }
        public PromotionsDish CreatePromotionsDish(PromotionsDishBean bean)
        {
            PromotionsDish beanBack = new PromotionsDish();
            beanBack.PromotionsDishId = bean.PromotionsDishId;
            beanBack.TradeNo = bean.TradeNo;
            beanBack.DishId = bean.DishId;
            beanBack.MarketTypeId = bean.MarketTypeId;
            beanBack.DishFormat = bean.DishFormat;
            beanBack.Price = bean.Price;
            beanBack.StartTime = bean.StartTime;
            beanBack.EndTime = bean.EndTime;
            beanBack.StartDate = bean.StartDate;
            beanBack.EndDate = bean.EndDate;
            beanBack.Week_1 = bean.Week_1;
            beanBack.Week_2 = bean.Week_2;
            beanBack.Week_3 = bean.Week_3;
            beanBack.Week_4 = bean.Week_4;
            beanBack.Week_5 = bean.Week_5;
            beanBack.Week_6 = bean.Week_6;
            beanBack.Week_0 = bean.Week_0;
            beanBack.Status = bean.Status;
            beanBack.Usering = bean.Usering;
            beanBack.CreateDatetime = bean.CreateDatetime;
            beanBack.CreateBy = bean.CreateBy;
            beanBack.Deleted = bean.Deleted;
            beanBack.UpdateDatetime = bean.UpdateDatetime;
            beanBack.UpdateBy = bean.UpdateBy;
            beanBack.Dish = bean.Dish;
            beanBack.PromotionsDishDetail = bean.PromotionsDishDetail;
            return beanBack;

        }
        public PromotionsDishBean CreatePromotionsDishBean(PromotionsDish bean)
        {
            this.PromotionsDishId = bean.PromotionsDishId;
            this.TradeNo = bean.TradeNo;
            this.DishId = bean.DishId??0;
            this.MarketTypeId = bean.MarketTypeId;
            this.DishFormat = bean.DishFormat;
            this.Price = bean.Price;
            this.StartTime = bean.StartTime;
            this.EndTime = bean.EndTime;
            this.StartDate = bean.StartDate;
            this.EndDate = bean.EndDate;
            this.Week_1 = bean.Week_1;
            this.Week_2 = bean.Week_2;
            this.Week_3 = bean.Week_3;
            this.Week_4 = bean.Week_4;
            this.Week_5 = bean.Week_5;
            this.Week_6 = bean.Week_6;
            this.Week_0 = bean.Week_0;
            this.Status = bean.Status;
            this.Usering = bean.Usering;
            this.CreateDatetime = bean.CreateDatetime;
            this.CreateBy = bean.CreateBy;
            this.Deleted = bean.Deleted;
            this.UpdateDatetime = bean.UpdateDatetime;
            this.UpdateBy = bean.UpdateBy;
            this.Dish = bean.Dish;
            this.PromotionsDishDetail = bean.PromotionsDishDetail;
            return this;

        }