Ejemplo n.º 1
0
 public int CreateBoxInfor(BoxInforEntity boxInfor)
 {
     using (var scope = new TransactionScope())
     {
         Mapper.CreateMap <BoxInforEntity, BoxInfo>();
         var boxInforService = Mapper.Map <BoxInforEntity, BoxInfo>(boxInfor);
         _unitOfWork.BoxInforRepository.Insert(boxInforService);
         _unitOfWork.SaveWinform();
         scope.Complete();
         return(boxInforService.Id);
     }
 }
Ejemplo n.º 2
0
 public string Create(ShipmentOutEntity shipmentOut)
 {
     using (var scope = new TransactionScope())
     {
         Mapper.CreateMap <ShipmentOutEntity, ShipmentOutTemp>();
         var shipmentOutEntity = Mapper.Map <ShipmentOutEntity, ShipmentOutTemp>(shipmentOut);
         _unitOfWork.ShipmentOutTempRepository.Insert(shipmentOutEntity);
         _unitOfWork.SaveWinform();
         scope.Complete();
         return(shipmentOutEntity.ShipmentId);
     }
 }
Ejemplo n.º 3
0
        public int Create(List <ShipmentEntity> shipmentList)
        {
            using (var scope = new TransactionScope())
            {
                if (shipmentList.Any())
                {
                    Mapper.CreateMap <ShipmentEntity, ShipmentInforTemp>();
                    var shipmentListModel = Mapper.Map <List <ShipmentEntity>, List <ShipmentInforTemp> >(shipmentList);
                    int count             = _unitOfWork.ShipmentTempRepository.Insert(shipmentListModel);
                    _unitOfWork.SaveWinform();
                    scope.Complete();

                    return(count);
                }
            }

            return(0);
        }
        public int CreateOrUpdate(IEnumerable <ShipmentEntity> shipmentList)
        {
            int count = 0;

            if (shipmentList != null && shipmentList.Any())
            {
                using (var scope = new TransactionScope())
                {
                    Mapper.CreateMap <ShipmentEntity, ShipmentInfor>();
                    var shipmentListModel = Mapper.Map <IEnumerable <ShipmentEntity>, IEnumerable <ShipmentInfor> >(shipmentList).ToList();

                    count = _unitOfWork.ShipmentRepository.Insert(shipmentListModel);
                    _unitOfWork.SaveWinform();
                    scope.Complete(); return(count);
                }
            }
            return(0);
        }
Ejemplo n.º 5
0
 public string CreateOrUpdate(ShipmentOutEntity shipmentOut)
 {
     using (var scope = new TransactionScope())
     {
         Mapper.CreateMap <ShipmentOutEntity, ShipmentOut>();
         var ship     = Mapper.Map <ShipmentOutEntity, ShipmentOut>(shipmentOut);
         var original = _unitOfWork.ShipmentOutRepository.Get(t => t.ShipmentId == ship.ShipmentId);
         if (original != null)
         {
             ship.ShipmentId  = original.ShipmentId;
             ship.DateCreated = original.DateCreated;
             _unitOfWork.ShipmentOutRepository.Update(original, ship);
         }
         else
         {
             _unitOfWork.ShipmentOutRepository.Insert(ship);
         }
         _unitOfWork.SaveWinform();
         scope.Complete();
         return(ship.ShipmentId);
     }
 }
Ejemplo n.º 6
0
        public int CreateOrUpdate(WarehouseEntity entity)
        {
            using (var scope = new TransactionScope())
            {
                Mapper.CreateMap <WarehouseEntity, Warehouse>();
                var warehouseDataModel = Mapper.Map <WarehouseEntity, Warehouse>(entity);
                if (entity.Id > 0)
                {
                    var original = _unitOfWork.WarehouseRepository.GetByID(entity.Id);
                    _unitOfWork.WarehouseRepository.Update(original, warehouseDataModel);
                }
                else
                {
                    _unitOfWork.WarehouseRepository.Insert(warehouseDataModel);
                }

                _unitOfWork.SaveWinform();
                scope.Complete();
                return(warehouseDataModel.Id);
            }
        }
        public int CreateOrUpdateEmployee(EmployeeEntity employee)
        {
            using (var scope = new TransactionScope())
            {
                Mapper.CreateMap <EmployeeEntity, Employee>();
                var employeeModel = Mapper.Map <EmployeeEntity, Employee>(employee);

                if (employee.Id > 0)
                {
                    var original = _unitOfWork.EmployeeRepository.GetByID(employee.Id);
                    //employeeModel.Pasword = Security.Encrypt(original.Pasword);
                    _unitOfWork.EmployeeRepository.Update(original, employeeModel);
                }
                else
                {
                    _unitOfWork.EmployeeRepository.Insert(employeeModel);
                }

                _unitOfWork.SaveWinform();
                scope.Complete();
                return(employeeModel.Id);
            }
        }