public UserProfileDTO Update(UserProfileDTO newModel, string key, string IV)
        {
            try
            {
                var currentModel = GetByID(newModel.UserID);

                if (!string.IsNullOrEmpty(newModel.Password) && !string.IsNullOrWhiteSpace(newModel.Password))
                {
                    newModel.EncryptedPassword = CryptoService.Encrypt(newModel.Password, key, IV);
                }

                else
                {
                    newModel.EncryptedPassword = currentModel.EncryptedPassword;
                }

                if (newModel.UserRoleTypeID != currentModel.UserRoleTypeID)
                {
                    SetupUserClaims(newModel.UserID, newModel.UserRoleTypeID);
                }

                var returnModel = UOW.UserRepo.Update(newModel);
                UOW.SaveChanges();
                return(returnModel);
            }
            catch (Exception ex)
            {
                UOW.RollbackChanges();
                throw ex;
            }
        }
 public bool RemoveCustomerLogin(CustomerLoginDTO removeEntity)
 {
     try
     {
         bool success = UOW.UserRepo.RemoveCustomerLogin(removeEntity);
         UOW.SaveChanges();
         return(success);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public bool AddSupplierLogin(SupplierLoginDTO newEntity)
 {
     try
     {
         bool success = UOW.UserRepo.AddSupplierLogin(newEntity);
         UOW.SaveChanges();
         return(success);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public BasicSiteConfigDTO UpdateSiteConfig(BasicSiteConfigDTO newPage)
 {
     try
     {
         var returnModel = UOW.ContentRepo.UpdateSiteConfig(newPage);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public LandingPageDTO UpdateLandingPage(LandingPageDTO newPage)
 {
     try
     {
         var returnModel = UOW.ContentRepo.UpdateLandingPage(newPage);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public IEnumerable <InvoiceItemDTO> InvoiceOrder(int orderID)
 {
     try
     {
         int newInvID = UOW.InvoiceRepo.InvoiceOrder(orderID);
         UOW.SaveChanges();
         return(UOW.InvoiceRepo.GetByID(newInvID));;
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public AddressDTO Update(AddressDTO newModel)
 {
     try
     {
         AddressDTO returnModel = UOW.AddressRepo.Update(newModel);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public IEnumerable <DeliveryNoteItemDTO> DeliverOrder(int orderID)
 {
     try
     {
         int newNoteID = UOW.DeliveryNoteRepo.DeliverOrder(orderID);
         UOW.SaveChanges();
         return(UOW.DeliveryNoteRepo.GetByID(newNoteID));
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public OrderItemDTO AddItemToOrder(CreateOrderItemDTO entityToCreate)
 {
     try
     {
         var orderItemID = UOW.OrderRepo.AddItemToOrder(entityToCreate);
         UOW.SaveChanges();
         return(UOW.OrderRepo.GetOrderItemByID(orderItemID));
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public OrderDetailedDTO Update(UpdatedOrderDTO updatedRecord)
 {
     try
     {
         var updateResult = UOW.OrderRepo.Update(updatedRecord);
         UOW.SaveChanges();
         return(GetByID(updateResult.OrderID));
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public ItemDTO Update(ItemDTO newModel)
 {
     try
     {
         ItemDTO returnModel = UOW.ItemRepo.Update(newModel);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public RMAItemDTO UpdateRMAItem(UpdateRMAItemDTO updatedRecord)
 {
     try
     {
         var returnModel = UOW.RMARepo.UpdateRMAItem(updatedRecord);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public OrderItemDTO UpdateOrderItem(UpdateOrderItemDTO updatedRecord)
 {
     try
     {
         OrderItemDTO returnModel = UOW.OrderRepo.UpdateOrderItem(updatedRecord);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public bool Delete(int rmaID)
 {
     try
     {
         bool result = UOW.RMARepo.Delete(rmaID);
         UOW.SaveChanges();
         return(result);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public RMAItemDTO AddItemToRMA(CreateRMAItemDTO entityToCreate)
 {
     try
     {
         var rmaItemID = UOW.RMARepo.AddItemToRMA(entityToCreate);
         UOW.SaveChanges();
         return(UOW.RMARepo.GetRMAItemByID(rmaItemID));
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public bool RemoveItemFromRMA(int rmaItemID)
 {
     try
     {
         var result = UOW.RMARepo.RemoveItemFromRMA(rmaItemID);
         UOW.SaveChanges();
         return(result);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public RMADetailedDTO Create(CreateRMADTO entityToCreate)
 {
     try
     {
         int newRMAID = UOW.RMARepo.Create(entityToCreate);
         UOW.SaveChanges();
         return(GetByID(newRMAID));
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
Exemple #18
0
 public ProductGroupDTO Update(ProductGroupDTO newModel)
 {
     try
     {
         ProductGroupDTO returnModel = UOW.ProductGroupRepo.Update(newModel);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
Exemple #19
0
 public bool Delete(int id)
 {
     try
     {
         bool success = UOW.ProductGroupRepo.Delete(id);
         UOW.SaveChanges();
         return(success);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public CustomerDTO Update(CustomerDTO newModel)
 {
     try
     {
         var returnModel = UOW.CustomerRepo.Update(newModel);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public IEnumerable <CreditNoteItemDTO> CreditRMA(int rmaID)
 {
     try
     {
         int newCreditNoteID = UOW.CreditNoteRepo.CreditRMA(rmaID);
         UOW.SaveChanges();
         return(UOW.CreditNoteRepo.GetByID(newCreditNoteID));
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public CountryDTO Update(CountryDTO newModel)
 {
     try
     {
         CountryDTO returnModel = UOW.CountryRepo.Update(newModel);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public bool UpdateImage(int id, string imageName)
 {
     try
     {
         bool success = UOW.ItemRepo.UpdateImageNane(id, imageName);
         UOW.SaveChanges();
         return(success);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public bool RemoveItemFromOrder(int orderItemID)
 {
     try
     {
         var result = UOW.OrderRepo.RemoveItemFromOrder(orderItemID);
         UOW.SaveChanges();
         return(result);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
Exemple #25
0
 public IEnumerable <ReturnNoteItemDTO> ProcessReturn(int rmaID)
 {
     try
     {
         int newReturnNoteID = UOW.ReturnNoteRepo.ProcessReturn(rmaID);
         UOW.SaveChanges();
         return(UOW.ReturnNoteRepo.GetByID(newReturnNoteID));
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
Exemple #26
0
 public ProductGroupDTO Create(ProductGroupCreateDTO modelToCreate)
 {
     try
     {
         int newID        = UOW.ProductGroupRepo.Create(modelToCreate);
         var createResult = UOW.ProductGroupRepo.GetByID(newID);
         UOW.SaveChanges();
         return(createResult);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public CustomerDTO Create(CustomerCreateDTO modelToCreate)
 {
     try
     {
         int newID        = UOW.CustomerRepo.Create(modelToCreate);
         var createResult = UOW.CustomerRepo.GetByID(newID);
         UOW.SaveChanges();
         return(createResult);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
 public UserProfileDTO Create(UserCreateDTO modelToCreate, string key, string IV)
 {
     try
     {
         string encryptedPassword = CryptoService.Encrypt(modelToCreate.Password, key, IV);
         int    newID             = UOW.UserRepo.Create(modelToCreate, encryptedPassword);
         var    createResult      = UOW.UserRepo.GetByID(newID);
         SetupUserClaims(createResult.UserID, createResult.UserRoleTypeID);
         UOW.SaveChanges();
         return(createResult);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }