Exemplo n.º 1
0
        public Task <IHttpActionResult> Get(long id)
        {
            IHttpActionResult result = NotFound();

            try
            {
                var modelFilter = new SOFTTEK.SCMS.Entity.PM.WorkOrder();
                modelFilter.ExternalIdentifier = id.ToString();
                SOFTTEK.SCMS.Foundation.Business.BusinessContext ctx = new SOFTTEK.SCMS.Foundation.Business.BusinessContext
                {
                    SecurityContext = new Foundation.Security.SecurityContext
                    {
                        DeviceID            = GetDeviceIdentifier(),
                        ClientID            = GetToken().Identifier,
                        AuthorizationTicket = GetToken().Identifier,
                        AppID = new System.Configuration.AppSettingsReader().GetValue("S_SRA_APP_idENTIFIER", typeof(string)).ToString()
                    }
                };
                List <SOFTTEK.SCMS.Entity.PM.WorkOrder> listWorkOrder = new List <SOFTTEK.SCMS.Entity.PM.WorkOrder>();
                if (id == 1)
                {
                    List <SOFTTEK.SCMS.Entity.PM.TechnicalObject> listTechnicalObject = new List <Entity.PM.TechnicalObject>();
                    SOFTTEK.SCMS.Business.PM.MaintenanceBO        MaintenanceBO       = new Business.PM.MaintenanceBO(ctx);
                    listTechnicalObject = MaintenanceBO.RetrievePMTechnicalObjects();
                    listWorkOrder       = MaintenanceBO.RetrievePendingWorkOrdersForDevice();
                }
                else
                {
                    SOFTTEK.SCMS.Business.PM.WorkOrderBO pWorkOrderBO = new Business.PM.WorkOrderBO(ctx);
                    listWorkOrder = pWorkOrderBO.SearchWorkOrder(modelFilter);
                }

                if (listWorkOrder.Count > 0)
                {
                    result = Json(listWorkOrder);
                }
            }
            catch (Exception ex)
            {
                result = Error(ex);
            }

            return(Task.FromResult(result));
        }
Exemplo n.º 2
0
        public Task <IHttpActionResult> Get()
        {
            IHttpActionResult result = NotFound();

            var modelFilter = new SOFTTEK.SCMS.Entity.PM.WorkOrder();

            try
            {
                SOFTTEK.SCMS.Foundation.Business.BusinessContext ctx = new SOFTTEK.SCMS.Foundation.Business.BusinessContext
                {
                    SecurityContext = new Foundation.Security.SecurityContext
                    {
                        DeviceID            = GetDeviceIdentifier(),
                        ClientID            = GetToken().Identifier,
                        AuthorizationTicket = GetToken().Identifier,
                        AppID = new System.Configuration.AppSettingsReader().GetValue("S_SRA_APP_idENTIFIER", typeof(string)).ToString()
                    }
                };

                List <SOFTTEK.SCMS.Entity.PM.WorkOrder> listWorkOrder = new List <SOFTTEK.SCMS.Entity.PM.WorkOrder>();

                SOFTTEK.SCMS.Business.PM.WorkOrderBO pWorkOrderBO = new Business.PM.WorkOrderBO(ctx);
                listWorkOrder = pWorkOrderBO.SearchWorkOrder(modelFilter);

                if (listWorkOrder.Count > 0)
                {
                    result = Json(listWorkOrder);
                }
            }
            catch (Exception ex)
            {
                result = Error(ex);
            }

            return(Task.FromResult(result));
        }