Ejemplo n.º 1
0
 public DiscountService(IIOBalanceRepository <Discount> discount,
                        IUserService userService)
 {
     this._discount    = discount;
     this._userService = userService;
     this.discount     = new Discount();
 }
Ejemplo n.º 2
0
        public bool SaveDiscount(DiscountDto discountDetails)
        {
            this.discount = discountDetails.DtoToEntity();

            if (this._discount.Insert(this.discount).IsNull())
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        public bool UpdateDiscount(DiscountDto discountDetails)
        {
            var oldDiscountDetails     = FindDiscountById(discountDetails.DiscountID);
            var updatedDiscountDetails = new IOBalanceEntity.Discount()
            {
                BranchID           = discountDetails.BranchID,
                CreatedBy          = oldDiscountDetails.CreatedBy,
                DateCreated        = oldDiscountDetails.DateCreated,
                UpdatedBy          = discountDetails.UpdatedBy,
                DateUpdated        = System.DateTime.Now,
                DiscountID         = oldDiscountDetails.DiscountID,
                DiscountPercentage = discountDetails.DiscountPercentage,
                IsActive           = oldDiscountDetails.IsActive
            };

            if (_discount.Update2(updatedDiscountDetails).IsNull())
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
        public static IOBalanceEntity.Discount DtoToEntity(this DiscountDto dto)
        {
            IOBalanceEntity.Discount entity = null;

            if (!dto.IsNull())
            {
                entity = new IOBalanceEntity.Discount()
                {
                    DiscountID         = 0,
                    DiscountPercentage = dto.DiscountPercentage,
                    BranchID           = dto.BranchID,
                    CreatedBy          = dto.CreatedBy,
                    DateCreated        = System.DateTime.Now,
                    UpdatedBy          = dto.UpdatedBy,
                    DateUpdated        = dto.DateUpdated,
                    IsActive           = true
                };
            }


            return(entity);
        }