public async Task TestsSystemInformation() { string filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestsSystemInformation.h5"); Console.WriteLine(filename); if (File.Exists(filename)) { File.Delete(filename); } kama = new KamaAcquisitionFile(filename, AcquisitionInterface.Simulator, Logger); ProcedureInfo info = new ProcedureInfo { Age = 18, FirstName = "First", LastName = "Last", ExamDate = DateTime.Now, Procedure = "test", ProcedureID = "ID", Patient = new PatientInfo() }; kama.SavePatientInfo(info); kama.UpdateSystemInformation("32423423", new[] { "11", "12" }); await kama.StopProcedure(); File.Delete(filename); }
public async Task TestEventsWrite() { string filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testEvents.h5"); Console.WriteLine(filename); if (File.Exists(filename)) { File.Delete(filename); } kama = new KamaAcquisitionFile(filename, AcquisitionInterface.Simulator, Logger); ProcedureInfo info = new ProcedureInfo { Age = 18, FirstName = "First", LastName = "Last", ExamDate = DateTime.Now, Procedure = "test", ProcedureID = "ID", Patient = new PatientInfo() }; kama.SavePatientInfo(info); kama.UpdateSystemInformation("32423423", new[] { "11", "12" }); string data = File.ReadAllText(AcquisitionScanProtocolPath); AcquisitionProtocolParameters parameters = AcquisitionProtocolParameters.FromJson(data); await kama.StartLogging(parameters); kama.StopRecording(); await kama.StopProcedure(); File.Delete(filename); }
public async Task TestFullFileWriteRead() { string filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test2.h5"); Console.WriteLine(filename); if (File.Exists(filename)) { File.Delete(filename); } kama = new KamaAcquisitionFile(filename, AcquisitionInterface.Simulator, Logger); ProcedureInfo info = new ProcedureInfo { Age = 18, FirstName = "Lior", LastName = "Banai", ExamDate = DateTime.Now, Procedure = "test", ProcedureID = "ID", Patient = new PatientInfo() }; kama.SavePatientInfo(info); kama.UpdateSystemInformation("32423423", new[] { "11", "12" }); kama.SetProcedureInformation(info); string data = File.ReadAllText(AcquisitionScanProtocolPath); AcquisitionProtocolParameters parameters = AcquisitionProtocolParameters.FromJson(data); await kama.StartLogging(parameters); var ecgTask = WriteECGData(kama, 2, 1); var eitTask = WriteEITData(parameters, kama, 5, 1); var seTask = WriteSystemEvents(kama); await Task.WhenAll(ecgTask, eitTask, seTask); var ecgTestData = await ecgTask; var eitsTestData = await eitTask; kama.StopRecording(); await kama.StopProcedure(); using (KamaAcquisitionReadOnlyFile readFile = new KamaAcquisitionReadOnlyFile(filename)) { readFile.ReadSystemInformation(); readFile.ReadProcedureInformation(); readFile.ReadPatientInformation(); Assert.IsTrue(readFile.PatientInformation.Equals(kama.PatientInfo)); Assert.IsTrue(readFile.ProcedureInformation.Equals(kama.ProcedureInformation)); Assert.IsTrue(readFile.SystemInformation.Equals(kama.SystemInformation)); readFile.ReadECGData(); readFile.ReadEITData(); Assert.IsTrue(readFile.EITs.SequenceEqual(eitsTestData)); readFile.ReadSystemEvents(); Assert.IsTrue(readFile.Events.Count == 100); } File.Delete(filename); }
public StoredProcedureRtt( ProcedureInfo procedureInfo, IDiagnosticsCallback diagnosticsCallback, IFormatInfo formatInfo) : base(diagnosticsCallback, formatInfo) { Procedure = procedureInfo; }
public void SavePatientInfo(ProcedureInfo procedureInfo) { PatientInfo = new Patient(fileId, groupRoot, Logger) { FirstName = procedureInfo.FirstName, LastName = procedureInfo.LastName, Age = procedureInfo.Age, ExamDate = procedureInfo.ExamDate, Gender = "unknown", }; PatientInfo.FlushDataAndCloseObject(); }
public GXProcedure() { #if !NETCORE if (Preferences.Instrumented) { string name = this.GetType().ToString(); beginExecute = DateTime.Now; pInfo = ProceduresInfo.addProcedureInfo(name); pInfo.incCount(); } #endif }
private void CreatePatientDetails(KamaAcquisitionFile file) { ProcedureInfo info = new ProcedureInfo { Age = 18, FirstName = "First", LastName = "Last", ExamDate = DateTime.Now, Procedure = "test", ProcedureID = "ID", Patient = new PatientInfo() }; file.SavePatientInfo(info); }
public IActionResult GetTestProcedureData() { ProcedureInfo procedureInfo = new ProcedureInfo() { AdminName = "管理员", OperationTime = DateTime.Now, Namespace = "ToolGood.SqlOnline", ServerName = "测试服务器", ServerType = "SqlServer", DatabaseName = "ToolGood", SchemaName = "dbo", ProcedureName = "Pro_WriteLog", Comment = "成员表", Params = new List <ProcedureParameter>() { new ProcedureParameter() { Index = 1, ParamName = "AdminName", Type = "nvarchar", Length = "200", }, new ProcedureParameter() { Index = 2, ParamName = "AdminId", Type = "int", }, new ProcedureParameter() { Index = 3, ParamName = "Log", Type = "nvarchar", Length = "2000", }, new ProcedureParameter() { Index = 4, ParamName = "AddingTime", Type = "datatime", } } }; return(Success(procedureInfo, null)); }
ProcedureInfo GetProcedureInfoInternal(string proc, string importspec) { if (string.IsNullOrEmpty(proc)) { throw new ArgumentException("proc cannot be null or empty"); } if (string.IsNullOrEmpty(importspec)) { throw new ArgumentException("importspec cannot be null or empty"); } try { Callable c = @"(lambda (maker) (let ((p (eval {0} {1}))) (let ((forms (call-with-values (lambda () (procedure-form p)) vector))) (maker (symbol->string {0}) forms))))".Eval <Callable>(SymbolTable.StringToObject(proc), importspec.Eval()); CallTarget2 maker = (n, forms) => { var f = forms as object[]; List <string> ff = new List <string>(); foreach (Cons fc in f) { ff.Add(fc.PrettyPrint.TrimEnd('\n')); } var pi = new ProcedureInfo { Name = n as string, Forms = ff.ToArray() }; return(pi); }; return(c.Call(Closure.Create(maker)) as ProcedureInfo); } catch (Exception ex) { throw new EvaluationException(ex.ToString()); } }
private void menuitemSaveTestAs_Click(object sender, RoutedEventArgs e) { try { if (datagridProcedureInfo.SelectedItem != null) { ProcedureInfo selected_test_info = (ProcedureInfo)datagridProcedureInfo.SelectedItem; SaveFileDialog save_file_dialog = new SaveFileDialog() { Filter = "Word документ (*.docx)|*.docx|Zip архив (*.zip)|*.zip" }; if (save_file_dialog.ShowDialog() == true) { string filename = save_file_dialog.FileName; switch (filename.Substring(filename.LastIndexOf('.') + 1)) { case "docx": DocumentGenerator.CreateTestReport(selected_test_info.Patient, selected_test_info.Test, filename); break; case "zip": string directorypath = System.IO.Path.GetDirectoryName(filename); filename = filename.Substring(filename.LastIndexOf(@"\") + 1, filename.LastIndexOf(".") - filename.LastIndexOf(@"\") - 1); Directory.CreateDirectory(directorypath + @"\" + filename); DocumentGenerator.CreateTestReport(selected_test_info.Patient, selected_test_info.Test, directorypath + @"\" + filename + @"\" + filename + ".docx"); foreach (var attachment in selected_test_info.Test.Attachments) { File.WriteAllBytes(directorypath + @"\" + filename + @"\" + attachment.Name, attachment.Item); } ZipFile.CreateFromDirectory(directorypath + @"\" + filename, directorypath + @"\" + filename + ".zip"); Directory.Delete(directorypath + @"\" + filename, true); break; } } } } catch (Exception exception) { string message = String.Format("Обнаружена проблема при работе программы!\n{0}", exception.Message); MessageBox.Show(message, "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public async Task <ProcedureInfo> GetProcedureInfo(int connId, string databaseName, string schemaName, string name) { const string sql = @"select Name,SqlType,ConnectionString from SqlConn where Id=@0 and IsDelete=0"; var helper = GetReadHelper(); var connDto = await helper.FirstOrDefault_Async <SqlConnDto>(sql, connId); if (connDto == null) { return(new ProcedureInfo()); } var provider = SqlCache.Instance.GetSqlProcedureProvider(connDto.SqlType); var procedure = provider.GetProcedure(connDto.ConnectionString, databaseName, schemaName, name); var procedureParams = provider.GetProcedureParams(connDto.ConnectionString, databaseName, schemaName, name); ProcedureInfo procedureInfo = new ProcedureInfo() { AdminName = "System", ServerName = connDto.Name, ServerType = connDto.SqlType, DatabaseName = databaseName, SchemaName = schemaName, ProcedureName = procedure.ProcedureName, Comment = procedure.Comment, OperationTime = System.DateTime.Now, Params = new List <ProcedureParameter>() }; for (int i = 0; i < procedureParams.Count; i++) { var column = procedureParams[i]; procedureInfo.Params.Add(new ProcedureParameter() { Index = i, ParamName = column.ParamName, Type = column.Type, Length = column.Length, Precision = column.Precision, Scale = column.Scale, IsOutput = column.IsOutput }); } return(procedureInfo); }
private void OnProcedureSelected(object sender, Tuple <Procedure, string> info) { DisposeAndClear(splitContainerRight.Panel2.Controls); var procedureInfoControl = new ProcedureInfo(info.Item1, this) { Dock = DockStyle.Fill, VerticalScroll = { Enabled = true } }; splitContainerRight.Panel2.Controls.Add(procedureInfoControl); procedureInfoControl.OnProcedureSelected += CodeBoxOnWordSelected; if (sender == codeBox) { return; } codeBox.FindNext(@"^.{7}" + info.Item1.Name + @"(\.| +USING| OF)", false, true, false, true); if (!string.IsNullOrWhiteSpace(info.Item2)) { codeBox.FindNext(@"PERFORM +" + info.Item2, false, true, false); // NOT first search } }
private OracleParameter[] Dp2Op(string owner, string storedProcedureName, Dictionary <string, object> commandParameters, out Dictionary <string, string> tmpIpMappingOp) { tmpIpMappingOp = new Dictionary <string, string>(); if (commandParameters == null) { return(null); } string package = string.Empty; string procName = string.Empty; string[] tmpArr = storedProcedureName.Split('.'); if (tmpArr.Length == 1) { procName = tmpArr[0]; } else if (tmpArr.Length == 2) { package = tmpArr[0]; procName = tmpArr[1]; } if (!string.IsNullOrEmpty(procName)) { string cacheKey = string.Format("{0}.{1}", owner, storedProcedureName); object cacheObj = paramCache[cacheKey]; List <ProcedureInfo> procedureInfoList; if (cacheObj != null) { procedureInfoList = (List <ProcedureInfo>)cacheObj; } else { procedureInfoList = new List <ProcedureInfo>(); string sql = @"SELECT t.object_name, t.argument_name, t.data_type, t.in_out, t.data_length, t.data_precision, t.data_scale FROM dba_arguments t WHERE t.owner=:owner AND t.package_name = :i_package_name AND t.object_name = :i_object_name ORDER BY t.position"; OracleParameter[] sqlParams = new OracleParameter[] { new OracleParameter(":owner", OracleDbType.Varchar2, 50, owner.ToUpper(), ParameterDirection.Input), new OracleParameter(":i_package_name", OracleDbType.Varchar2, 50, package.ToUpper(), ParameterDirection.Input), new OracleParameter(":i_object_name", OracleDbType.Varchar2, 50, procName.ToUpper(), ParameterDirection.Input) }; OracleDataReader odr = OracleHelper.ExecuteReader(connectionString, CommandType.Text, sql, sqlParams); while (odr.Read()) { int dataLength = 0;//dataPrecision = 0, dataScale = 0; int.TryParse(odr["DATA_LENGTH"].ToString(), out dataLength); ProcedureInfo pi = new ProcedureInfo(); pi.ArgumentName = odr["ARGUMENT_NAME"].ToString(); pi.DataType = odr["DATA_TYPE"].ToString().Replace(" ", ""); pi.DataLength = dataLength; pi.InOut = odr["IN_OUT"].ToString(); procedureInfoList.Add(pi); } odr.Close(); paramCache.Add(cacheKey, procedureInfoList); } List <OracleParameter> buildSqlParams = new List <OracleParameter>(); foreach (var item in commandParameters) { tmpIpMappingOp.Add(item.Key.ToUpper(), item.Key); } foreach (ProcedureInfo pi in procedureInfoList) { string argument_name = pi.ArgumentName; object paramValue = null; if (tmpIpMappingOp.ContainsKey(argument_name)) { paramValue = commandParameters[tmpIpMappingOp[argument_name]]; } string data_type = pi.DataType; OracleType otTataType = (OracleType)Enum.Parse(typeof(OracleType), data_type); int enumIndex = (int)otTataType; string in_out = pi.InOut; int dataLength = pi.DataLength; //int.TryParse(odr["DATA_PRECISION"].ToString(), out dataPrecision); //int.TryParse(odr["DATA_SCALE"].ToString(), out dataScale); if (in_out.Equals("IN")) { switch (otTataType) { case OracleType.VARCHAR2: case OracleType.NVARCHAR2: case OracleType.CHAR: case OracleType.NCHAR: buildSqlParams.Add(new OracleParameter(argument_name, (OracleDbType)enumIndex, dataLength, paramValue, ParameterDirection.Input)); break; default: buildSqlParams.Add(new OracleParameter(argument_name, (OracleDbType)enumIndex, dataLength, paramValue, ParameterDirection.Input)); break; } } else if (in_out.Equals("OUT")) { switch (otTataType) { case OracleType.VARCHAR2: case OracleType.NVARCHAR2: case OracleType.CHAR: case OracleType.NCHAR: buildSqlParams.Add(new OracleParameter(argument_name, (OracleDbType)enumIndex, 4000, string.Empty, ParameterDirection.Output)); break; default: buildSqlParams.Add(new OracleParameter(argument_name, (OracleDbType)enumIndex, ParameterDirection.Output)); break; } } } return(buildSqlParams.ToArray()); } else { return(null); } }
public void SetProcedureInformation(ProcedureInfo procedureInfo) { ProcedureInformation.ProcedureType = procedureInfo.Procedure; ProcedureInformation.ProcedureID = procedureInfo.ProcedureID; }
private void ShowWordInfo(string word = "", bool findInCode = false, string lookFor = "") { // 1. No CobolFile? Nothing to do. if (CobolFile == null) { return; } // 2. No CobolTree? Show Program infos if (CobolFile.CobolTree == null) { foreach (Control control in splitContainerRight.Panel2.Controls) { control.Dispose(); } splitContainerRight.Panel2.Controls.Clear(); var fileInfoControl = new ProgramInfo(CobolFile, this) { Dock = DockStyle.Fill }; splitContainerRight.Panel2.Controls.Add(fileInfoControl); return; } // dispose of current info foreach (Control control in splitContainerRight.Panel2.Controls) { control.Dispose(); } splitContainerRight.Panel2.Controls.Clear(); // 3. Is the word a variable? if (CobolFile.Variables.ContainsKey(word)) { var variableInfoControl = new VariableInfo(CobolFile.Variables[word], this) { Dock = DockStyle.Fill }; splitContainerRight.Panel2.Controls.Add(variableInfoControl); if (findInCode) { codeBox.FindNext(word, false, false, true, true); } return; } // 4. Is the word a procedure? var procedure = CobolFile.CobolTree.GetAllProcedures().FirstOrDefault(proc => proc.Name == word); if (procedure != null) { var procedureInfoControl = new ProcedureInfo(procedure, this) { Dock = DockStyle.Fill, VerticalScroll = { Enabled = true } }; splitContainerRight.Panel2.Controls.Add(procedureInfoControl); procedureInfoControl.OnWordSelected += (o, args) => ShowWordInfo(args.Word, true, args.LookFor); if (findInCode) { codeBox.FindNext(@"^.{7}" + word + @"(\.| +USING| OF)", false, true, false, true); if (!string.IsNullOrWhiteSpace(lookFor)) { codeBox.FindNext(@"PERFORM +" + lookFor, false, true, false); // NOT first search } } return; } // 5. Is it a section? var section = CobolFile.CobolTree.GetAllSections().FirstOrDefault(sec => sec.Name == word); if (section != null) { if (findInCode) { codeBox.FindNext(@"^.{7}" + word + @"\.", false, true, false, true); } return; } // 6. Call Reference? Open file, keep Info var callRef = CobolFile.CobolTree.CallReferences.FirstOrDefault(call => call.ProgramName == word); if (callRef != null) { MainWindow.OpenFile(callRef.FilePath); return; } var fileInfoControl2 = new ProgramInfo(CobolFile, this) { Dock = DockStyle.Fill }; splitContainerRight.Panel2.Controls.Add(fileInfoControl2); }
public void WhenSubmittingClaim_ShouldUpdateList() { // Arrange var appService = new ServerAppService(_repositoryMock.Object, _apiMock.Object, _dentalApiFactoryServiceMock.Object, _clientCallbackServiceMock.Object); var procedure = new ProcedureInfo { Date = DateTime.Now, Amount = 123, Code = "1234" }; _dentalApiMock.Setup(m => m.GetProcedures(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>())) .Returns(new List <ProcedureInfo> { procedure }); _repositoryMock.Setup(m => m.GetAppointmentById(It.IsAny <string>())).Returns(_appointmentsRepository[0]); _repositoryMock.Setup(m => m.UpdateAppointment(It.IsAny <Api.Repository.Appointment>())) .Callback(() => _appointmentsRepository[0].State = AppointmentState.ValidationCompletedAndClaimSubmitted); _apiMock.Setup(m => m.ValidateSubscriberAndProvider( It.IsAny <ProviderInformation>(), It.IsAny <ProviderAddressInformation>(), It.IsAny <SubscriberInformation>())).Returns(new ValidateSubscriberAndProviderResponse { ProviderValidationStatus = "Valid", SubscriberValidationStatus = "Valid" }); DispatcherHelper.WaitWithDispatcher(2000); var claim = appService.GetClaims(true).First(); // Act var result = appService.ValidateAndSubmitClaim(claim.Id); DispatcherHelper.WaitWithDispatcher(2000); // Assert Assert.AreEqual(SubmitClaimResult.Ok, result); AssertLoadingIndicator(); // skip first 1 (submitted) AssertClaims(appService.GetClaims(false), _appointmentsPms.Skip(1).ToList()); _apiMock.Verify(m => m.ValidateSubscriberAndProvider( It.Is <ProviderInformation>(n => n.NPI == _provider.Npi && n.TIN == _provider.Tin), It.Is <ProviderAddressInformation>(n => n.RenderingAddress1 == _provider.AddressLine1 && n.RenderingCity == _provider.City && n.RenderingAddress2 == _provider.AddressLine2 && n.RenderingState == _provider.State && n.RenderingZip == _provider.ZipCode), It.Is <SubscriberInformation>(n => n.Id == _patientInfo.ChewsiId && n.SubscriberFirstName == _patientInfo.SubscriberFirstName && n.SubscriberLastName == _patientInfo.SubscriberLastName && n.SubscriberDateOfBirth == _patientInfo.BirthDate)), Times.Once); _apiMock.Verify(m => m.ProcessClaim(It.IsAny <string>(), It.Is <ProviderInformation>(n => n.NPI == _provider.Npi && n.TIN == _provider.Tin), It.Is <SubscriberInformation>(n => n.Id == _patientInfo.ChewsiId && n.PatientFirstName == _patientInfo.PatientFirstName && n.PatientLastName == _patientInfo.PatientLastName && n.SubscriberFirstName == _patientInfo.SubscriberFirstName && n.SubscriberLastName == _patientInfo.SubscriberLastName && n.SubscriberDateOfBirth == _patientInfo.BirthDate), It.Is <List <ClaimLine> >(n => n[0].DateOfService == procedure.Date.ToString("d") && n[0].ProcedureCharge == procedure.Amount.ToString("F") && n[0].ProcedureCode == procedure.Code), It.IsAny <DateTime>()), Times.Once); AssertLoadingIndicator(); _dialogServiceMock.Verify(m => m.Show(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Never, "Shouldn't have popup messages"); }
public void AddProcedure(ProcedureInfo info) { _ixProceduresByFullName.GetOrAdd(info.FullName, info); }
static ProcedureInfo GetProcedureInfoInternal(string proc, string importspec) { if (string.IsNullOrEmpty(proc)) { throw new ArgumentException("proc cannot be null or empty"); } if (string.IsNullOrEmpty(importspec)) { throw new ArgumentException("importspec cannot be null or empty"); } try { Callable c = @"(lambda (maker) (let ((p (eval {0} {1}))) (let ((forms (call-with-values (lambda () (procedure-form p)) vector))) (maker (symbol->string {0}) forms))))".Eval<Callable>(SymbolTable.StringToObject(proc), importspec.Eval()); CallTarget2 maker = (n, forms) => { var f = forms as object[]; List<string> ff = new List<string>(); foreach (Cons fc in f) { ff.Add(fc.PrettyPrint.TrimEnd('\n')); } var pi = new ProcedureInfo { Name = n as string, Forms = ff.ToArray() }; return pi; }; return c.Call(Closure.Create(maker)) as ProcedureInfo; } catch (Exception ex) { throw new EvaluationException(ex.ToString()); } }