//- To get the GetCustomers for Check In Page public IEnumerable<Customer> GetCustomers(string userName) { IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>(); List<Customer> customerList = new List<Customer>(); try { DataTable resultTable = axHelper.GetCustomers(userName); foreach (DataRow row in resultTable.Rows) { Customer customerObject = new Customer(); customerObject.CustomerAccount = row["CustomerAccount"].ToString(); customerObject.CustomerName = row["CustomerAccount"].ToString() + " - " + row["CustomerName"].ToString(); customerList.Add(customerObject); } } catch (Exception e) { throw e; } return customerList.AsEnumerable<Customer>(); }
public ActionResult CheckIn() { ServiceOrder serviceOrder = new ServiceOrder(); Customer customer = new Customer(); WOClassification woClassification = new WOClassification(); List<WOClassification> woClassificationCollection = new List<WOClassification>(); ServiceTechnician serviceTechnician = new ServiceTechnician(); List<ServiceTechnician> serviceTechnicianCollection = new List<ServiceTechnician>(); PartDetails partDetails = new PartDetails(); List<PartDetails> partDetailsCollection = new List<PartDetails>(); ServiceOrderLine serviceOrderLine = new ServiceOrderLine(); List<ServiceOrderLine> serviceOrderLineList = new List<ServiceOrderLine>(); List<Address> addressList = new List<Address>(); string userName = null; userName = User.Identity.Name.ToString().Split('\\')[1]; try { if (HttpContext.Session != null) { if (Session["SiteID"] == null) { RedirectToAction("ServiceOrderWithHistory", "WorkOrder"); } } IEnumerable<Customer> customerCollection = customer.GetCustomers(User.Identity.Name.ToString().Split('\\')[1]); customer.CustomerList = new SelectList(customerCollection, "CustomerAccount", "CustomerName", null); serviceOrder.Customer = customer; ViewData["CustomerList"] = customer.CustomerList; woClassification.WOClassificationList = new SelectList(woClassificationCollection.AsEnumerable<WOClassification>(), "WOClassificationCode", "WOClassificationName", null); serviceOrder.WOClassification = woClassification; serviceTechnician.ServiceTechnicianList = new SelectList(serviceTechnicianCollection.AsEnumerable<ServiceTechnician>(), "ServiceTechnicianNo", "ServiceTechnicianName", null); serviceOrder.ServiceTechnician = serviceTechnician; serviceOrder.ServiceResponsible = serviceTechnician; partDetails.PartDetailsList = new SelectList(partDetailsCollection.AsEnumerable<PartDetails>(), "ItemNumber", "ItemNumber", null); ViewData["PartNumberList"] = partDetails.PartDetailsList; serviceOrder.PartDetails = partDetails; ViewData["ServiceOrderLine"] = serviceOrderLineList; TempData["ServiceOrderLine"] = serviceOrderLineList; serviceOrderLine.ServiceOrderLineList = serviceOrderLineList; serviceOrder.ServiceOrderLine = serviceOrderLine; ViewData["BillingAddress"] = addressList; ViewData["ShippingAddress"] = addressList; serviceOrder.BillingAddressList = addressList; serviceOrder.ShippingAddressList = addressList; ViewData["ServiceOrder"] = serviceOrder; TempData.Keep(); } catch(Exception ex) { TempData.Keep(); ExceptionLog.LogException(ex, userName); } return View(serviceOrder); }