コード例 #1
0
        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));
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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)));
        }
コード例 #4
0
 public List <PromProductDTO> GetListDTOsPromProduct()
 {
     using (var db = new PromDAO(_context))
         return(LsObjectMapperTo <Promotion, PromProductDTO>(db.GetListProduct()));
 }