public bool ChangePromotion(int PromOld, int PromNew, string ProdId)
        {
            int detailId = DataHelper.GetDetailId(ProdId);

            using (var db = new PromDAO(_context))
                return(db.ChangePromProduct(PromOld, PromNew, detailId));
        }
        public object GetDetail(int id, byte type)
        {
            object re = null;

            using (var db = new PromDAO(_context))
                re = db.GetDetail(id, type);
            switch (type)
            {
            case 1:
                return(ObjectMapperTo <PromProduct, PromProductDTO>((PromProduct)re));

            case 2:
                return(ObjectMapperTo <PromBill, PromBillDTO>((PromBill)re));

            default:
                return(null);
            }
        }
        public PromotionDTO AddDTO(PromotionDTO promotionDTO, object promDetail)
        {
            var obj    = ObjectMapperTo <PromotionDTO, Promotion>(promotionDTO);
            var detail = CheckPromDetail(promDetail);

            if (obj == null || detail == null)
            {
                return(null);
            }
            //
            if (detail is PromProduct)
            {
                obj.PromProduct = (detail);
            }
            else if (detail is PromBill)
            {
                obj.PromBill = (detail);
            }
            // else if (detail is PromPoint) obj.PromPoint = (detail);
            //
            using (var db = new PromDAO(_context))
                return(ObjectMapperTo <Promotion, PromotionDTO>(db.Add(obj)));
        }
 public List <PromProductDTO> GetListDTOsPromProduct()
 {
     using (var db = new PromDAO(_context))
         return(LsObjectMapperTo <Promotion, PromProductDTO>(db.GetListProduct()));
 }