/// <summary> /// Gets an event code customer model /// </summary> /// <param name="customerId"></param> /// <returns></returns> public EventCodesCustomerModel GetEventCodesCustomerModel(int customerId) { EventCodesCustomerModel model = new EventCodesCustomerModel() { CustomerId = customerId }; GetEventCodesCustomerModel(model); return(model); }
/// <summary> /// Populates the event code model with the customer display name /// </summary> /// <param name="model"></param> private void GetEventCodesCustomerModel(EventCodesCustomerModel model) { if (model != null) { var customerProfile = RbacEntities.CustomerProfiles.SingleOrDefault(m => m.CustomerId == model.CustomerId); if (customerProfile != null) { model.CustomerDisplayName = customerProfile.DisplayName; } else { model.CustomerDisplayName = "[Undefined]"; } } }
public ActionResult UploadSubmit(IEnumerable <HttpPostedFileBase> files, EventCodesCustomerModel model) { Session.Remove(SessionFilePath); Session.Remove(SessionFileName); foreach (var file in files) { // Some browsers send file names with full path. We only care about the file name. var uniqueFileName = Guid.NewGuid().ToString() + ".csv"; var destinationPath = Path.Combine(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["pems.eventcodes.upload"]), uniqueFileName); file.SaveAs(destinationPath); Session[SessionFilePath] = destinationPath; Session[SessionFileName] = Path.GetFileName(file.FileName); } return(RedirectToAction("UploadProcess", new { customerId = model.CustomerId })); }
public ActionResult Upload(int customerId) { EventCodesCustomerModel model = (new EventCodesFactory(Session[Constants.Security.ConnectionStringSessionVariableName].ToString())).GetEventCodesCustomerModel(customerId); return(View(model)); }