/// <summary> /// Save And Update Customer Details /// </summary> /// <param name="customerDetails"></param> public int SaveAndUpdateCustomerDetails(CustomerDTO customerDetails, IList<CustomerMaterialMapDTO> listCustomerMaterial) { customer customerEntity = new customer(); using (TransactionScope transactionScope = new TransactionScope()) { AutoMapper.Mapper.Map(customerDetails, customerEntity); if (customerDetails.Cust_Id == 0) { ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>().Save(customerEntity); } else { ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>().Update(customerEntity); } if (listCustomerMaterial != null) { if (listCustomerMaterial.Count > 0) { (from customerMaterials in listCustomerMaterial select customerMaterials).Update( customerMaterials => customerMaterials.Cust_Mat_CustId = customerEntity.Cust_Id); CustomerMaterialService custMaterialService = new CustomerMaterialService(); custMaterialService.SaveAndUpdateCustomerMaterialDetails(listCustomerMaterial); } } transactionScope.Complete(); } return customerEntity.Cust_Id; }
/// <summary> /// Update customer in AmeBlock /// </summary> /// <param name="customerDetails"></param> public int UpdateCustomerAmeBlock(CustomerDTO customerDetails) { if (customerDetails != null) { customer customerEntity = new customer(); AutoMapper.Mapper.Map(customerDetails, customerEntity); ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>().Update(customerEntity); } return customerDetails.Cust_Id; }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.bookings.Contains(this)) { previousValue.bookings.Remove(this); } if (customer != null) { if (!customer.bookings.Contains(this)) { customer.bookings.Add(this); } if (Booking_Cust_Id != customer.Cust_Id) { Booking_Cust_Id = customer.Cust_Id; } } }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.truckdetails.Contains(this)) { previousValue.truckdetails.Remove(this); } if (customer != null) { if (!customer.truckdetails.Contains(this)) { customer.truckdetails.Add(this); } if (Truck_CustomerId != customer.Cust_Id) { Truck_CustomerId = customer.Cust_Id; } } }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.affidavitdetails.Contains(this)) { previousValue.affidavitdetails.Remove(this); } if (customer != null) { if (!customer.affidavitdetails.Contains(this)) { customer.affidavitdetails.Add(this); } if (Affidavit_CustID != customer.Cust_Id) { Affidavit_CustID = customer.Cust_Id; } } }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.authrepdetails.Contains(this)) { previousValue.authrepdetails.Remove(this); } if (customer != null) { if (!customer.authrepdetails.Contains(this)) { customer.authrepdetails.Add(this); } if (AuthRep_CustomerId != customer.Cust_Id) { AuthRep_CustomerId = customer.Cust_Id; } } }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.form27c_history.Contains(this)) { previousValue.form27c_history.Remove(this); } if (customer != null) { if (!customer.form27c_history.Contains(this)) { customer.form27c_history.Add(this); } if (Cust_Id != customer.Cust_Id) { Cust_Id = customer.Cust_Id; } } }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.smsregistrations.Contains(this)) { previousValue.smsregistrations.Remove(this); } if (customer != null) { if (!customer.smsregistrations.Contains(this)) { customer.smsregistrations.Add(this); } if (SMSReg_CustId != customer.Cust_Id) { SMSReg_CustId = customer.Cust_Id; } } }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.customerdocdetails.Contains(this)) { previousValue.customerdocdetails.Remove(this); } if (customer != null) { if (!customer.customerdocdetails.Contains(this)) { customer.customerdocdetails.Add(this); } if (Cust_Doc_CustId != customer.Cust_Id) { Cust_Doc_CustId = customer.Cust_Id; } } }
public void UpdateCustomerDetails(CustomerDTO customerDetails) { customer customerEntity = new customer(); AutoMapper.Mapper.Map(customerDetails, customerEntity); ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>().Update(customerEntity); }
/// <summary> /// Delete Customer by customerId /// </summary> /// <param name="customerId">Int32:customerId</param> public void DeleteCustomer(int customerId) { using (TransactionScope transactionScope = new TransactionScope()) { IList<TruckDetailsDTO> lstTruckDetails = ESalesUnityContainer.Container.Resolve<ITruckService>() .GetTruckDetailsForCustomer(customerId); (from truckDetail in lstTruckDetails select truckDetail).Update( truckDetail => truckDetail.Truck_IsDeleted = true); foreach (TruckDetailsDTO truckDetails in lstTruckDetails) { ESalesUnityContainer.Container.Resolve<ITruckService>().DeleteTruck(truckDetails); } IList<AuthRepDTO> lstAuthRepDetails = ESalesUnityContainer.Container.Resolve<IAuthRepService>() .GetAuthRepDetailsForCustomer(customerId); (from authRepDetails in lstAuthRepDetails select authRepDetails).Update( authRepDetails => authRepDetails.AuthRep_IsDeleted = true); foreach (var authRepDetails in lstAuthRepDetails) { ESalesUnityContainer.Container.Resolve<IAuthRepService>().DeleteAuthRep(authRepDetails); } IList<CustomerMaterialMapDTO> lstCustMaterialDetails = ESalesUnityContainer.Container .Resolve<ICustomerMaterialService>().GetCustomerMaterialDetailsByCustomerId(customerId); (from customerMaterials in lstCustMaterialDetails select customerMaterials).Update( customerMaterials => customerMaterials.Cust_Mat_IsDeleted = true); foreach (var customerMaterials in lstCustMaterialDetails) { CustomerMaterialService custMaterialService = new CustomerMaterialService(); custMaterialService.DeleteCustomerMaterials(customerMaterials); } CustomerDocService custDocuments = new CustomerDocService(); IList<CustomerDocDetailsDTO> lstCustDocDetails = custDocuments.GetCustomerDocumentDetails(customerId); (from customerDocs in lstCustDocDetails select customerDocs).Update( customerDocs => customerDocs.Cust_Doc_IsDeleted = true); foreach (CustomerDocDetailsDTO customerDocs in lstCustDocDetails) { DeleteCustomerDocumentDetails(customerDocs); } CustomerDTO customerDetails = GetCustomerDetailsById(customerId); customerDetails.Cust_IsDeleted = true; customer customerEntity = new customer(); AutoMapper.Mapper.Map(customerDetails, customerEntity); ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>().Update(customerEntity); transactionScope.Complete(); } }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.paymentrefunds.Contains(this)) { previousValue.paymentrefunds.Remove(this); } if (customer != null) { if (!customer.paymentrefunds.Contains(this)) { customer.paymentrefunds.Add(this); } if (PR_CustID != customer.Cust_Id) { PR_CustID = customer.Cust_Id; } } }
private void Fixupcustomer(customer previousValue) { if (previousValue != null && previousValue.paymentcollections.Contains(this)) { previousValue.paymentcollections.Remove(this); } if (customer != null) { if (!customer.paymentcollections.Contains(this)) { customer.paymentcollections.Add(this); } if (PC_CustId != customer.Cust_Id) { PC_CustId = customer.Cust_Id; } } }