コード例 #1
0
        /// <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;
        }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
 public void UpdateCustomerDetails(CustomerDTO customerDetails)
 {
     customer customerEntity = new customer();
     AutoMapper.Mapper.Map(customerDetails, customerEntity);
     ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>().Update(customerEntity);
 }
コード例 #4
0
        public CustomerDTO GetActiveCustomerDetailsByCode(string customerCode)
        {
            CustomerDTO customerDetails = new CustomerDTO();
            customer customerEntity = ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>()
                .GetSingle(item => item.Cust_Code == customerCode && item.Cust_IsDeleted == false);

            AutoMapper.Mapper.Map(customerEntity, customerDetails);
            return customerDetails;
        }
コード例 #5
0
        /// <summary>
        /// Get ustomer Details By MobileNumber and customer code
        /// </summary>
        /// <param name="mobileNumber">string:mobileNumber</param>
        /// <returns>returns list of customers where Cust_MobileNo matches with mobileNumber</returns>
        public CustomerDTO GetBlacklistedCustomerDetailsForCashSMS(string mobileNumber, string customerCode)
        {
            CustomerDTO customerDTO = new CustomerDTO();

            customer customerEntity = ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>().
                GetSingle(item => item.Cust_MobileNo == mobileNumber
                    && item.Cust_Code == customerCode);

            if (customerEntity != null)
            {
                AutoMapper.Mapper.Map(customerEntity, customerDTO);
            }
            else
            {
                customerDTO = null;
            }

            return customerDTO;
        }
コード例 #6
0
        /// <summary>
        /// Get Customer Details by customer Id
        /// </summary>
        /// <param name="customerId">Int32:customerId</param>
        /// <returns></returns>
        public CustomerDTO GetCustomerDetails(int customerId)
        {
            CustomerDTO customerDetails = new CustomerDTO();
            AutoMapper.Mapper.Map(ESalesUnityContainer.Container.Resolve<ICustomerRepository>().GetCustomerDetails(customerId),
                customerDetails);

            //return the value
            return customerDetails;
        }
コード例 #7
0
        /// <summary>
        /// Get Customer Details By Id
        /// </summary>
        /// <param name="customerId">Int32:customerId</param>
        /// <returns></returns>
        public CustomerDTO GetCustomerDetailsById(int customerId)
        {
            CustomerDTO customerDetails = new CustomerDTO();
            customer customerEntity = ESalesUnityContainer.Container.Resolve<IGenericRepository<customer>>()
                .GetSingle(item => item.Cust_Id == customerId);

            AutoMapper.Mapper.Map(customerEntity, customerDetails);

            //return the value
            return customerDetails;
        }
コード例 #8
0
 /// <summary>
 /// Get customer details by customer id
 /// </summary>
 /// <param name="customerId">Int32: customer id</param>
 /// <returns>returns customer details if exists, else blank datatype</returns>
 public static CustomerDTO GetCustomerDetailsById(int customerId)
 {
     CustomerDTO customerDetails = new CustomerDTO();
     customerDetails = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsById(customerId);
     return customerDetails;
 }