public JsonResult JsonUpdateCustomerDetail(CustomerDetailViewModel model) { if (model != null) { var accType = Request["AccType"]; var emailoptin = Convert.ToBoolean(model.CustomerDetail.IsEmailOptIn) ? "Y" : "N"; //Update the user details var objUserModel = AccountSettingsService.UpdateUser( StoreNumber, model.CustomerDetail.UserName ?? "", model.CustomerDetail.FirstName ?? "", model.CustomerDetail.LastName ?? "", model.CustomerDetail.Address ?? "", model.CustomerDetail.Address2 ?? "", model.CustomerDetail.City ?? "", model.CustomerDetail.State ?? "", model.CustomerDetail.Zip ?? "", model.CustomerDetail.Country ?? "", model.CustomerDetail.Email ?? "", model.CustomerDetail.DayPhone ?? "", model.CustomerDetail.Evening ?? "", model.CustomerDetail.ShipToName ?? "", model.CustomerDetail.ShipAddress ?? "", model.CustomerDetail.ShipAddress2 ?? "", model.CustomerDetail.ShipCity ?? "", model.CustomerDetail.ShipState ?? "", model.CustomerDetail.ShipZip ?? "", model.CustomerDetail.ShipCountry ?? "", model.CustomerDetail.ShipInstruc ?? "", emailoptin ?? "", model.CustomerDetail.DropDownAccountType ?? "", UvUsername, UvPassword, DbType, UvAddress, UvAccount, CacheTime, CacheTime, Strd3PortNumber, UseEncryption, Strd3PortNumber ); if (!string.IsNullOrEmpty(objUserModel.ErrorMsg)) { ModelState.AddModelError("", objUserModel.ErrorMsg); } else { Session["USERINFO"] = objUserModel; return Json("MyAccount"); } } return Json("MyAccount"); }
/// <summary> /// Get the detail of customer /// </summary> /// <returns></returns> public ActionResult JsonGetCustomerDetail() { try { //Get the variable from the querystring var customerId = Request["CustomerId"] ?? ""; if (customerId.Length > 1) { var customerDetail = CustomerService.GetCustomerDetailById(StoreNumber, customerId, UvUsername, UvPassword, DbType, UvAddress, UvAccount, CacheTime, CacheTime, Strd3PortNumber, UseEncryption, Strd3PortNumber); var customerDetailViewModel = new AccountSettingsViewModel { Address = customerDetail.Address, Address2 = customerDetail.Address2, City = customerDetail.City, Country = customerDetail.Country, DayPhone = customerDetail.DayPhone, Email = customerDetail.Email, FirstName = customerDetail.FirstName, LastName = customerDetail.LastName, ShipAddress = customerDetail.ShipAddress, ShipAddress2 = customerDetail.ShipAddress2, ShipCity = customerDetail.ShipCity, ShipCountry = customerDetail.ShipCountry, ShipInstruc = customerDetail.ShipInstruc, ShipState = customerDetail.ShipState, ShipToName = customerDetail.ShipToName, ShipZip = customerDetail.ShipZip, State = customerDetail.State, UserName = customerDetail.UserName, Zip = customerDetail.Zip, IsEmailOptIn = customerDetail.EmailOptIn.Equals("Y"), DropDownAccountType = customerDetail.TypeDescrition ?? "" }; ViewBag.AccountType = customerDetail.TypeDescrition ?? ""; ViewBag.State = customerDetail.State ?? ""; //Get the history of te order for the customers var orderModels = OrderService.GetOrderHistory(StoreNumber, customerId, UvUsername, UvPassword, DbType, UvAddress, UvAccount, CacheTime, CacheTime, Strd3PortNumber, UseEncryption, Strd3PortNumber); IEnumerable<OrderViewModel> orderViewModels; orderViewModels = (from order in orderModels select new OrderViewModel { OrderId = order.OrderId, ConfNumber = order.ConfNumber, DatePlaced = order.DatePlaced, DateProcessed = order.DateProcessed, Status = order.Status, Amount = order.Amount }); var customerViewModels = new CustomerDetailViewModel { CustomerDetail = customerDetailViewModel, AllAccountType = customerDetail.AllAccountType, OrderViewModels = orderViewModels }; //Put the value to the session Session["MAINTUSERINFO"] = customerViewModels; return PartialView("EditorTemplates/Admin/customerDetail", customerViewModels); } return Json("Please enter atleast two charactors"); } catch (Exception x) { return Json(x.Message); } }