Пример #1
0
        public ActionResult ExistingLeadList(int?customerId)
        {
            Logger.Info(_logMsg.Clear().SetPrefixMsg("Get ExistingLead List").Add("CustomerId", customerId).ToInputLogString());

            if (customerId == null)
            {
                return(Json(new
                {
                    Valid = false,
                    RedirectUrl = Url.Action("Search", "Customer")
                }));
            }

            try
            {
                if (ModelState.IsValid)
                {
                    _customerFacade = new CustomerFacade();
                    ExistingLeadViewModel existingLeadVM = new ExistingLeadViewModel();
                    CustomerInfoViewModel custInfoVM     = this.MappingCustomerInfoView(customerId.Value);

                    if (!string.IsNullOrWhiteSpace(custInfoVM.CardNo))
                    {
                        _auditLog              = new AuditLogEntity();
                        _auditLog.Module       = Constants.Module.Customer;
                        _auditLog.Action       = Constants.AuditAction.ExistingLead;
                        _auditLog.IpAddress    = ApplicationHelpers.GetClientIP();
                        _auditLog.CreateUserId = this.UserInfo.UserId;

                        existingLeadVM.Ticket = _customerFacade.GetLeadList(_auditLog, custInfoVM.CardNo);
                    }

                    existingLeadVM.CustomerInfo = custInfoVM;

                    _commonFacade          = new CommonFacade();
                    ViewBag.SLMUrlNewLead  = _commonFacade.GetSLMUrlNewLead();
                    ViewBag.SLMUrlViewLead = _commonFacade.GetSLMUrlViewLead();
                    //                    ViewBag.SLMEncryptPassword = _commonFacade.GetSLMEncryptPassword();
                    ViewBag.SLMEncryptPassword = WebConfig.GetSLMEncryptPassword();

                    if (!string.IsNullOrEmpty(UserInfo.Username))
                    {
                        ViewBag.Username = UserInfo.Username.ToLower();
                    }

                    Logger.Info(_logMsg.Clear().SetPrefixMsg("Get ExistingLead List").ToSuccessLogString());
                    return(PartialView("~/Views/ExistingLead/_ExistingLeadList.cshtml", existingLeadVM));
                }

                return(Json(new
                {
                    Valid = false,
                    Error = string.Empty,
                    Errors = GetModelValidationErrors()
                }));
            }
            catch (CustomException cex)
            {
                Logger.Info(_logMsg.Clear().SetPrefixMsg("Get ExistingLead List").Add("Error Message", cex.Message).ToFailLogString());
                return(Json(new
                {
                    Valid = false,
                    Error = cex.Message
                }));
            }
            catch (Exception ex)
            {
                Logger.Error("Exception occur:\n", ex);
                Logger.Info(_logMsg.Clear().SetPrefixMsg("Get ExistingLead List").Add("Error Message", ex.Message).ToFailLogString());
                return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                 this.ControllerContext.RouteData.Values["action"].ToString())));
            }
        }