/// <summary>
        /// This method used for get customer profile ac.
        /// </summary>
        /// <param name="customerProfileAc"></param>
        /// <param name="customer"></param>
        /// <returns></returns>
        private CustomerProfileAc GetCustomerProfileAc(CustomerProfileAc customerProfileAc, CustomerProfile customer)
        {
            switch (Convert.ToInt32(customer.PriceCategory))
            {
            case (int)PriceCategory.NormalPrice:
                customerProfileAc.PriceCategoryName = PriceCategory.NormalPrice.ToString();
                break;

            case (int)PriceCategory.A:
                customerProfileAc.PriceCategoryName = PriceCategory.A.ToString();
                break;

            case (int)PriceCategory.B:
                customerProfileAc.PriceCategoryName = PriceCategory.B.ToString();
                break;

            case (int)PriceCategory.C:
                customerProfileAc.PriceCategoryName = PriceCategory.C.ToString();
                break;

            case (int)PriceCategory.D:
                customerProfileAc.PriceCategoryName = PriceCategory.D.ToString();
                break;
            }
            var userId = HttpContext.Current.User.Identity.GetUserId();

            if (customer.ParentRecord?.InitiatorId == userId)
            {
                customerProfileAc.IsCurrentUser = true;
            }
            return(customerProfileAc);
        }
 public IHttpActionResult GetCustomerList()
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var customerCollection = new List <CustomerProfileAc>();
             foreach (var customer in _customerRepository.GetCustomerList())
             {
                 var customerProfileAc = new CustomerProfileAc();
                 customerProfileAc            = ApplicationClassHelper.ConvertType <CustomerProfile, CustomerProfileAc>(customer);
                 customerProfileAc.CustomerId = customer.Id;
                 customerProfileAc            = GetCustomerProfileAc(customerProfileAc, customer);
                 customerCollection.Add(customerProfileAc);
             }
             return(Ok(customerCollection.OrderByDescending(x => x.CustomerId)));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
 public IHttpActionResult AddNewCustomerDetails(CustomerProfileAc customerProfile)
 {
     try
     {
         var customerDetails = _customerRepository.AddNewCustomerDetails(customerProfile, MerchantContext.CompanyDetails, MerchantContext.Permission, MerchantContext.UserDetails);
         return(Ok(new { status = customerDetails }));
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
        public IHttpActionResult UpdateCustomerInformation(CustomerProfileAc customerProfile)
        {
            try
            {
                if (customerProfile.RecordId != null && _iWorkFlowDetailsRepository.CheckLastActionPerform(Convert.ToInt32(customerProfile.RecordId), StringConstants.Approve, MerchantContext.UserDetails.RoleId))
                {
                    return(Ok(new { isResult = StringConstants.AlreadyActivityProcessed }));
                }

                _customerRepository.UpdateCustomerInformation(customerProfile, MerchantContext.CompanyDetails, MerchantContext.Permission, MerchantContext.UserDetails);
                return(Ok());
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
 public IHttpActionResult CheckNumberAlreadyExistOrNot(CustomerProfileAc customerProfile)
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var numberAlreadyExist = _customerRepository.CheckNumberAlreadyExistOrNot(customerProfile);
             return(Ok(new { status = numberAlreadyExist }));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
        public IHttpActionResult SaveBalanceAmount(CustomerProfileAc customerInfo)
        {
            try
            {
                _customerRepository.SaveBalanceAmount(customerInfo, MerchantContext.CompanyDetails.Id);
                var customerCollection = new List <CustomerProfileAc>();
                var paymentDetails     = new CustomerPaymentReciptAc();

                customerCollection.Add(customerInfo);
                paymentDetails.BranchDetail     = MerchantContext.UserDetails.Branch;
                paymentDetails.CurrentDate      = DateTime.UtcNow.ToString("dd-MM-yyyy");
                paymentDetails.Invoice          = InvoiceToHtml.get39(customerInfo.MembershipCode.ToString(), 1.5, 20);
                paymentDetails.MemberShipNumber = customerInfo.MembershipCode;
                paymentDetails.CustomerDetails  = customerCollection;

                return(Ok(paymentDetails));
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }