示例#1
0
        public bool UpdateInactive(int supplierId, int?updatedBy)
        {
            var ActiveSupplier = FindSupplierById(supplierId);

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

            this.supplier = new Supplier()
            {
                SupplierID   = supplierId,
                SupplierCode = ActiveSupplier.SupplierCode,
                SupplierName = ActiveSupplier.SupplierName,
                IsActive     = ActiveSupplier.IsActive ? false : true,
                DateCreated  = ActiveSupplier.DateCreated,
                CreatedBy    = ActiveSupplier.CreatedBy,
                UpdatedBy    = updatedBy,
                DateUpdated  = System.DateTime.Now
            };


            if (this._supplier.Update(this.supplier, s => s.SupplierID == supplierId).IsNull())
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        public bool SaveSupplier(SupplierDto supplierDetails)
        {
            this.supplier = supplierDetails.DtoToEntity();

            if (this._supplier.Insert(this.supplier).IsNull())
            {
                return(false);
            }

            return(true);
        }
        public static IOBalanceEntity.Supplier DtoToEntity(this SupplierDto dto)
        {
            IOBalanceEntity.Supplier entity = null;

            if (!dto.IsNull())
            {
                entity = new IOBalanceEntity.Supplier()
                {
                    SupplierName = dto.SupplierName,
                    SupplierCode = dto.SupplierCode,
                    IsActive     = true,
                    CreatedBy    = dto.CreatedBy,
                    DateCreated  = System.DateTime.Now,
                    DateUpdated  = dto.DateUpdated,
                    UpdatedBy    = dto.UpdatedBy
                };
            }

            return(entity);
        }
示例#4
0
 public SupplierService(IIOBalanceRepository <Supplier> supplier)
 {
     _supplier     = supplier;
     this.supplier = new IOBalanceEntity.Supplier();
 }