public ActionResult CreateServiceOrderPartLines(string serviceOrderNo, string transactionType, string technicinanNo, string quantity, string specialityCode, string failureCode, string lineProperty, string serviceOrderRelation, string description, string serviceComments, string itemNumber, string site, string wareHouse, string transSerialCodeNo, string colorId, string sizeId, string configId, string locationId)
        {
            string userName = null;

            bool isSuccess = false;
            userName = User.Identity.Name.ToString().Split('\\')[1];
            try
            {

                SerivceOrderPartLine serviceOrderPartLine = new SerivceOrderPartLine();
                isSuccess = serviceOrderPartLine.CreateServiceOrderItemLines(serviceOrderNo, transactionType, technicinanNo, quantity, specialityCode, failureCode, lineProperty, serviceOrderRelation, description, serviceComments, itemNumber, site, wareHouse, transSerialCodeNo, colorId = "", sizeId = "", configId = "", locationId, userName);

                if (isSuccess)
                {
                    ViewData["ServiceOrderPartLines"] = GetServiceOrderPartLinesByServiceOrderID(serviceOrderNo);
                }
                else
                {
                    throw new Exception("Service Order Part Lines creation failed");
                }
                TempData.Keep();
            }
            catch (Exception ex)
            {
                TempData.Keep();
                if (!isSuccess)
                {
                    ExceptionLog.LogException(ex, userName);
                    throw ex;
                }
            }
            return View("ServiceOrderPartLinesView");
        }
예제 #2
0
        public List <SerivceOrderPartLine> GetTransactionSerialNumbers(string itemNumber, string site, string wareHouse, string locationId, string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance <IAXHelper>();
            List <SerivceOrderPartLine> serialNumberList = new List <SerivceOrderPartLine>();

            try
            {
                DataTable resultTable = axHelper.GetTransactionSerialNumberList(itemNumber, site, wareHouse, locationId, userName);


                foreach (DataRow row in resultTable.Rows)
                {
                    SerivceOrderPartLine serviceObject = new SerivceOrderPartLine();
                    serviceObject.TransactionSerialNumber = row["SerialNumber"].ToString();
                    serialNumberList.Add(serviceObject);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(serialNumberList);
        }
예제 #3
0
        public IEnumerable <SerivceOrderPartLine> GetSerialNumberByServiceOrder(string serviceOrderID, string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance <IAXHelper>();
            List <SerivceOrderPartLine> soRelationList = new List <SerivceOrderPartLine>();

            try
            {
                DataTable resultTable = axHelper.GetSerialNumberByServiceOrder(serviceOrderID, userName);


                foreach (DataRow row in resultTable.Rows)
                {
                    SerivceOrderPartLine serviceOrderPartObject = new SerivceOrderPartLine();
                    serviceOrderPartObject.ServiceObjectRelation = row["SORID"].ToString();
                    serviceOrderPartObject.SerialNumber          = row["SerialNumber"].ToString();
                    soRelationList.Add(serviceOrderPartObject);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(soRelationList.AsEnumerable <SerivceOrderPartLine>());
        }
예제 #4
0
        public List <SerivceOrderPartLine> GetServiceOrderPartLineByServiceOrder(string serviceorderId, string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance <IAXHelper>();
            List <SerivceOrderPartLine> serviceOrderList = new List <SerivceOrderPartLine>();

            try
            {
                DataTable resultTable = axHelper.GetServiceOrderPartLineByServiceOrder(serviceorderId, userName);

                List <SerivceOrderPartLine> serviceOrder = new List <SerivceOrderPartLine>();

                string status      = "";
                string transaction = "";
                foreach (DataRow row in resultTable.Rows)
                {
                    SerivceOrderPartLine serviceObject = new SerivceOrderPartLine();
                    serviceObject.SerialNumber          = row["SerialNumber"].ToString();
                    serviceObject.ServiceObjectRelation = row["SORelationID"].ToString();
                    transaction = row["TransactionType"].ToString();

                    if (transaction == "3")
                    {
                        serviceObject.TransactionType = TransactionType.Item;
                    }
                    else if (transaction == "1")
                    {
                        serviceObject.TransactionType = TransactionType.Hour;
                    }
                    else if (transaction == "2")
                    {
                        serviceObject.TransactionType = TransactionType.Expense;
                    }
                    else if (transaction == "4")
                    {
                        serviceObject.TransactionType = TransactionType.Fee;
                    }
                    serviceObject.Description = row["Description"].ToString();

                    serviceObject.SpecialtyCode     = new Models.SpecialtyCode(row["SpecialityCode"].ToString(), "");
                    serviceObject.FailureCode       = new Models.FailureCode(row["FailureCode"].ToString(), "");
                    serviceObject.LineProperty      = new Models.LineProperty(row["LineProperty"].ToString(), "");
                    serviceObject.Quantity          = row["Qty"].ToString();
                    serviceObject.SalesPrice        = row["SalesPrice"].ToString();
                    serviceObject.ServiceTechnician = new Models.ServiceTechnician(row["Technician"].ToString(), row["TechnicianNo"].ToString());

                    serviceObject.ServiceComments         = row["ServiceComments"].ToString();
                    serviceObject.UniqueId                = row["UniqueId"].ToString();
                    serviceObject.PartDetails             = new Models.PartDetails(row["ItemNumber"].ToString(), "", "");
                    serviceObject.Site                    = new Models.Site("", row["Site"].ToString(), "", "");
                    serviceObject.WareHouse               = new Models.WareHouse(row["WareHouse"].ToString(), "", "", "");
                    serviceObject.SizeType                = row["Size"].ToString();
                    serviceObject.ColorType               = row["Color"].ToString();
                    serviceObject.ConfigType              = row["Config"].ToString();
                    serviceObject.Location                = new Models.Location(row["LocationId"].ToString(), "", "", "");
                    serviceObject.TransactionSerialNumber = row["TransSerialNumber"].ToString();
                    if (status == "0")
                    {
                        serviceObject.Status = "In Process";
                    }
                    else if (status == "1")
                    {
                        serviceObject.Status = "Posted";
                    }
                    serviceObject.ServiceOrder = serviceorderId;


                    serviceOrderList.Add(serviceObject);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(serviceOrderList);
        }
        public List<SerivceOrderPartLine> GetTransactionSerialNumbers(string itemNumber, string site, string wareHouse, string locationId, string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<SerivceOrderPartLine> serialNumberList = new List<SerivceOrderPartLine>();
            try
            {
                DataTable resultTable = axHelper.GetTransactionSerialNumberList(itemNumber, site, wareHouse, locationId, userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    SerivceOrderPartLine serviceObject = new SerivceOrderPartLine();
                    serviceObject.TransactionSerialNumber = row["SerialNumber"].ToString();
                    serialNumberList.Add(serviceObject);

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return serialNumberList;
        }
        public List<SerivceOrderPartLine> GetServiceOrderPartLineByServiceOrder(string serviceorderId, string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<SerivceOrderPartLine> serviceOrderList = new List<SerivceOrderPartLine>();
            try
            {
                DataTable resultTable = axHelper.GetServiceOrderPartLineByServiceOrder(serviceorderId, userName);

                List<SerivceOrderPartLine> serviceOrder = new List<SerivceOrderPartLine>();

                string status = "";
                string transaction = "";
                foreach (DataRow row in resultTable.Rows)
                {
                    SerivceOrderPartLine serviceObject = new SerivceOrderPartLine();
                    serviceObject.SerialNumber = row["SerialNumber"].ToString();
                    serviceObject.ServiceObjectRelation = row["SORelationID"].ToString();
                    transaction = row["TransactionType"].ToString();

                    if (transaction == "3")
                    {
                        serviceObject.TransactionType = TransactionType.Item;
                    }
                    else if (transaction == "1")
                    {
                        serviceObject.TransactionType = TransactionType.Hour;
                    }
                    else if (transaction == "2")
                    {
                        serviceObject.TransactionType = TransactionType.Expense;
                    }
                    else if (transaction == "4")
                    {
                        serviceObject.TransactionType = TransactionType.Fee;
                    }
                    serviceObject.Description = row["Description"].ToString();

                    serviceObject.SpecialtyCode = new Models.SpecialtyCode(row["SpecialityCode"].ToString(),"");
                    serviceObject.FailureCode = new Models.FailureCode(row["FailureCode"].ToString(), "");
                    serviceObject.LineProperty = new Models.LineProperty(row["LineProperty"].ToString(), "");
                    serviceObject.Quantity = row["Qty"].ToString();
                    serviceObject.SalesPrice = row["SalesPrice"].ToString();
                    serviceObject.ServiceTechnician = new Models.ServiceTechnician(row["Technician"].ToString(),row["TechnicianNo"].ToString());

                    serviceObject.ServiceComments = row["ServiceComments"].ToString();
                    serviceObject.UniqueId = row["UniqueId"].ToString();
                    serviceObject.PartDetails = new Models.PartDetails(row["ItemNumber"].ToString(), "", "");
                    serviceObject.Site = new Models.Site("",row["Site"].ToString(),"","");
                    serviceObject.WareHouse =new Models.WareHouse(row["WareHouse"].ToString(),"","","");
                    serviceObject.SizeType = row["Size"].ToString();
                    serviceObject.ColorType = row["Color"].ToString();
                    serviceObject.ConfigType = row["Config"].ToString();
                    serviceObject.Location = new Models.Location(row["LocationId"].ToString(),"","","");
                    serviceObject.TransactionSerialNumber = row["TransSerialNumber"].ToString();
                    if (status == "0")
                    {
                        serviceObject.Status = "In Process";
                    }
                    else if (status == "1")
                    {
                        serviceObject.Status = "Posted";
                    }
                    serviceObject.ServiceOrder = serviceorderId;

                    serviceOrderList.Add(serviceObject);

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return serviceOrderList;
        }
        public IEnumerable<SerivceOrderPartLine> GetSerialNumberByServiceOrder(string serviceOrderID, string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<SerivceOrderPartLine> soRelationList = new List<SerivceOrderPartLine>();

            try
            {
                DataTable resultTable = axHelper.GetSerialNumberByServiceOrder(serviceOrderID, userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    SerivceOrderPartLine serviceOrderPartObject = new SerivceOrderPartLine();
                    serviceOrderPartObject.ServiceObjectRelation = row["SORID"].ToString();
                    serviceOrderPartObject.SerialNumber = row["SerialNumber"].ToString();
                    soRelationList.Add(serviceOrderPartObject);

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return soRelationList.AsEnumerable<SerivceOrderPartLine>();
        }
        //
        // GET: /RepairLines/
        public ActionResult RepairLines()
        {
            TempData["ServiceOrderId"] = Session["SID"];
            TempData["RepairSiteId"]=Session["SiteID"];
            RepairType repairTypeObj = new RepairType();
            string userName = User.Identity.Name.ToString().Split('\\')[1];
            try
            {

                if (HttpContext.Session != null)
                {
                    if (Session["SiteID"] == null)
                    {
                        return RedirectToAction("ServiceOrderWithHistory", "WorkOrder");
                    }
                }
                if (TempData["ServiceOrderId"] != null)
                {
                    ServiceOrderLine serviceOrderLineobj = new ServiceOrderLine();
                    repairTypeObj.ServiceOrderLine = serviceOrderLineobj;

                    SerivceOrderPartLine serviceOrderPartLineObj = new SerivceOrderPartLine();
                    IEnumerable<SerivceOrderPartLine> serviceOrderPartLineCollection = null;
                    serviceOrderPartLineCollection = serviceOrderPartLineObj.GetSerialNumberByServiceOrder(TempData["ServiceOrderId"].ToString(), userName);
                    serviceOrderPartLineObj.ServiceOrderPartLineList = new SelectList(serviceOrderPartLineCollection, "SerialNumber", "SerialNumber", null);
                    ViewData["SerialNumberList"] = serviceOrderPartLineObj.ServiceOrderPartLineList;

                    repairTypeObj.ConditionList = new SelectList(repairTypeObj.GetCondtions(userName), "ConditionId", "ConditionName", null);
                    ViewData["Condition"] = repairTypeObj.ConditionList;

                    repairTypeObj.SysmptomAreaList = new SelectList(repairTypeObj.GetSymptomArea(userName), "SymptomAreaId", "SymptomAreaName", null);
                    ViewData["SymptomArea"] = repairTypeObj.SysmptomAreaList;

                    repairTypeObj.DiagnosisAreaList = new SelectList(repairTypeObj.GetDiagnosisArea(userName), "DiagonsisAreaId", "DiagonsisAreaName", null);
                    ViewData["DiagnosisArea"] = repairTypeObj.DiagnosisAreaList;

                    repairTypeObj.ResolutionList = new SelectList(repairTypeObj.GetResolution(userName), "ResolutionId", "ResolutionName", null);
                    ViewData["Resolution"] = repairTypeObj.ResolutionList;

                    repairTypeObj.RepairStageList = new SelectList(repairTypeObj.GetRepairStages(userName), "RepairStageId", "RepairStageName", null);
                    ViewData["RepairStage"] = repairTypeObj.RepairStageList;

                    //ServiceTechnician serviceTechnician = new ServiceTechnician();
                    //serviceTechnician.ServiceTechnicianList = new SelectList(serviceTechnician.GetTechnicians(userName), "ServiceTechnicianNo", "ServiceTechnicianName", null);
                    //ViewData["ServiceTechnicianList"] = serviceTechnician.ServiceTechnicianList;

                    ServiceOrder ServiceOrder = new ServiceOrder();
                    ServiceOrder.ServiceOrderList = GetServiceOrderDetailsByServiceOrder(TempData["RepairSiteId"].ToString(), TempData["ServiceOrderId"].ToString());
                    repairTypeObj.ServiceOrders = ServiceOrder;
                    ViewData["ServiceOrderDetailsinRepairLines"] = repairTypeObj.ServiceOrders.ServiceOrderList;

                    ServiceTechnician serviceTechnician = new ServiceTechnician();
                    IEnumerable<ServiceTechnician> serviceTechnicianCollection = null;
                    serviceTechnicianCollection = serviceTechnician.GetTechnicians(userName);

                    if (!String.IsNullOrEmpty(TempData["Technician-No"].ToString()))
                    {
                        serviceTechnician.ServiceTechnicianList = new SelectList(serviceTechnicianCollection, "ServiceTechnicianNo", "ServiceTechnicianName", serviceTechnicianCollection.First<ServiceTechnician>().ServiceTechnicianNo = TempData["Technician-No"].ToString());
                    }
                    else
                    {
                        serviceTechnician.ServiceTechnicianList = new SelectList(serviceTechnicianCollection, "ServiceTechnicianNo", "ServiceTechnicianName", null);
                    }
                    ViewData["ServiceTechnicianList"] = serviceTechnician.ServiceTechnicianList;

                    //List<RepairType> RepairLineList = (new RepairType()).GetRepairLineDetails(TempData["ServiceOrderId"].ToString(), userName);
                    //repairTypeObj.RepairLineList = new SelectList(repairTypeObj.GetRepairLineDetails(TempData["ServiceOrderId"].ToString(), userName));
                    //ViewData["RepairLinesList"] = GetRepairLinesDetails(TempData["ServiceOrderId"].ToString());

                    TempData.Keep();
                }
                else
                {
                    return RedirectToAction("ServiceOrderWithHistory","WorkOrder");
                }
            }
            catch (Exception ex)
            {
                TempData.Keep();
                ExceptionLog.LogException(ex, userName);

            }
            return View(repairTypeObj);
        }
        // GET: /ServiceOrderProcess/
        public ActionResult ServiceOrderProcess()
        {
            string userName = "";
            TempData["ServiceOrderId"] = Session["SID"];
            TempData["WorkOrderSiteId"] = Session["SiteID"];
            userName = User.Identity.Name.ToString().Split('\\')[1];
            SerivceOrderPartLine serivceOrderPartLineObject = new SerivceOrderPartLine();
            ServiceOrderLine serivceOrderLineObject = new ServiceOrderLine();
            List<ServiceOrderLine> serviceOrderLineList = new List<ServiceOrderLine>();

            try
            {
                if (HttpContext.Session != null)
                {
                    if (Session["SiteID"] == null)
                    {
                        return RedirectToAction("ServiceOrderWithHistory");
                    }
                }
                if (TempData["ServiceOrderId"] != null)
                {

                    serivceOrderLineObject.ServiceOrderLineList = serviceOrderLineList;
                    serivceOrderPartLineObject.ServiceOrderLine = serivceOrderLineObject;

                    FailureCode failureCodeObject = new FailureCode();
                    IEnumerable<FailureCode> failureCodeCollection = failureCodeObject.GetFailureCode(userName);
                    failureCodeObject.FailureCodeList = new SelectList(failureCodeCollection, "FailureCodeNo", "FailureDescription", null);
                    ViewData["FailureCodeList"] = failureCodeObject.FailureCodeList;

                    PartDetails partDetails = new PartDetails();
                    partDetails.PartDetailsList = new SelectList(partDetails.GetItemNumbers(userName), "ItemNumber", "ItemNumber", null);
                    ViewData["PartNumberList"] = partDetails.PartDetailsList;

                    LineProperty LinePropertyObject = new LineProperty();
                    IEnumerable<LineProperty> LinePropertyCollection = LinePropertyObject.GetLineProperty(userName);
                    LinePropertyObject.LinePropertyList = new SelectList(LinePropertyCollection, "LinePropertyCode", "LinePropertyDescription", null);
                    ViewData["LinePropertyList"] = LinePropertyObject.LinePropertyList;

                    IEnumerable<SerivceOrderPartLine> serviceOrderPartLineCollection = null;

                    serviceOrderPartLineCollection = serivceOrderPartLineObject.GetSerialNumberByServiceOrder(TempData["ServiceOrderId"].ToString(), userName);

                    serivceOrderPartLineObject.ServiceOrderPartLineList = new SelectList(serviceOrderPartLineCollection, "ServiceObjectRelation", "SerialNumber", null);

                    ViewData["SORelationList"] = serivceOrderPartLineObject.ServiceOrderPartLineList;
                    ViewData["WorkSerialNumberList"] = serivceOrderPartLineObject.ServiceOrderPartLineList;
                    ViewData["ServiceOrderPartLines"] = GetServiceOrderPartLinesByServiceOrderID(TempData["ServiceOrderId"].ToString());

                    ServiceOrder ServiceOrder = new ServiceOrder();
                    ServiceOrder.ServiceOrderList = GetServiceOrderDetailsByServiceOrder(TempData["WorkOrderSiteId"].ToString(), TempData["ServiceOrderId"].ToString());
                    serivceOrderPartLineObject.ServiceOrders = ServiceOrder;
                    ViewData["ServiceOrderLineinProcess"] = serivceOrderPartLineObject.ServiceOrders.ServiceOrderList;

                    ServiceTechnician serviceTechnician = new ServiceTechnician();
                    IEnumerable<ServiceTechnician> serviceTechnicianCollection = null;
                    serviceTechnicianCollection=serviceTechnician.GetTechnicians(userName);

                    if (!String.IsNullOrEmpty(TempData["Technician"].ToString()))
                    {
                        serviceTechnician.ServiceTechnicianList = new SelectList(serviceTechnicianCollection, "ServiceTechnicianNo", "ServiceTechnicianName", serviceTechnicianCollection.First<ServiceTechnician>().ServiceTechnicianNo = TempData["Technician"].ToString());
                    }
                    else
                    {
                        serviceTechnician.ServiceTechnicianList = new SelectList(serviceTechnicianCollection, "ServiceTechnicianNo", "ServiceTechnicianName", null);
                    }
                    ViewData["ServiceTechnicianLoadList"] = serviceTechnician.ServiceTechnicianList;

                    Site site = new Site();
                    IEnumerable<Site> siteCollection = null;
                    siteCollection = site.GetSites(userName);
                    if (!String.IsNullOrEmpty(TempData["WorkOrderSiteId"].ToString()))
                    {
                        site.SiteList = new SelectList(siteCollection, "SiteId", "SiteName", siteCollection.First<Site>().SiteID = TempData["WorkOrderSiteId"].ToString());
                    }
                    else
                    {
                        site.SiteList = new SelectList(siteCollection, "SiteId", "SiteName", siteCollection.First<Site>().SiteID);
                    }

                    ViewData["siteList"] = site.SiteList;
                    ViewData["TranasactionTypes"] = TransactionType.GetTransactionTypes();
                    TempData.Keep();
                }
                else
                {
                   return RedirectToAction("ServiceOrderWithHistory");
                   // return View("ServiceOrderWithHistory", serivceOrderPartLineObject);
                    //throw new Exception("Select the service order number in Service Order with history page");

                }
            }
            catch (Exception ex)
            {
                TempData.Keep();
                ExceptionLog.LogException(ex, userName);
               // throw new Exception("Select the service order number in Service Order with history page");
                //return RedirectToAction("ServiceOrderWithHistory");
             //  return Json("Select the service order number in Service Order with history page",JsonRequestBehavior.AllowGet);

            }

            return View(serivceOrderPartLineObject);
        }
 private JsonResult _GetTransactionSerialNumber(string itemNumber, string site, string warehouse, string locationid)
 {
     string userName = User.Identity.Name.ToString().Split('\\')[1];
     SerivceOrderPartLine transactionSerialObject = new SerivceOrderPartLine();
     return Json(new SelectList(transactionSerialObject.GetTransactionSerialNumbers(itemNumber, site, warehouse, locationid, userName), "TransactionSerialNumber", "TransactionSerialNumber"), JsonRequestBehavior.AllowGet);
 }
        public ActionResult _DeleteServiceOrderPartLines(string uniqueId, string serviceOrderId)
        {
            string userName = null;

            bool isSuccess = false;
            userName = User.Identity.Name.ToString().Split('\\')[1];

            try
            {

                    SerivceOrderPartLine serviceOrderPartLine = new SerivceOrderPartLine();
                    isSuccess = serviceOrderPartLine.DeleteServiceOrderPartItemLines(uniqueId, userName);
                    //TempData["ServiceOrderId"] = Session["SID"].ToString();
                    if (isSuccess)
                    {

                        ViewData["ServiceOrderPartLines"] = GetServiceOrderPartLinesByServiceOrderID(serviceOrderId);

                    }

                TempData.Keep();
            }
            catch (Exception ex)
            {
                TempData.Keep();
                throw ex;
            }
            return View(new GridModel<SerivceOrderPartLine>
            {
                Data = ViewData["ServiceOrderPartLines"] as List<SerivceOrderPartLine>
            });
        }