public ActionResult FinderFeeCustomerSelectPopup(string selectedIds, int consignorId, string btnIdToRefresh, string frmIdToRefresh, AUCustomerList model) { //TODO: Implement permissions //if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts)) // return AccessDeniedView(); var consignor = _consignorService.GetConsignorById(consignorId); if (consignor == null || selectedIds == null) { ErrorNotification("A major error occurred -consignor id or selected ids from ConsignorCustomerSelectPopup null. Please contact System Support"); return RedirectToAction("ManageConsignors"); } //TODO: Finish this - Need to get the lot info to ensure not already sold and unpublished var ids = selectedIds .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(x => Convert.ToInt32(x)) .ToArray(); var customer = _consignorService.GetCustomerById(ids[0]); if (customer == null) { ErrorNotification("A major error occurred - customer not found using vendor id from ConsignorCustomerSelectPopup null. Please contact System Support"); return RedirectToAction("ManageConsignors"); } consignor.CustomerID = customer.Id; _consignorRepo.Update(consignor); SuccessNotification("Customer associated to Consignor!!"); //seems to be nop admin convention ViewBag.RefreshPage = true; ViewBag.btnId = btnIdToRefresh; ViewBag.formId = frmIdToRefresh; return View("~/Views/AUConsignor/ConsignorCustomerSelectPopup.cshtml", model); //return RedirectToAction("ListLots"); //TODO FIX THIS }
public ActionResult ListUnassignedFinders(DataSourceRequest command, AUCustomerList model) { //int roleId = _consignorService.GetIdForRole("Consignors"); //int[] roleIds = new int[1]; ////Note: roleId may be 0 if Role was not found //roleIds[0] = roleId; var finders = _consignorService.GetUnassignedFinderCustomers( entityId: model.AUEntityId, entityType: model.AUEntityType, vendorId: model.SearchVendorId, //customerRoleIds: roleIds, email: model.SearchEmail, username: model.SearchUsername, firstName: model.SearchFirstName, lastName: model.SearchLastName, company: model.SearchCompany, phone: model.SearchPhone, zipPostalCode: model.SearchZipPostalCode, pageIndex: 0, pageSize: 500); //pageIndex: command.Page - 1, //pageSize: command.PageSize); //TODO: Add address, phone info to this result set (use nav property = select home address) var gridModel = new DataSourceResult { Data = finders.Select(x => new { Id = x.Id, VendorId = x.VendorId, CustomerGuid = x.CustomerGuid, Firstname = (x.Addresses.Count() != 0) ? x.Addresses.First().FirstName : "No Address", Lastname = (x.Addresses.Count() != 0) ? x.Addresses.First().LastName : "No Address", Address1 = (x.Addresses.Count() != 0) ? x.Addresses.First().Address1 : "No Address", Address2 = (x.Addresses.Count() != 0) ? x.Addresses.First().Address2 : "No Address", City = (x.Addresses.Count() != 0) ? x.Addresses.First().City : "No Address", ZipPostalCode = (x.Addresses.Count() != 0) ? x.Addresses.First().ZipPostalCode : "No Address", Username = x.Username, Company = (x.Addresses.Count() != 0) ? x.Addresses.First().Company : "No Address", Phone = (x.Addresses.Count() != 0) ? x.Addresses.First().PhoneNumber : "No Address", Email = x.Email, AdminComment = x.AdminComment, HasShoppingCartItems = x.HasShoppingCartItems, Active = x.Active, CreatedOnUtc = x.CreatedOnUtc, LastLoginDateUtc = x.LastLoginDateUtc, LastActivityDateUtc = x.LastActivityDateUtc }), Total = finders.TotalCount }; return Json(gridModel); }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% public ActionResult FinderFeeCustomerSelectPopup(int entityId, string entityType) { //TODO: Permissions to associate Customer to Consignor //if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts)) // return View("~/Administration/Views/Security/AccessDenied.cshtml"); var model = new AUCustomerList(); //same model as used in consignorcustomer popup model.AUEntityId = entityId; model.AUEntityType = entityType; //TODO: a vendor should not be able to see the consignor info or set the customer. Add and Set the indicator in the model model.IsLoggedInAsVendor = _workContext.CurrentVendor != null; //TODO: POPULATE WITH PHONEENABLED, model.PhoneEnabled = true; model.ZipPostalCodeEnabled = true; model.CompanyEnabled = true; model.AUConsignorId = 0; return View("~/Views/AUConsignor/FinderFeeCustomerSelectPopup.cshtml", model); }