Ejemplo n.º 1
0
        public RedirectToRouteResult GeneratePatientResource(RegisterPatientViewModel model)
        {
            LabService lab = new LabService();

            lab.CreatePatientResource(model);
            return(RedirectToAction("SearchPatient", "SearchPatient"));
        }
        // GET: LabList
        public ActionResult List()
        {
            LabService lab     = new LabService();
            var        labList = lab.GetLabRequests();

            return(View(labList));
        }
 public void addLab(string newLabType, string newLabName, int newLabResult, string newLabUnit, string newLabResultStatus, Guid?id)
 {
     if (newLabName != string.Empty && newLabName != null && id != null && id != Guid.Empty)
     {
         LaboratoryService _laboratoryService = new LaboratoryService();
         Laboratory        laboratory         = _laboratoryService.get(id);
         if (laboratory == null)
         {
             return;
         }
         Lab lab = new Lab()
         {
             id           = Guid.NewGuid(),
             LabType      = newLabType,
             Name         = newLabName,
             result       = newLabResult,
             Unit         = newLabUnit,
             ResultStatus = newLabResultStatus,
             LaboratoryId = id
         };
         LabService _labService = new LabService();
         _labService.add(lab);
         Response.Write("1");
     }
     else
     {
         Response.Write("9");
     }
 }
Ejemplo n.º 4
0
        public ActionResult PatientLabDetails(string patientLabId)
        {
            var labs = LabService.GetLabTestsForMapping(null);

            if (!string.IsNullOrEmpty(patientLabId))
            {
                var modelObj = LabService.GetPatientWithLabDetail(patientLabId);
                modelObj.LabTestsDd = labs.LabTests;
                return(View(modelObj));
            }

            var model = new AddLabToPatientResponseModel
            {
                LabTestsDd  = labs.LabTests,
                PatientInfo = new App_PatientLab
                {
                    // ReportedOn = DateTime.Now.ToString(),
                    RequestedOn  = DateTime.Now.ToString(),
                    Name         = " ",
                    GuardianName = " ",
                    Phone        = " ",
                    Address      = " "
                }
            };

            return(View(model));
        }
        public ActionResult ListByPatient(string patientId)
        {
            LabService lab     = new LabService();
            var        labList = lab.GetLabRequestsByPatientId(patientId);

            return(View("List", labList));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Atualiza o ambiente de lab para as novas definições
        /// </summary>
        /// <param name="labService"></param>
        /// <param name="envMachineName"></param>
        /// <param name="tfsProjectName"></param>
        /// <param name="environmentName"></param>
        public void UpdateLabEnvironment(LabService labService, string envMachineName, string tfsProjectName, string environmentName)
        {
            var theEnvironment = labService.QueryLabEnvironments(new LabEnvironmentQuerySpec()
            {
                Project = tfsProjectName
            }).First(f => f.Name == environmentName);

            if (theEnvironment != null)
            {
                var theMachine = theEnvironment.LabSystems.First(f => f.Name == envMachineName);

                if (theMachine != null)
                {
                    string testAgentRunningAs = theMachine.Configuration.ConfiguredUserName;
                    string environmentThinksTestAgentRunningAsd = theEnvironment.CodedUIUserName;

                    if (String.Compare(testAgentRunningAs, environmentThinksTestAgentRunningAsd, true) != 0)
                    {
                        labService.UpdateLabEnvironment(theEnvironment.Uri, new LabEnvironmentUpdatePack()
                        {
                            CodedUIUserName = testAgentRunningAs
                        });
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public ILabUser GetUser(UserQueryParameters query)
        {
            ILabService            labService     = new LabService();
            IEnumerable <ILabUser> availableUsers = labService.GetUsers(query).ToList();

            Assert.AreNotEqual(0, availableUsers.Count(), "Found no users for the given query.");
            return(availableUsers.First());
        }
        public ActionResult SendReport(LabResultViewModel modal)
        {
            LabService lab = new LabService();

            lab.SendLabResult(modal);

            return(RedirectToAction("List", "LabList"));
        }
        /// <summary>
        /// Execute the Update Version Number build step.
        /// </summary>
        protected override void InternalExecute()
        {
            //-- Get the input parameters
            string lockingUNCShare = this.ActivityContext.GetValue(this.LockingUNCShare);

            string[] environmentNames = this.ActivityContext.GetValue(this.EnvironmentList);
            int      maximumWaitTime  = this.ActivityContext.GetValue(this.MaximumWaitTimeSeconds);

            //-- Calculate the end time...
            DateTime endTime = DateTime.Now.AddSeconds(maximumWaitTime);

            //-- Get the details about the Project Collection, Build, and LabService...
            TfsTeamProjectCollection tpc = this.ActivityContext.GetExtension <TfsTeamProjectCollection>();
            LabService   labService      = tpc.GetService <LabService>();
            IBuildDetail buildDetail     = this.ActivityContext.GetExtension <IBuildDetail>();

            //-- Get a list of environments that could be used...
            ICollection <LabEnvironment> lstEnvironments = labService.QueryLabEnvironments(new LabEnvironmentQuerySpec {
                Project = buildDetail.TeamProject
            });

            //-- Loop until we have reached the maximum wait time...
            while (maximumWaitTime == 0 || (DateTime.Now < endTime))
            {
                //-- First, lets loop through the environments to see if any have become available...
                foreach (string name in environmentNames)
                {
                    //-- Is the environment locked?
                    if (!File.Exists(Path.Combine(lockingUNCShare, name)))
                    {
                        //-- Locate the environment in the list of potential environments...
                        foreach (LabEnvironment environment in lstEnvironments)
                        {
                            if (environment.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
                            {
                                //-- Get the environment In-Use information...
                                LabEnvironmentInUseMarker marker = environment.GetInUseMarker();
                                if (marker == null)
                                {
                                    //-- The Environment is not in use...
                                    this.ActivityContext.SetValue(this.EnvironmentIsAvailable, true);
                                    return;
                                }

                                break;
                            }
                        }
                    }
                }

                //-- Wait for 5 seconds and try again...
                Thread.Sleep(5000);
            }

            //-- If we reached here, none of the available environments became available...
            this.ActivityContext.SetValue(this.EnvironmentIsAvailable, false);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Obtém ambientes de Lab do TFS
        /// </summary>
        /// <param name="lab">Lab Service</param>
        /// <param name="teamProjectName">Nome do Team project</param>
        /// <returns>Coleção de LabEnvironments</returns>
        public static ICollection <LabEnvironment> GetLabEnvironments(this LabService lab, string teamProjectName)
        {
            LabEnvironmentQuerySpec labSpec = new LabEnvironmentQuerySpec();

            labSpec.Project = teamProjectName;

            ICollection <LabEnvironment> environments = lab.QueryLabEnvironments(labSpec);

            return(environments);
        }
Ejemplo n.º 11
0
        protected override void Execute(CodeActivityContext context)
        {
            #region Mapeamento dos parametros para variaveis:
            Uri    tfsCollection      = context.GetValue(this.TFSCollection);
            string tfsProjectName     = context.GetValue(this.TFSProjectName);
            string tfsUser            = context.GetValue(this.TFSUser);
            string tfsPassword        = context.GetValue(this.TFSPassword);
            string tfsDomain          = context.GetValue(this.TFSDomain);
            string envMachineName     = context.GetValue(this.EnvMachineName);
            string envMachineRoles    = context.GetValue(this.EnvMachineRoles);
            string envEnvironmentName = context.GetValue(this.EnvEnvironmentName);
            string envTestController  = context.GetValue(this.EnvTestController);
            TfsTeamProjectCollection currentTfsTeamProjectCollection = context.GetValue(this.CurrentTfsTeamProjectCollection);
            bool runAsInteractive = true;
            #endregion

            try
            {
                #region Carregamento do serviço de LAB

                System.Net.NetworkCredential credentials =
                    new System.Net.NetworkCredential(tfsUser, tfsPassword, tfsDomain);

                LabService labService = GetLabService(currentTfsTeamProjectCollection, credentials);

                if (labService == null)
                {
                    throw new System.ArgumentOutOfRangeException("Lab Service não encontrado.");
                }

                #endregion

                #region Configura o ambiente

                //Remove ambiente atual com o mesmo nome
                RemoveLabEnvironment(labService, tfsProjectName, envEnvironmentName);

                //Cria novo ambiente
                CreateNewLabEnvironment(labService, runAsInteractive, envEnvironmentName, envTestController, tfsProjectName, envMachineName, envMachineRoles, credentials);

                //Refresh do ambiente
                UpdateLabEnvironment(labService, envMachineName, tfsProjectName, envEnvironmentName);

                Console.WriteLine("Ambiente Criado com Sucesso!");


                #endregion
            }
            catch (Exception ex)
            {
                context.TrackBuildError("Criação do Ambiente falhou:  " + ex.ToString() + ".");
            }
        }
Ejemplo n.º 12
0
        public RedirectToRouteResult Create(LabRequestViewModel model)
        {
            if (TempData.ContainsKey("PatientName"))
            {
                model.Name = (HumanName)TempData["PatientName"];
            }
            string     sample = model.Sample;
            LabService lab    = new LabService();

            lab.SendLabRequest(model);
            return(RedirectToAction("List", "LabList"));
        }
Ejemplo n.º 13
0
 private void btnDummyCall_Click(object sender, EventArgs e)
 {
     LabService svc = new LabService();
     try
     {
         svc.DummyCall();
     }
     catch (Exception ex)
     {
         this.tbResult.Text = ex.Message;
     }
 }
        public SearchPatientViewModel GetPatientDetails(string patientMRN)
        {
            //this.patientMRN = patientId;
            SearchPatientViewModel vm = new SearchPatientViewModel();

            try
            {
                SearchParams parms        = new SearchParams();
                var          resourceLink = string.Format("{0}|{1}", "www.citiustech.com", patientMRN);
                parms.Add("identifier", resourceLink);

                //Reading the Patient details using the FHIR Client
                var patientDetailsRead = FhirClient.Search <Patient>(parms);

                //Serializing the data to json string
                string patientDetails = fhirJsonSerializer.SerializeToString(patientDetailsRead);

                //deserializing the json string to patient model
                Bundle result = (Bundle)fhirJsonParser.Parse(patientDetails, typeof(Bundle));

                vm.patient = result.Entry.Select(Resource => (Patient)Resource.Resource).ToList().FirstOrDefault();

                LabService labService = new LabService();
                if (vm.patient != null)
                {
                    var labResults  = labService.GetLabResultsByPatientId(vm.patient.Id);
                    var labRequests = labService.GetLabResultsByPatientId(vm.patient.Id);

                    vm.LabRequestRawJsonData = JValue.Parse(fhirJsonSerializer.SerializeToString(labResults)).ToString();

                    vm.LabResultRawJsonData = JValue.Parse(fhirJsonSerializer.SerializeToString(labRequests)).ToString();
                }

                //Displaying the RAW json data in the view
                vm.ResourceRawJsonData = JValue.Parse(patientDetails).ToString();
            }
            catch (FhirOperationException FhirOpExec)
            {
                var response           = FhirOpExec.Outcome;
                var errorDetails       = fhirJsonSerializer.SerializeToString(response);
                OperationOutcome error = (OperationOutcome)fhirJsonParser.Parse(errorDetails, typeof(OperationOutcome));
                vm.ResourceRawJsonData = JValue.Parse(errorDetails).ToString();
            }
            catch (WebException ex)
            {
                var response = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
                var error    = JsonConvert.DeserializeObject(response);
                vm.ResourceRawJsonData = error.ToString();
            }

            return(vm);
        }
Ejemplo n.º 15
0
        public ActionResult PatientLabs()
        {
            var patientsWithLabs = LabService.GetPatientWithLabs(new SearchModel
            {
                SearchString = string.Empty,
                Pagging      = new PaggingModel
                {
                    Current     = 0,
                    ItemPerPage = 10
                }
            });

            return(View(patientsWithLabs));
        }
Ejemplo n.º 16
0
        public ActionResult SearchLabTest(string searchTerm)
        {
            var tests = LabService.GetLabTests(new SearchModel
            {
                SearchString = searchTerm,
                Pagging      = new PaggingModel
                {
                    Current     = 0,
                    ItemPerPage = 15
                }
            });

            return(Json(tests, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 17
0
        public ActionResult LabParms()
        {
            var tests = LabService.GetLabParms(new SearchModel
            {
                SearchString = string.Empty,
                Pagging      = new PaggingModel
                {
                    Current     = 0,
                    ItemPerPage = 15
                }
            });

            return(View(tests));
        }
Ejemplo n.º 18
0
        protected override void Execute(CodeActivityContext context)
        {
            // Mapeamento dos parametros para variaveis:
            string tfsServer          = context.GetValue(this.TFSServer);
            string tfsCollection      = context.GetValue(this.TFSCollection);
            string tfsProject         = context.GetValue(this.TFSProject);
            string tfsUser            = context.GetValue(this.TFSUser);
            string tfsPassword        = context.GetValue(this.TFSPassword);
            string tfsDomain          = context.GetValue(this.TFSDomain);
            string envEnvironmentName = context.GetValue(this.EnvEnvironmentName);

            try
            {
                #region Client do TFS e Lab Service

                System.Net.NetworkCredential administratorCredentials =
                    new System.Net.NetworkCredential(tfsUser, tfsPassword, tfsDomain);

                string tfsName = tfsServer + "/" + tfsCollection;
                Uri    uri     = new Uri(tfsName);
                TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(uri, administratorCredentials);

                LabService lab = tfs.GetService <LabService>();

                if (lab == null)
                {
                    throw new System.ArgumentOutOfRangeException("Lab Service não encontrado.");
                }

                #endregion

                #region Obtém o ambiente

                var env = lab.GetLabEnvironments(tfsProject).FirstOrDefault(c => c.Name == envEnvironmentName);

                if (env != null)
                {
                    context.TrackBuildMessage("Ambiente encontrado sob URI: '" + env.Uri.ToString() + "'.", BuildMessageImportance.High);
                    context.SetValue(this.Result, env);
                    context.SetValue(this.ResultUri, env.Uri.ToString());
                }

                #endregion
            }
            catch (Exception ex)
            {
                context.TrackBuildError("Ambiente não pode ser obtido:  " + ex.ToString() + ".");
            }
        }
Ejemplo n.º 19
0
 private void btnInvokeNatural_Click(object sender, EventArgs e)
 {
     LabService svc = new LabService();
     svc.HelloWorldCompleted += (o, ea) => {
         this.tbResult.Text = ea.Result;
     };
     try
     {
         svc.HelloWorldAsync();
     }
     catch (Exception ex)
     {
         this.tbResult.Text = ex.Message;
     }
 }
        public void removeLab(Guid?id)
        {
            if (id == null || id == Guid.Empty)
            {
                return;
            }
            LabService _labService = new LabService();
            Lab        lab         = _labService.get(id);

            if (lab != null)
            {
                _labService.delete(lab);
            }
            Response.Write("1");
        }
Ejemplo n.º 21
0
        public JsonResult SearchParmsForMapping(string term)
        {
            var response = new LabParmsResponseModelDd
            {
                LabParms = new List <AppLab_ParmDd>()
            };

            if (string.IsNullOrEmpty(term))
            {
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
            var tests = LabService.GetLabParmsForMapping(term);

            return(Json(tests, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Remove um ambiente de LAB
        /// </summary>
        /// <param name="labService"></param>
        /// <param name="tfsProjectName"></param>
        /// <param name="environmentName"></param>
        private void RemoveLabEnvironment(LabService labService, string tfsProjectName, string environmentName)
        {
            var labEnvironmentQuerySpec = new LabEnvironmentQuerySpec();

            labEnvironmentQuerySpec.Project     = tfsProjectName;
            labEnvironmentQuerySpec.Disposition = LabEnvironmentDisposition.Active;

            var labEnvironments = labService.QueryLabEnvironments(labEnvironmentQuerySpec);

            foreach (LabEnvironment env in labEnvironments)
            {
                if (env.Name == environmentName)
                {
                    Console.WriteLine("Excluindo ambiente lab '" + environmentName + "'.");
                    env.Destroy();
                }
            }
        }
Ejemplo n.º 23
0
        // GET: ViewResult
        public ActionResult ShowResult(string procedureId)
        {
            try
            {
                LabService lab    = new LabService();
                var        result = lab.GetLabResultByRequestId(procedureId);
                vm.PatientId          = result.PatientId;
                vm.Category           = result.Category;
                vm.ResultGlucoseLevel = result.ResultGlucoseLevel;
                vm.IssuedDate         = result.IssuedDate;
                vm.Status             = result.Status;
                vm.FhirResource       = result.FhirResource;
            }
            catch (Exception ex)
            {
                if (ex != null)
                {
                    TempData["_Error"] = "Some Error Occurred";
                    return(RedirectToAction("Error", "Error"));
                }
            }

            return(View(vm));
        }
Ejemplo n.º 24
0
        public JsonResult ChangeStatus(AppLab_Test source)
        {
            var test = LabService.SetLabStatus(source);

            return(Json(test, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Cria o novo ambiente de Lab
        /// </summary>
        /// <param name="labService"></param>
        /// <param name="runAsInteractive"></param>
        /// <param name="environmentName"></param>
        /// <param name="testController"></param>
        /// <param name="tfsProjectName"></param>
        /// <param name="envMachineName"></param>
        /// <param name="envMachineRoles"></param>
        /// <param name="credentials"></param>
        private void CreateNewLabEnvironment(LabService labService, bool runAsInteractive, string environmentName, string testController, string tfsProjectName,
                                             string envMachineName, string envMachineRoles, System.Net.NetworkCredential credentials)
        {
            Console.WriteLine("Criando o novo ambiente lab '" + environmentName + "'.");

            #region Parametrização e Criação do ambiente de Lab

            LabSystemDefinition      labSystemDefinition      = new LabSystemDefinition(envMachineName, envMachineName, envMachineRoles);
            LabEnvironmentDefinition labEnvironmentDefinition = new LabEnvironmentDefinition(environmentName, environmentName, new List <LabSystemDefinition>()
            {
                labSystemDefinition
            });

            if (runAsInteractive)
            {
                labEnvironmentDefinition.CodedUIRole     = envMachineRoles;
                labEnvironmentDefinition.CodedUIUserName = String.Format("{0}\\{1}", credentials.Domain, credentials.UserName);
            }

            labEnvironmentDefinition.TestControllerName = testController;

            LabEnvironment newEnvironment = labService.CreateLabEnvironment(tfsProjectName, labEnvironmentDefinition, null, null);

            AccountInformation admin   = new AccountInformation(credentials.Domain, credentials.UserName, credentials.SecurePassword);
            AccountInformation process = null;

            if (runAsInteractive)
            {
                process = new AccountInformation(credentials.Domain, credentials.UserName, credentials.SecurePassword);
            }
            #endregion

            #region Instalação do test agent
            // Primeira Máquina virtual. para efeito de Demo usando apenas uma máquina.
            // deve-se alterar para procesar várias máquinas
            LabSystem themachine = newEnvironment.LabSystems[0];

            //Instala o agente
            themachine.InstallTestAgent(admin, process);
            #endregion

            #region Aguarda o ambiente ficar em estado PRONTO
            while (newEnvironment.StatusInfo.State != LabEnvironmentState.Ready && newEnvironment.StatusInfo.FailureReason == null)
            {
                Console.WriteLine(String.Format("Status da criação: {0}", newEnvironment.StatusInfo.State));

                foreach (var sm in themachine.StatusMessages)
                {
                    Console.WriteLine(sm.Message);
                }

                System.Threading.Thread.Sleep(9000);

                newEnvironment = labService.QueryLabEnvironments(new LabEnvironmentQuerySpec()
                {
                    Project = tfsProjectName
                }).First(f => f.Name == environmentName);
                themachine = newEnvironment.LabSystems[0];
            }
            #endregion
        }
Ejemplo n.º 26
0
 public JsonResult DeleteTest(AppLab_Test source)
 {
     LabService.DeleteTest(source);
     return(Json(true, JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 27
0
        public JsonResult SearchLabsForMapping(string term)
        {
            var tests = LabService.GetLabTestsForMapping(term);

            return(Json(tests, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 28
0
        public JsonResult GetPatientByMrNo(string mrNo)
        {
            var data = LabService.GetPatientByMrNo(mrNo);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 29
0
        public JsonResult CreateMixReport(CreateMixReportModel request)
        {
            var lab = LabService.AddMixReport(request);

            return(Json(lab, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 30
0
        public JsonResult RemovePatientLab(App_PatientLabs_Labs model)
        {
            var fee = LabService.RemovePatientLab(model);

            return(Json(fee, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 31
0
        public JsonResult AddUpdateTest(AppLab_Test source)
        {
            var newTest = LabService.AddUpdateTest(source);

            return(Json(newTest, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 32
0
        public JsonResult SearchLabs(SearchModel model)
        {
            var tests = LabService.GetLabTests(model);

            return(Json(tests, JsonRequestBehavior.AllowGet));
        }