Exemplo n.º 1
0
		/////<summary>Returns a list of code systems in the code system table.  This query will change from version to version depending on what code systems we have available.</summary>
		//public static List<CodeSystem> GetForCurrentVersionNoSnomed() {
		//	if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
		//		return Meth.GetObject<List<CodeSystem>>(MethodBase.GetCurrentMethod());
		//	}
		//	//string command="SELECT * FROM codesystem WHERE CodeSystemName!='AdministrativeSex' AND CodeSystemName!='CDT'";
		//	string command="SELECT * FROM codesystem WHERE CodeSystemName IN ('ICD9CM','RXNORM','CPT')";
		//	return Crud.CodeSystemCrud.SelectMany(command);
		//}

		///<summary></summary>
		public static void Update(CodeSystem codeSystem){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				Meth.GetVoid(MethodBase.GetCurrentMethod(),codeSystem);
				return;
			}
			Crud.CodeSystemCrud.Update(codeSystem);
		}
Exemplo n.º 2
0
		///<summary>Updates VersionCurrent to the VersionAvail of the codeSystem object passed in. Used by code system importer after successful import.</summary>
		public static void UpdateCurrentVersion(CodeSystem codeSystem) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),codeSystem);
				return;
			}
			codeSystem.VersionCur=codeSystem.VersionAvail;
			Crud.CodeSystemCrud.Update(codeSystem);
		}
Exemplo n.º 3
0
        /////<summary>Returns a list of code systems in the code system table.  This query will change from version to version depending on what code systems we have available.</summary>
        //public static List<CodeSystem> GetForCurrentVersionNoSnomed() {
        //	if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
        //		return Meth.GetObject<List<CodeSystem>>(MethodBase.GetCurrentMethod());
        //	}
        //	//string command="SELECT * FROM codesystem WHERE CodeSystemName!='AdministrativeSex' AND CodeSystemName!='CDT'";
        //	string command="SELECT * FROM codesystem WHERE CodeSystemName IN ('ICD9CM','RXNORM','CPT')";
        //	return Crud.CodeSystemCrud.SelectMany(command);
        //}

        ///<summary></summary>
        public static void Update(CodeSystem codeSystem)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), codeSystem);
                return;
            }
            Crud.CodeSystemCrud.Update(codeSystem);
        }
Exemplo n.º 4
0
 ///<summary>Updates VersionCurrent to the VersionAvail of the codeSystem object passed in. Used by code system importer after successful import.</summary>
 public static void UpdateCurrentVersion(CodeSystem codeSystem)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), codeSystem);
         return;
     }
     codeSystem.VersionCur = codeSystem.VersionAvail;
     Crud.CodeSystemCrud.Update(codeSystem);
 }
Exemplo n.º 5
0
		///<summary>Updates VersionCurrent to the versionID passed in. Used by code system importer after successful import.  Currently only used for CPT.</summary>
		public static void UpdateCurrentVersion(CodeSystem codeSystem, string versionID) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),codeSystem,versionID);
				return;
			}
			if(string.Compare(codeSystem.VersionCur,versionID)>0) {  //If versionCur is newer than the version you just imported, don't update it.
				return;
			}
			codeSystem.VersionCur=versionID;
			Crud.CodeSystemCrud.Update(codeSystem);
		}
Exemplo n.º 6
0
 ///<summary>Updates VersionCurrent to the versionID passed in. Used by code system importer after successful import.  Currently only used for CPT.</summary>
 public static void UpdateCurrentVersion(CodeSystem codeSystem, string versionID)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), codeSystem, versionID);
         return;
     }
     if (string.Compare(codeSystem.VersionCur, versionID) > 0)            //If versionCur is newer than the version you just imported, don't update it.
     {
         return;
     }
     codeSystem.VersionCur = versionID;
     Crud.CodeSystemCrud.Update(codeSystem);
 }
			///<summary>Add a thread to the queue. These threads will not be started until StartAll is called subsequent to adding all necessary threads. This version assures that code system file will be downloaded before import. Use for all code system except CPT.</summary>
			public static void Add(CodeSystem codeSystem,UpdateCodeSystemArgs onUpdateHandler) {
				Add("",codeSystem,onUpdateHandler);
			}
			///<summary>Add a thread to the queue. These threads will not be started until StartAll is called subsequent to adding all necessary threads. If localFilePath is set here then it is assumed that the file exists locally and file download will be skipped before importing data from the file. This will only happen for the CPT code system.</summary>
			public static void Add(string localFilePath,CodeSystem codeSystem,UpdateCodeSystemArgs onUpdateHandler) {
				UpdateCodeSystemThread thread=new UpdateCodeSystemThread(localFilePath,codeSystem,onUpdateHandler);
				lock(_lock) {
					_threads.Add(thread);
				}
			}
			///<summary>Private ctor. Will only be used internally by Add. If localFilePath is set here then it is assumed that the file exists locally and file download will be skipped before importing data from the file. This will only happen for the CPT code system.</summary>
			private UpdateCodeSystemThread(string localFilePath,CodeSystem codeSystem,UpdateCodeSystemArgs onUpdateHandler) {
				_localFilePath=localFilePath;
				_codeSystem=codeSystem;
				_updateHandler+=onUpdateHandler;
			}
		///<summary>Do not call this directly from external thread. Use UpdateCodeSystemThread_UpdateSafe.</summary>
		private void UpdateCodeSystemThread_UpdateUnsafe(CodeSystem codeSystem,string status,double percentDone,bool done,bool success) {
			//This is called a lot from the import threads so don't bother with the full FillGrid. Just find our row and column and update the cell's text.
			for(int i=0;i<gridMain.Rows.Count;i++) {
				if(gridMain.Rows[i].Tag==null 
					|| !(gridMain.Rows[i].Tag is CodeSystem)
					|| !(((CodeSystem)gridMain.Rows[i].Tag).CodeSystemName==codeSystem.CodeSystemName)) {
					continue;
				}
				string cellText=((int)percentDone)+"%"+" -- "+status;
				if(done) {
					if(success) {
						cellText=Lan.g("CodeSystemImporter","Import complete")+"!";
					}
					else {
						cellText=Lan.g("CodeSystemImporter","Import failed")+"! -- "+status;
					}
				}
				gridMain.Rows[i].Cells[3].Text=cellText;
			}
			gridMain.Invalidate();
		}
		///<summary>Call this from external thread. Invokes to main thread to avoid cross-thread collision.</summary>
		private void UpdateCodeSystemThread_UpdateSafe(CodeSystem codeSystem,string status,double percentDone,bool done,bool success) {
			try {
				this.BeginInvoke(new UpdateCodeSystemThread.UpdateCodeSystemArgs(UpdateCodeSystemThread_UpdateUnsafe),new object[] { codeSystem,status,percentDone,done,success });
			}
			//most likely because form is no longer available to invoke to
			catch { }			
		}
Exemplo n.º 12
0
			///<summary>Private ctor. Will only be used internally by Add. If localFilePath is set here then it is assumed that the file exists locally and file download will be skipped before importing data from the file. This will only happen for the CPT code system.</summary>
			private UpdateCodeSystemThread(string localFilePath,CodeSystem codeSystem,UpdateCodeSystemArgs onUpdateHandler, string versionID) {
				_localFilePath=localFilePath;
				_codeSystem=codeSystem;
				_updateHandler+=onUpdateHandler;
				_versionID=versionID;
			}
Exemplo n.º 13
0
		///<summary>Do not call this directly from external thread. Use UpdateCodeSystemThread_UpdateSafe.</summary>
		private void UpdateCodeSystemThread_UpdateUnsafe(CodeSystem codeSystem,string status,double percentDone,bool done,bool success) {
			//This is called a lot from the import threads so don't bother with the full FillGrid. Just find our row and column and update the cell's text.
			gridMain.BeginUpdate();
			for(int i=0;i<gridMain.Rows.Count;i++) {
				if(gridMain.Rows[i].Tag==null 
					|| !(gridMain.Rows[i].Tag is CodeSystem)
					|| !(((CodeSystem)gridMain.Rows[i].Tag).CodeSystemName==codeSystem.CodeSystemName)) {
					continue;
				}
				string cellText=((int)percentDone)+"%"+" -- "+status;
				if(done) {
					if(success) {
						//If done==true percentDone is the number of codes that were imported, not the percent done.  
						//This is done so we don't have to change the signatures of exisiting functions but can still alert the user when no codes were actually imported.
						cellText=Lan.g("CodeSystemImporter","Import complete")+"! -- "+Lan.g("CodeSystemImporter","Number of codes imported")+": "+Convert.ToInt32(percentDone).ToString();
					}
					else {
						cellText=Lan.g("CodeSystemImporter","Import failed")+"! -- "+status;
					}
				}
				gridMain.Rows[i].Cells[3].Text=cellText;
			}
			gridMain.EndUpdate();  //Need to call this instead of gridMain.Invalidate() because we need text wrapping to happen if there was a long error message.
		}