public BargainDish CreateBargainDish(BargainDishBean bean)
        {
            BargainDish beanBack = new BargainDish();

            beanBack.Id           = bean.Id;
            beanBack.DishId       = bean.DishId;
            beanBack.StartTime    = bean.StartTime;
            beanBack.EndTime      = bean.EndTime;
            beanBack.StartDate    = bean.StartDate;
            beanBack.EndDate      = bean.EndDate;
            beanBack.Week1        = bean.Week1;
            beanBack.Week2        = bean.Week2;
            beanBack.Week3        = bean.Week3;
            beanBack.Week4        = bean.Week4;
            beanBack.Week5        = bean.Week5;
            beanBack.Week6        = bean.Week6;
            beanBack.Week0        = bean.Week0;
            beanBack.MarketTypeId = bean.MarketTypeId;
            beanBack.Enable       = bean.Enable;
            beanBack.CreateBy     = bean.CreateBy;
            beanBack.CreateTime   = DateTime.Now;
            beanBack.Update_by    = bean.UpdateBy;
            beanBack.UpdateTime   = bean.UpdateDatetime;
            beanBack.Deleted      = bean.Deleted;
            return(beanBack);
        }
        public BargainDishPrice CreateBargainDishPrice(BargainDishBean bean)
        {
            BargainDishPrice beanBack = new BargainDishPrice();

            beanBack.Id                = bean.BargainDishPrice == null ? 0 : bean.BargainDishPrice.Count == 0 ? 0 : bean.BargainDishPrice.First().Id;
            beanBack.BargainDishId     = bean.Id;
            beanBack.Price1            = bean.Price1;
            beanBack.Price2            = bean.Price2;
            beanBack.Price3            = bean.Price3;
            beanBack.MemberPrice3      = bean.MemberPrice3;
            beanBack.MemberPrice2      = bean.MemberPrice2;
            beanBack.MemberPrice1      = bean.MemberPrice1;
            beanBack.DishSpecification = bean.DishFormat;
            beanBack.CreateBy          = bean.CreateBy;
            beanBack.CreateTime        = DateTime.Now;
            beanBack.Update_by         = bean.UpdateBy;
            beanBack.UpdateTime        = bean.UpdateDatetime;
            beanBack.Deleted           = bean.Deleted;
            return(beanBack);
        }
        public BargainDishPrice CreateBargainDishPrice(BargainDishBean bean)
        {
            BargainDishPrice beanBack = new BargainDishPrice();
            beanBack.Id = bean.BargainDishPrice == null ? 0 : bean.BargainDishPrice.Count == 0 ? 0 : bean.BargainDishPrice.First().Id;
            beanBack.BargainDishId = bean.Id;
            beanBack.Price1 = bean.Price1;
            beanBack.Price2 = bean.Price2;
            beanBack.Price3 = bean.Price3;
            beanBack.MemberPrice3 = bean.MemberPrice3;
            beanBack.MemberPrice2 = bean.MemberPrice2;
            beanBack.MemberPrice1 = bean.MemberPrice1;
            beanBack.DishSpecification = bean.DishFormat;
            beanBack.CreateBy = bean.CreateBy;
            beanBack.CreateTime = DateTime.Now;
            beanBack.Update_by = bean.UpdateBy;
            beanBack.UpdateTime = bean.UpdateDatetime;
            beanBack.Deleted = bean.Deleted;
            return beanBack;

        }
        public BargainDish CreateBargainDish(BargainDishBean bean)
        {
            BargainDish beanBack = new BargainDish();
            beanBack.Id = bean.Id;
            beanBack.DishId = bean.DishId;
            beanBack.StartTime = bean.StartTime;
            beanBack.EndTime = bean.EndTime;
            beanBack.StartDate = bean.StartDate;
            beanBack.EndDate = bean.EndDate;
            beanBack.Week1 = bean.Week1;
            beanBack.Week2 = bean.Week2;
            beanBack.Week3 = bean.Week3;
            beanBack.Week4 = bean.Week4;
            beanBack.Week5 = bean.Week5;
            beanBack.Week6 = bean.Week6;
            beanBack.Week0 = bean.Week0;
            beanBack.MarketTypeId = bean.MarketTypeId;
            beanBack.Enable = bean.Enable;
            beanBack.CreateBy = bean.CreateBy;
            beanBack.CreateTime = DateTime.Now;
            beanBack.Update_by = bean.UpdateBy;
            beanBack.UpdateTime = bean.UpdateDatetime;
            beanBack.Deleted = bean.Deleted;
            return beanBack;

        }
 //看是否有特价冲突
 public bool CheckBargainDish(BargainDishBean dargainDish)
 {
     if (dargainDish == null) {
         return false;
     }
     List<BargainDish>list =  _DataService.findBargainDishAllAll();
     bool flag = true;
     foreach (var element in list) {
         if (CompareType == 1) {
             if (element.Id == dargainDish.Id) {
                 continue;
             }
         }
         if (element.DishId == dargainDish.DishId && element.BargainDishPrice.First().DishSpecification.Equals(dargainDish.DishFormat))
         { 
             if ((DateTime.Compare(element.StartDate, dargainDish.StartDate) <= 0 && DateTime.Compare(element.EndDate, dargainDish.StartDate) >= 0) ||
                 (DateTime.Compare(element.StartDate, dargainDish.EndDate) <= 0 && DateTime.Compare(element.EndDate, dargainDish.EndDate) >= 0))
             {
                 if ((element.StartTime.CompareTo(dargainDish.StartTime) <= 0 && element.EndTime.CompareTo(dargainDish.StartTime) >= 0) ||
                 (element.StartTime.CompareTo(dargainDish.EndTime) <= 0 && element.EndTime.CompareTo(dargainDish.EndTime) >= 0))
                 {
                     flag = flag && false;
                 }
             }
         }
     }
     return flag;
 }