public bool UpdateInactive(int customerId, int?updatedBy)
        {
            var ActiveCustomer = FindCustomerById(customerId);

            if (ActiveCustomer.IsNull())
            {
                return(false);
            }

            this.customer = new Customer()
            {
                CustomerID   = customerId,
                CustomerCode = ActiveCustomer.CustomerCode,
                FirstName    = ActiveCustomer.FirstName,
                LastName     = ActiveCustomer.LastName,
                MiddleName   = ActiveCustomer.MiddleName,
                Extension    = ActiveCustomer.Extension,
                BirthDate    = ActiveCustomer.BirthDate,
                Address      = ActiveCustomer.Address,
                City         = ActiveCustomer.City,
                Region       = ActiveCustomer.Region,
                ZipCode      = ActiveCustomer.ZipCode,
                IsActive     = ActiveCustomer.IsActive ? false : true,
                UpdatedBy    = updatedBy,
                DateUpdated  = System.DateTime.Now
            };

            if (this._customer.Update(this.customer, c => c.CustomerID == customerId).IsNull())
            {
                return(false);
            }


            return(true);
        }
        public bool SaveCustomer(CustomerDto customerDetails)
        {
            this.customer = customerDetails.DtoToEntity();

            if (this._customer.Insert(this.customer).IsNull())
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public static IOBalanceEntity.Customer DtoToEntity(this CustomerDto dto)
        {
            IOBalanceEntity.Customer entity = null;

            if (!dto.IsNull())
            {
                entity = new IOBalanceEntity.Customer
                {
                    CustomerCode = dto.CustomerCode.Trim(),
                    FirstName    = dto.FirstName.Trim(),
                    LastName     = dto.LastName.Trim(),
                    MiddleName   = dto.MiddleName,
                    Extension    = dto.Extension,
                    BirthDate    = dto.BirthDate,
                    Address      = dto.Address,
                    City         = dto.City,
                    Region       = dto.Region,
                    ZipCode      = dto.ZipCode,
                    IsActive     = true
                };
            }

            return(entity);
        }
 public CustomerService(IIOBalanceRepository <Customer> customer)
 {
     this._customer = customer;
     this.customer  = new IOBalanceEntity.Customer();
 }