/// <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>
        /// 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();
            }
        }