Exemple #1
0
        public JsonResult GetOtherDetails(string customerAccount)
        {
            WOClassification  woClassification  = new WOClassification();
            ServiceTechnician serviceTechnician = new ServiceTechnician();
            PartDetails       partDetails       = new PartDetails();
            ServiceOrder      serviceOrder      = new ServiceOrder();
            ServiceOrderLine  serviceOrderLine  = new ServiceOrderLine();
            string            userName          = null;

            try
            {
                if (customerAccount != null)
                {
                    userName = User.Identity.Name.ToString().Split('\\')[1];
                    List <Address> addressList     = (new Address()).GetCustomerAddress(customerAccount, userName);
                    List <Address> addressShipping = (from item1 in addressList
                                                      where item1.IsShipping == "1"
                                                      select item1).ToList <Address>();
                    List <Address> addressBilling = (from item1 in addressList
                                                     where item1.IsBilling == "1"
                                                     select item1).ToList <Address>();
                    if (addressShipping.Count >= 1)
                    {
                        for (int i = 0; i <= addressShipping.Count - 1; i++)
                        {
                            if (i == 0)
                            {
                                addressShipping[i].IsSelected = "checked";
                            }
                            else
                            {
                                addressShipping[i].IsSelected = null;
                            }
                        }

                        serviceOrder.ShippingAddressList = addressShipping;
                    }
                    //ViewData["BillingAddress"] = addressBilling;
                    //ViewData["ShippingAddress"] = addressShipping;
                    TempData["CustomerAccount"]     = customerAccount;
                    serviceOrder.BillingAddressList = addressBilling;

                    IEnumerable <WOClassification> woClassificationCollection = woClassification.GetWOClassification(User.Identity.Name.ToString().Split('\\')[1]);
                    woClassification.WOClassificationList = new SelectList(woClassificationCollection, "WOClassificationCode", "WOClassificationName", null);
                    //ViewData["WOClassificationList"] = woClassification.WOClassificationList;
                    serviceOrder.WOClassification = woClassification;
                    IEnumerable <ServiceTechnician> serviceTechnicianCollection = serviceTechnician.GetTechnicians(User.Identity.Name.ToString().Split('\\')[1]);
                    serviceTechnician.ServiceTechnicianList = new SelectList(serviceTechnicianCollection, "ServiceTechnicianNo", "ServiceTechnicianName", null);
                    //ViewData["ServiceTechnicianList"] = serviceTechnician.ServiceTechnicianList;
                    //ViewData["ServiceResponsibleList"] = serviceTechnician.ServiceTechnicianList;
                    serviceOrder.ServiceTechnician  = serviceTechnician;
                    serviceOrder.ServiceResponsible = serviceTechnician;

                    IEnumerable <PartDetails> partDetailsCollection = partDetails.GetItemNumbers(User.Identity.Name.ToString().Split('\\')[1]);
                    //partDetails.PartDetailsList1 = partDetailsCollection.ToList<PartDetails>();
                    partDetails.PartDetailsList           = new SelectList(partDetailsCollection, "ItemNumber", "ItemNumber", null);
                    ViewData["PartNumberList"]            = partDetails.PartDetailsList;
                    serviceOrder.PartDetails              = partDetails;
                    serviceOrderLine.ServiceOrderLineList = new List <ServiceOrderLine>();
                    serviceOrder.ServiceOrderLine         = serviceOrderLine;
                }
                TempData.Keep();
            }
            catch (Exception ex)
            {
                TempData.Keep();
                ExceptionLog.LogException(ex, userName);
            }
            return(Json(serviceOrder, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        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));
        }