private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(IsSelectionMode) { SelectedCvx=(Cvx)gridMain.Rows[e.Row].Tag; DialogResult=DialogResult.OK; return; } }
//If this table type will exist as cached data, uncomment the CachePattern region below. /* #region CachePattern //This region can be eliminated if this is not a table type with cached data. //If leaving this region in place, be sure to add RefreshCache and FillCache //to the Cache.cs file with all the other Cache types. ///<summary>A list of all Cvxs.</summary> private static List<Cvx> listt; ///<summary>A list of all Cvxs.</summary> public static List<Cvx> Listt{ get { if(listt==null) { RefreshCache(); } return listt; } set { listt=value; } } ///<summary></summary> public static DataTable RefreshCache(){ //No need to check RemotingRole; Calls GetTableRemotelyIfNeeded(). string command="SELECT * FROM cvx ORDER BY ItemOrder";//stub query probably needs to be changed DataTable table=Cache.GetTableRemotelyIfNeeded(MethodBase.GetCurrentMethod(),command); table.TableName="Cvx"; FillCache(table); return table; } ///<summary></summary> public static void FillCache(DataTable table){ //No need to check RemotingRole; no call to db. listt=Crud.CvxCrud.TableToList(table); } #endregion */ ///<summary></summary> public static long Insert(Cvx cvx){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ cvx.CvxNum=Meth.GetLong(MethodBase.GetCurrentMethod(),cvx); return cvx.CvxNum; } return Crud.CvxCrud.Insert(cvx); }
///<summary>Called after file is downloaded. Throws exceptions. It is assumed that this is called from a worker thread. Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary> public static void ImportCvx(string tempFileName, ProgressArgs progress, ref bool quit) { if (tempFileName == null) { return; } HashSet <string> codeHash = new HashSet <string>(Cvxs.GetAllCodes()); string[] lines = File.ReadAllLines(tempFileName); string[] arrayCvx; Cvx cvx = new Cvx(); for (int i = 0; i < lines.Length; i++) //each loop should read exactly one line of code. and each line of code should be a unique code { if (quit) { return; } if (i % 100 == 0) { progress(i + 1, lines.Length); } arrayCvx = lines[i].Split('\t'); if (codeHash.Contains(arrayCvx[0])) //code already exists { continue; } cvx.CvxCode = arrayCvx[0]; cvx.Description = arrayCvx[1]; Cvxs.Insert(cvx); } }
private void butOK_Click(object sender,EventArgs e) { //not even visible unless IsSelectionMode if(gridMain.GetSelectedIndex()==-1) { MsgBox.Show(this,"Please select an item first."); return; } SelectedCvx=(Cvx)gridMain.Rows[gridMain.GetSelectedIndex()].Tag; DialogResult=DialogResult.OK; }
//If this table type will exist as cached data, uncomment the CachePattern region below. /* #region CachePattern * //This region can be eliminated if this is not a table type with cached data. * //If leaving this region in place, be sure to add RefreshCache and FillCache * //to the Cache.cs file with all the other Cache types. * * ///<summary>A list of all Cvxs.</summary> * private static List<Cvx> listt; * * ///<summary>A list of all Cvxs.</summary> * public static List<Cvx> Listt{ * get { * if(listt==null) { * RefreshCache(); * } * return listt; * } * set { * listt=value; * } * } * * ///<summary></summary> * public static DataTable RefreshCache(){ * //No need to check RemotingRole; Calls GetTableRemotelyIfNeeded(). * string command="SELECT * FROM cvx ORDER BY ItemOrder";//stub query probably needs to be changed * DataTable table=Cache.GetTableRemotelyIfNeeded(MethodBase.GetCurrentMethod(),command); * table.TableName="Cvx"; * FillCache(table); * return table; * } * * ///<summary></summary> * public static void FillCache(DataTable table){ * //No need to check RemotingRole; no call to db. * listt=Crud.CvxCrud.TableToList(table); * } #endregion */ ///<summary></summary> public static long Insert(Cvx cvx) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { cvx.CvxNum = Meth.GetLong(MethodBase.GetCurrentMethod(), cvx); return(cvx.CvxNum); } return(Crud.CvxCrud.Insert(cvx)); }
///<summary></summary> public static void Update(Cvx cvx) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), cvx); return; } Crud.CvxCrud.Update(cvx); }
///<summary>Called after file is downloaded. Throws exceptions. It is assumed that this is called from a worker thread. Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary> public static void ImportCvx(string tempFileName, ProgressArgs progress, ref bool quit, ref int numCodesImported, ref int numCodesUpdated, bool updateExisting) { if (tempFileName == null) { return; } Dictionary <string, Cvx> dictCodes = Cvxs.GetAll().ToDictionary(x => x.CvxCode, x => x); string[] lines = File.ReadAllLines(tempFileName); string[] arrayCvx; Cvx cvx = new Cvx(); for (int i = 0; i < lines.Length; i++) //each loop should read exactly one line of code. and each line of code should be a unique code { if (quit) { return; } if (i % 100 == 0) { progress(i + 1, lines.Length); } arrayCvx = lines[i].Split('\t'); if (dictCodes.ContainsKey(arrayCvx[0])) //code already exists { cvx = dictCodes[arrayCvx[0]]; if (updateExisting && cvx.Description != arrayCvx[1]) //We do want to update and description is different. { cvx.Description = arrayCvx[1]; Cvxs.Update(cvx); numCodesUpdated++; } continue; } cvx.CvxCode = arrayCvx[0]; cvx.Description = arrayCvx[1]; Cvxs.Insert(cvx); numCodesImported++; } }
///<summary>Called after file is downloaded. Throws exceptions. It is assumed that this is called from a worker thread. Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary> public static void ImportCvx(string tempFileName,ProgressArgs progress,ref bool quit) { if(tempFileName==null) { return; } HashSet<string> codeHash=new HashSet<string>(Cvxs.GetAllCodes()); string[] lines=File.ReadAllLines(tempFileName); string[] arrayCvx; Cvx cvx=new Cvx(); for(int i=0;i<lines.Length;i++) {//each loop should read exactly one line of code. and each line of code should be a unique code if(quit) { return; } if(i%100==0) { progress(i+1,lines.Length); } arrayCvx=lines[i].Split('\t'); if(codeHash.Contains(arrayCvx[0])) {//code already exists continue; } cvx.CvxCode =arrayCvx[0]; cvx.Description =arrayCvx[1]; Cvxs.Insert(cvx); } }
///<summary>Helper for GenerateCCD().</summary> private void GenerateCcdSectionImmunizations(bool hasImmunization) { _w.WriteComment(@" ===================================================================================================== Immunizations ====================================================================================================="); List<VaccinePat> listVaccinePatsFiltered; if(!hasImmunization) { listVaccinePatsFiltered=new List<VaccinePat>(); } else { listVaccinePatsFiltered=_listVaccinePatsFiltered; } Start("component"); Start("section"); TemplateId("2.16.840.1.113883.10.20.22.2.2.1");//Immunizations section with coded entries required. _w.WriteComment("Immunizations section template"); StartAndEnd("code","code","11369-6","codeSystem",strCodeSystemLoinc,"codeSystemName",strCodeSystemNameLoinc,"displayName","History of immunizations"); _w.WriteElementString("title","Immunizations"); Start("text");//The following text will be parsed as html with a style sheet to be human readable. if(listVaccinePatsFiltered.Count>0 && hasImmunization) { Start("table","width","100%","border","1"); Start("thead"); Start("tr"); _w.WriteElementString("th","Vaccine"); _w.WriteElementString("th","Date"); _w.WriteElementString("th","Status"); End("tr"); End("thead"); Start("tbody"); for(int i=0;i<listVaccinePatsFiltered.Count;i++) { VaccineDef vaccineDef; if(listVaccinePatsFiltered[i].VaccineDefNum==0) { vaccineDef=new VaccineDef(); } else { vaccineDef=VaccineDefs.GetOne(listVaccinePatsFiltered[i].VaccineDefNum); } Start("tr"); Cvx cvx; if(String.IsNullOrEmpty(vaccineDef.CVXCode)) { cvx=new Cvx(); } else { cvx=Cvxs.GetOneFromDb(vaccineDef.CVXCode); } if(String.IsNullOrEmpty(cvx.CvxCode)) { _w.WriteElementString("td",""); } else { _w.WriteElementString("td",cvx.CvxCode+" - "+cvx.Description); } if(listVaccinePatsFiltered[i].DateTimeStart.Year<1880) { _w.WriteElementString("td",""); } else { DateText("td",listVaccinePatsFiltered[i].DateTimeStart); } _w.WriteElementString("td","Completed"); End("tr"); } End("tbody"); End("table"); } else { _w.WriteString("None"); } End("text"); if(listVaccinePatsFiltered.Count==0) {//If there are no entries in the filtered list, then we want to add a dummy entry since at least one is required. VaccinePat vacPat=new VaccinePat(); listVaccinePatsFiltered.Add(vacPat); } for(int i=0;i<listVaccinePatsFiltered.Count;i++) { VaccineDef vaccineDef; if(listVaccinePatsFiltered[i].VaccinePatNum==0) { vaccineDef=new VaccineDef(); } else { vaccineDef=VaccineDefs.GetOne(listVaccinePatsFiltered[i].VaccineDefNum); } Start("entry","typeCode","DRIV"); Start("substanceAdministration","classCode","SBADM","moodCode","EVN","negationInd",(listVaccinePatsFiltered[i].CompletionStatus==VaccineCompletionStatus.NotAdministered)?"true":"false"); TemplateId("2.16.840.1.113883.10.20.22.4.52"); _w.WriteComment("Immunization Activity Template"); Guid(); StartAndEnd("statusCode","code","completed"); Start("effectiveTime"); _w.WriteAttributeString("xsi","type",null,"IVL_TS"); if(listVaccinePatsFiltered[i].DateTimeStart.Year<1880) { Attribs("nullFlavor","UNK"); } else { Attribs("value",listVaccinePatsFiltered[i].DateTimeStart.ToString("yyyyMMdd")); } End("effectiveTime"); Start("consumable"); Start("manufacturedProduct","classCode","MANU"); TemplateId("2.16.840.1.113883.10.20.22.4.54"); _w.WriteComment("Immunization Medication Information"); Start("manufacturedMaterial"); if(String.IsNullOrEmpty(vaccineDef.CVXCode)) { StartAndEnd("code","nullFlavor","UNK"); } else { Cvx cvx=Cvxs.GetOneFromDb(vaccineDef.CVXCode); StartAndEnd("code","code",cvx.CvxCode,"codeSystem",strCodeSystemCvx,"displayName",cvx.Description,"codeSystemName",strCodeSystemNameCvx); } End("manufacturedMaterial"); End("manufacturedProduct"); End("consumable"); //Possibly add an Instructions Template End("substanceAdministration"); End("entry"); } End("section"); End("component"); }