public SheetDef(SheetTypeEnum sheetType) { SheetType = sheetType; PageCount = 1; Parameters = SheetParameter.GetForType(sheetType); SheetFieldDefs = new List <SheetFieldDef>(); }
public static string SendSheetParameter(SheetParameter sheetParam) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetString(MethodBase.GetCurrentMethod(), sheetParam)); } return(sheetParam.ParamName); }
public static void SetParameter(Sheet sheet, string paramName, object paramValue) { SheetParameter param = GetParamByName(sheet.Parameters, paramName); if (param == null) { throw new ApplicationException(Lans.g("Sheet", "Parameter not found: ") + paramName); } param.ParamValue = paramValue; }
///<summary>Sheetdefs and sheetfielddefs are archived separately. ///So when we need to use a sheetdef, we must run this method to pull all the associated fields from the archive. ///Then it will be ready for printing, copying, etc.</summary> public static void GetFieldsAndParameters(SheetDef sheetdef) { //No need to check RemotingRole; no call to db. //images first sheetdef.SheetFieldDefs = SheetFieldDefs.GetWhere(x => x.SheetDefNum == sheetdef.SheetDefNum && x.FieldType == SheetFieldType.Image); //then all other fields sheetdef.SheetFieldDefs.AddRange(SheetFieldDefs.GetWhere(x => x.SheetDefNum == sheetdef.SheetDefNum && x.FieldType != SheetFieldType.Image && x.FieldType != SheetFieldType.Parameter));//Defs never store parameters. Fields store filled parameters, but that's different. sheetdef.Parameters = SheetParameter.GetForType(sheetdef.SheetType); }
///<summary>When we need to use a sheet, we must run this method to pull all the associated fields and parameters from the database. Then it will be ready for printing, copying, etc.</summary> public static void GetFieldsAndParameters(Sheet sheet){ //No need to check RemotingRole; no call to db. sheet.SheetFields=GetListForSheet(sheet.SheetNum); //so parameters will also be in the field list, but they will just be ignored from here on out. //because we will have an explicit parameter list instead. sheet.Parameters=new List<SheetParameter>(); SheetParameter param; //int paramVal; for(int i=0;i<sheet.SheetFields.Count;i++){ if(sheet.SheetFields[i].FieldType==SheetFieldType.Parameter){ param=new SheetParameter(true,sheet.SheetFields[i].FieldName,sheet.SheetFields[i].FieldValue); sheet.Parameters.Add(param); } } }
///<summary>When we need to use a sheet, we must run this method to pull all the associated fields and parameters from the database. Then it will be ready for printing, copying, etc.</summary> public static void GetFieldsAndParameters(Sheet sheet) { //No need to check RemotingRole; no call to db. sheet.SheetFields = GetListForSheet(sheet.SheetNum); //so parameters will also be in the field list, but they will just be ignored from here on out. //because we will have an explicit parameter list instead. sheet.Parameters = new List <SheetParameter>(); SheetParameter param; //int paramVal; for (int i = 0; i < sheet.SheetFields.Count; i++) { if (sheet.SheetFields[i].FieldType == SheetFieldType.Parameter) { param = new SheetParameter(true, sheet.SheetFields[i].FieldName, sheet.SheetFields[i].FieldValue); sheet.Parameters.Add(param); } } }
///<summary>Sheetdefs and sheetfielddefs are archived separately. So when we need to use a sheetdef, we must run this method to pull all the associated fields from the archive. Then it will be ready for printing, copying, etc.</summary> public static void GetFieldsAndParameters(SheetDef sheetdef) { //No need to check RemotingRole; no call to db. sheetdef.SheetFieldDefs = new List <SheetFieldDef>(); sheetdef.Parameters = SheetParameter.GetForType(sheetdef.SheetType); //images first for (int i = 0; i < SheetFieldDefC.Listt.Count; i++) { if (SheetFieldDefC.Listt[i].SheetDefNum != sheetdef.SheetDefNum) { continue; } if (SheetFieldDefC.Listt[i].FieldType != SheetFieldType.Image) { continue; } sheetdef.SheetFieldDefs.Add(SheetFieldDefC.Listt[i].Copy()); } //then all other fields for (int i = 0; i < SheetFieldDefC.Listt.Count; i++) { if (SheetFieldDefC.Listt[i].SheetDefNum != sheetdef.SheetDefNum) { continue; } if (SheetFieldDefC.Listt[i].FieldType == SheetFieldType.Image) { continue; } if (SheetFieldDefC.Listt[i].FieldType == SheetFieldType.Parameter) { continue; //sheetfielddefs never store parameters. //sheetfields do store filled parameters, but that's different. } //else{ sheetdef.SheetFieldDefs.Add(SheetFieldDefC.Listt[i].Copy()); //} } }
///<summary>Supply a template sheet as well as a list of primary keys. This method creates a new collection of sheets which each have a parameter of int. It also fills the sheets with data from the database, so no need to run that separately.</summary> public static List<Sheet> CreateBatch(SheetDef sheetDef,List<long> priKeys) { //we'll assume for now that a batch sheet has only one parameter, so no need to check for values. //foreach(SheetParameter param in sheet.Parameters){ // if(param.IsRequired && param.ParamValue==null){ // throw new ApplicationException(Lan.g("Sheet","Parameter not specified for sheet: ")+param.ParamName); // } //} List<Sheet> retVal=new List<Sheet>(); //List<int> paramVals=(List<int>)sheet.Parameters[0].ParamValue; Sheet newSheet; SheetParameter paramNew; for(int i=0;i<priKeys.Count;i++){ newSheet=CreateSheet(sheetDef); newSheet.Parameters=new List<SheetParameter>(); paramNew=new SheetParameter(sheetDef.Parameters[0].IsRequired,sheetDef.Parameters[0].ParamName); paramNew.ParamValue=priKeys[i]; newSheet.Parameters.Add(paramNew); SheetFiller.FillFields(newSheet); retVal.Add(newSheet); } return retVal; }
/// <summary></summary> public static string RunAll() { string retVal=""; //GetString string strResult=WebServiceTests.GetString("Input"); if(strResult!="Input-Processed"){ throw new Exception("Should be Input-Processed"); } retVal+="GetString: Passed.\r\n"; strResult=WebServiceTests.GetStringNull("Input"); if(strResult!=null){ throw new Exception("Should be null"); } retVal+="GetStringNull: Passed.\r\n"; strResult=WebServiceTests.GetStringCarriageReturn("Carriage\r\nReturn"); if(strResult!="Carriage\r\nReturn-Processed") { throw new Exception("Should be Carriage\r\nReturn-Processed"); } retVal+="GetStringCarriageReturn: Passed.\r\n"; //GetInt int intResult=WebServiceTests.GetInt(1); if(intResult!=2){ throw new Exception("Should be 2"); } retVal+="GetInt: Passed.\r\n"; //GetLong long longResult=WebServiceTests.GetLong(1); if(longResult!=2){ throw new Exception("Should be 2"); } retVal+="GetLong: Passed.\r\n"; //GetVoid WebServiceTests.GetVoid(); retVal+="GetVoid: Passed.\r\n"; //GetBool bool boolResult=WebServiceTests.GetBool(); if(boolResult!=true){ throw new Exception("Should be true"); } retVal+="GetBool: Passed.\r\n"; //GetObject Patient pat=WebServiceTests.GetObjectPat(); if(pat.LName!="Smith"){ throw new Exception("Should be Smith"); } if(pat.FName!=null){ throw new Exception("Should be null"); } retVal+="GetObjectPat: Passed.\r\n"; //GetTable DataTable table=WebServiceTests.GetTable(); if(table.Rows[0][0].ToString()!="cell00"){ throw new Exception("Should be cell00"); } retVal+="GetTable: Passed.\r\n"; //GetTable with carriage return table=WebServiceTests.GetTableCarriageReturn(); if(table.Rows[0][0].ToString()!="cell\r\n00"){ throw new Exception("Should be cell\r\n00"); } retVal+="GetTableCarriageReturn: Passed.\r\n"; //Get2by3 table=WebServiceTests.GetTable2by3(); for(int i=0;i<table.Rows.Count;i++) { for(int j=0;j<table.Columns.Count;j++) { if(table.Rows[i][j].ToString()!="cell"+i.ToString()+j.ToString()) { throw new Exception("Should be cell"+i.ToString()+j.ToString()); } } } retVal+="GetTable2by3: Passed.\r\n"; //GetSpecialChars table=WebServiceTests.GetTableSpecialChars(); char[] chars={'|','<','>','&','\'','"','\\','/'}; for(int i=0;i<table.Rows.Count;i++) { for(int j=0;j<table.Columns.Count;j++) { if(table.Rows[i][j].ToString()!="cell"+i.ToString()+j.ToString()+chars[i*2+j].ToString()) { throw new Exception("Should be cell"+i.ToString()+j.ToString()+chars[i*2+j].ToString()); } } } retVal+="GetTableSpecialChars: Passed.\r\n"; //GetDataTypes table=WebServiceTests.GetTableDataTypes(); if(table.Rows[0][0].GetType()!=typeof(string)) { throw new Exception("Should be "+typeof(string).ToString()); } if(table.Rows[0][1].GetType()!=typeof(decimal)) { throw new Exception("Should be "+typeof(decimal).ToString()); } if(table.Rows[0][2].GetType()!=typeof(DateTime)) { throw new Exception("Should be "+typeof(DateTime).ToString()); } retVal+="GetTableDataTypes: Passed.\r\n"; //GetDataSet DataSet ds=WebServiceTests.GetDataSet(); if(ds.Tables[0].TableName!="table0"){ throw new Exception("Should be table0"); } retVal+="GetDataSet: Passed.\r\n"; //GetList List<int> listInt=WebServiceTests.GetListInt(); if(listInt[0]!=2){ throw new Exception("Should be 2"); } retVal+="GetListInt: Passed.\r\n"; //GetArrayPatient Patient[] arrayPat=WebServiceTests.GetArrayPatient(); if(arrayPat[0].LName!="Jones"){ throw new Exception("Should be Jones"); } if(arrayPat[1]!=null){ throw new Exception("Should be null"); } retVal+="GetArrayPatient: Passed.\r\n"; //SendNullParam strResult=WebServiceTests.SendNullParam(null); if(strResult!="nullOK"){ throw new Exception("Should be nullOK"); } retVal+="SendNullParam: Passed.\r\n"; //GetObjectNull Patient pat2=WebServiceTests.GetObjectNull(); if(pat2!=null){ throw new Exception("Should be null"); } retVal+="GetObjectNull: Passed.\r\n"; //SendColorParam Color colorResult=WebServiceTests.SendColorParam(Color.Fuchsia); if(colorResult.ToArgb()!=Color.Green.ToArgb()) { throw new Exception("Should be green."); } retVal+="SendColorParam: Passed.\r\n"; //SendProviderColor Provider prov=new Provider(); prov.ProvColor=Color.Fuchsia; strResult=WebServiceTests.SendProviderColor(prov); if(strResult!="fuchsiaOK") { throw new Exception("Should be fuchsiaOK."); } retVal+="SendProviderColor: Passed.\r\n"; //SendSheetParameter SheetParameter sheetParam=new SheetParameter(false,"ParamNameOK"); strResult=WebServiceTests.SendSheetParameter(sheetParam); if(strResult!="paramNameOK") { throw new Exception("Should be paramNameOK."); } retVal+="SendSheetParameter: Passed.\r\n"; //SendSheetWithFields Sheet sheet=new Sheet(); sheet.SheetFields=new List<SheetField>(); sheet.Parameters=new List<SheetParameter>(); SheetField field=new SheetField(); field.FieldName="FieldNameGreen"; sheet.SheetFields.Add(field); strResult=WebServiceTests.SendSheetWithFields(sheet); if(strResult!="fieldOK") { throw new Exception("Should be fieldOK."); } retVal+="SendSheetWithFields: Passed.\r\n"; //SendSheetDefWithFields SheetDef sheetdef=new SheetDef(); sheetdef.SheetFieldDefs=new List<SheetFieldDef>(); sheetdef.Parameters=new List<SheetParameter>(); SheetFieldDef fielddef=new SheetFieldDef(); fielddef.FieldName="FieldNameTeal"; sheetdef.SheetFieldDefs.Add(fielddef); strResult=WebServiceTests.SendSheetDefWithFieldDefs(sheetdef); if(strResult!="fielddefOK") { throw new Exception("Should be fielddefOK."); } retVal+="SendSheetDefWithFieldDefs: Passed.\r\n"; //TimeSpanNeg TimeSpan tspan=WebServiceTests.GetTimeSpan(); if(tspan!=new TimeSpan(1,0,0)) { throw new Exception("Should be 1 hour."); } retVal+="GetTimeSpan: Passed.\r\n"; //GetStringContainingCR strResult=WebServiceTests.GetStringContainingCR(); //strResult=strResult.Replace("\\r","\r"); if(strResult!="Line1\r\nLine2") { throw new Exception("Should be Line1\r\nLine2"); } retVal+="GetStringContainingCR: Passed.\r\n"; /* //GetListTasksContainingCR Task task=WebServiceTests.GetListTasksContainingCR()[0]; if(task.Descript!="Line1\r\nLine2") { throw new Exception("Should be Line1\r\nLine2"); } retVal+="GetListTasksContainingCR: Passed.\r\n";*/ return retVal; }
///<summary>Called by eClipboard check-in once an appointment has been moved to the waiting room and the patient is ready to fill out forms. ///Returns number of new sheets created and inserted into Sheet table.</summary> public static int CreateSheetsForCheckIn(Appointment appt) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetInt(MethodBase.GetCurrentMethod(), appt)); } if (!MobileAppDevices.IsClinicSignedUpForEClipboard(PrefC.HasClinicsEnabled?appt.ClinicNum:0)) //this clinic isn't signed up for this feature { return(0); } if (!ClinicPrefs.GetBool(PrefName.EClipboardCreateMissingFormsOnCheckIn, appt.ClinicNum)) //This feature is turned off { return(0); } bool useDefault = ClinicPrefs.GetBool(PrefName.EClipboardUseDefaults, appt.ClinicNum); List <EClipboardSheetDef> listSheetsToCreate = EClipboardSheetDefs.GetForClinic(useDefault ? 0 : appt.ClinicNum); if (listSheetsToCreate.Count == 0) //There aren't any sheets to create here { return(0); } List <Sheet> listAlreadyCompleted = Sheets.GetForPatient(appt.PatNum); List <Sheet> listAlreadyInTerminal = Sheets.GetForTerminal(appt.PatNum); //if we already have sheets queued for the patient don't add duplicates if (listAlreadyInTerminal.Count > 0) { listAlreadyCompleted.RemoveAll(x => listAlreadyInTerminal.Select(y => y.SheetNum).Contains(x.SheetNum)); listSheetsToCreate.RemoveAll(x => listAlreadyInTerminal.Select(y => y.SheetDefNum).Contains(x.SheetDefNum)); } byte showInTerminal = GetBiggestShowInTerminal(appt.PatNum); List <Sheet> listNewSheets = new List <Sheet>(); foreach (EClipboardSheetDef sheetInsert in listSheetsToCreate.OrderBy(x => x.ItemOrder)) { //First check if we've already completed this form against our resubmission interval rules DateTime lastCompleted = listAlreadyCompleted .Where(x => x.SheetDefNum == sheetInsert.SheetDefNum) .OrderBy(x => x.DateTimeSheet) .LastOrDefault()?.DateTimeSheet ?? DateTime.MinValue; if (lastCompleted > DateTime.MinValue) { if (sheetInsert.ResubmitInterval.Days == 0) { continue; //If this interval is set to 0 and they've already completed this form once, we never want to create it automatically again } int elapsed = (DateTime.Today - lastCompleted.Date).Days; if (elapsed < sheetInsert.ResubmitInterval.Days) { continue; //The interval hasn't elapsed yet so we don't want to create this sheet } } SheetDef def = SheetDefs.GetSheetDef(sheetInsert.SheetDefNum); Sheet newSheet = CreateSheetFromSheetDef(def, appt.PatNum); SheetParameter.SetParameter(newSheet, "PatNum", appt.PatNum); SheetFiller.FillFields(newSheet); //Counting starts at 1 in this case and we don't want to ovewrite the previous number so increment first newSheet.ShowInTerminal = ++showInTerminal; listNewSheets.Add(newSheet); } SaveNewSheetList(listNewSheets); return(listNewSheets.Count); }
public static string SendSheetParameter(SheetParameter sheetParam) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { return Meth.GetString(MethodBase.GetCurrentMethod(),sheetParam); } if(sheetParam.ParamName=="ParamNameOK") { return "paramNameOK"; } return "error"; }
/// <summary></summary> public static string RunAll() { string retVal=""; //GetString string strResult=WebServiceTests.GetString("Input"); if(strResult!="Input-Processed"){ throw new Exception("Should be Input-Processed"); } retVal+="GetString: Passed.\r\n"; strResult=WebServiceTests.GetStringNull("Input"); if(strResult!=null){ throw new Exception("Should be null"); } retVal+="GetStringNull: Passed.\r\n"; strResult=WebServiceTests.GetStringCarriageReturn("Carriage\r\nReturn"); if(strResult!="Carriage\r\nReturn-Processed") { throw new Exception("Should be Carriage\r\nReturn-Processed"); } retVal+="GetStringCarriageReturn: Passed.\r\n"; //GetInt int intResult=WebServiceTests.GetInt(1); if(intResult!=2){ throw new Exception("Should be 2"); } retVal+="GetInt: Passed.\r\n"; //GetLong long longResult=WebServiceTests.GetLong(1); if(longResult!=2){ throw new Exception("Should be 2"); } retVal+="GetLong: Passed.\r\n"; //GetVoid WebServiceTests.GetVoid(); retVal+="GetVoid: Passed.\r\n"; //GetBool bool boolResult=WebServiceTests.GetBool(); if(boolResult!=true){ throw new Exception("Should be true"); } retVal+="GetBool: Passed.\r\n"; //GetObject Patient pat=WebServiceTests.GetObjectPat(); if(pat.LName!="Smith"){ throw new Exception("Should be Smith"); } if(pat.FName!=null){ throw new Exception("Should be null"); } retVal+="GetObjectPat: Passed.\r\n"; //GetTable DataTable table=WebServiceTests.GetTable(); if(table.Rows[0][0].ToString()!="cell00"){ throw new Exception("Should be cell00"); } retVal+="GetTable: Passed.\r\n"; //GetTable with carriage return table=WebServiceTests.GetTableCarriageReturn(); if(table.Rows[0][0].ToString()!="cell\r\n00"){ throw new Exception("Should be cell\r\n00"); } retVal+="GetTableCarriageReturn: Passed.\r\n"; //GetDataSet DataSet ds=WebServiceTests.GetDataSet(); if(ds.Tables[0].TableName!="table0"){ throw new Exception("Should be table0"); } retVal+="GetDataSet: Passed.\r\n"; //GetList List<int> listInt=WebServiceTests.GetListInt(); if(listInt[0]!=2){ throw new Exception("Should be 2"); } retVal+="GetListInt: Passed.\r\n"; //GetArrayPatient Patient[] arrayPat=WebServiceTests.GetArrayPatient(); if(arrayPat[0].LName!="Jones"){ throw new Exception("Should be Jones"); } if(arrayPat[1]!=null){ throw new Exception("Should be null"); } retVal+="GetArrayPatient: Passed.\r\n"; //SendNullParam strResult=WebServiceTests.SendNullParam(null); if(strResult!="nullOK"){ throw new Exception("Should be nullOK"); } retVal+="SendNullParam: Passed.\r\n"; //GetObjectNull Patient pat2=WebServiceTests.GetObjectNull(); if(pat2!=null){ throw new Exception("Should be null"); } retVal+="GetObjectNull: Passed.\r\n"; //SendColorParam Color colorResult=WebServiceTests.SendColorParam(Color.Fuchsia); if(colorResult.ToArgb()!=Color.Green.ToArgb()) { throw new Exception("Should be green."); } retVal+="SendColorParam: Passed.\r\n"; //SendProviderColor Provider prov=new Provider(); prov.ProvColor=Color.Fuchsia; strResult=WebServiceTests.SendProviderColor(prov); if(strResult!="fuchsiaOK") { throw new Exception("Should be fuchsiaOK."); } retVal+="SendProviderColor: Passed.\r\n"; //SendSheetParameter SheetParameter sheetParam=new SheetParameter(false,"ParamNameOK"); strResult=WebServiceTests.SendSheetParameter(sheetParam); if(strResult!="paramNameOK") { throw new Exception("Should be paramNameOK."); } retVal+="SendSheetParameter: Passed.\r\n"; //SendSheetWithFields Sheet sheet=new Sheet(); sheet.SheetFields=new List<SheetField>(); sheet.Parameters=new List<SheetParameter>(); SheetField field=new SheetField(); field.FieldName="FieldNameGreen"; sheet.SheetFields.Add(field); strResult=WebServiceTests.SendSheetWithFields(sheet); if(strResult!="fieldOK") { throw new Exception("Should be fieldOK."); } retVal+="SendSheetWithFields: Passed.\r\n"; //SendSheetDefWithFields SheetDef sheetdef=new SheetDef(); sheetdef.SheetFieldDefs=new List<SheetFieldDef>(); sheetdef.Parameters=new List<SheetParameter>(); SheetFieldDef fielddef=new SheetFieldDef(); fielddef.FieldName="FieldNameTeal"; sheetdef.SheetFieldDefs.Add(fielddef); strResult=WebServiceTests.SendSheetDefWithFieldDefs(sheetdef); if(strResult!="fielddefOK") { throw new Exception("Should be fielddefOK."); } retVal+="SendSheetDefWithFieldDefs: Passed.\r\n"; //TimeSpanNeg TimeSpan tspan=WebServiceTests.GetTimeSpan(); if(tspan!=new TimeSpan(1,0,0)) { throw new Exception("Should be 1 hour."); } retVal+="GetTimeSpan: Passed.\r\n"; //GetStringContainingCR //fails, but we have a strategy to fix some day by putting serialization code into the crud layer. /* strResult=WebServiceTests.GetStringContainingCR(); strResult=strResult.Replace("\\r","\r"); if(strResult!="Line1\r\nLine2") { throw new Exception("Should be Line1\r\nLine2"); } retVal+="GetStringContainingCR: Passed.\r\n"; //GetListTasksContainingCR Task task=WebServiceTests.GetListTasksContainingCR()[0]; if(task.Descript!="Line1\r\nLine2") { throw new Exception("Should be Line1\r\nLine2"); } retVal+="GetListTasksContainingCR: Passed.\r\n";*/ return retVal; }
///<summary>After taking a screening using a sheet, this method will import the sheet as a screen and insert it into the db. ///Returns null if the sheet passed in is not a Screening sheet type or if the sheet is missing the required ScreenGroupNum param. ///Optionally supply a screen if you want to preset some values. E.g. ScreenGroupOrder is often preset before calling this method.</summary> public static Screen CreateScreenFromSheet(Sheet sheet, Screen screen = null) { //No need to check RemotingRole; no call to db. //Make sure that the sheet passed in is a screening and contains the required ScreenGroupNum parameter. if (sheet.SheetType != SheetTypeEnum.Screening || SheetParameter.GetParamByName(sheet.Parameters, "ScreenGroupNum") == null) { return(null); } if (screen == null) { screen = new Screen(); screen.ScreenGroupNum = (long)SheetParameter.GetParamByName(sheet.Parameters, "ScreenGroupNum").ParamValue; } screen.SheetNum = sheet.SheetNum; foreach (SheetField field in sheet.SheetFields) { switch (field.FieldName) { case "Gender": if (field.FieldValue.Trim().ToLower().StartsWith("m")) { screen.Gender = PatientGender.Male; } else if (field.FieldValue.Trim().ToLower().StartsWith("f")) { screen.Gender = PatientGender.Female; } else { screen.Gender = PatientGender.Unknown; } break; case "Race/Ethnicity": PatientRaceOld patientRace = PatientRaceOld.Unknown; Enum.TryParse <PatientRaceOld>(field.FieldValue.Split(';')[0], out patientRace); screen.RaceOld = patientRace; break; case "GradeLevel": PatientGrade patientGrade = PatientGrade.Unknown; Enum.TryParse <PatientGrade>(field.FieldValue.Split(';')[0], out patientGrade); screen.GradeLevel = patientGrade; break; case "Age": if (screen.Age != 0) { break; //Already calculated via Birthdate. } byte age = 0; byte.TryParse(field.FieldValue, out age); screen.Age = age; break; case "Urgency": TreatmentUrgency treatmentUrgency = TreatmentUrgency.Unknown; Enum.TryParse <TreatmentUrgency>(field.FieldValue.Split(';')[0], out treatmentUrgency); screen.Urgency = treatmentUrgency; break; case "ChartSealantTreatment": //Only mark "carious" if TP chart has C marked for any tooth surface. if (field.FieldValue.Contains("C")) { screen.HasCaries = YN.Yes; //Caries is present in TP'd chart. Compl chart doesn't matter, it's only for sealant placement. } else { screen.HasCaries = YN.No; } //Only mark "needs sealants" if TP chart has S marked for any tooth surface. if (field.FieldValue.Contains("S")) { screen.NeedsSealants = YN.Yes; } else { screen.NeedsSealants = YN.No; } break; case "CariesExperience": screen.CariesExperience = field.FieldValue == "X" ? YN.Yes : YN.No; break; case "EarlyChildCaries": screen.EarlyChildCaries = field.FieldValue == "X" ? YN.Yes : YN.No; break; case "ExistingSealants": screen.ExistingSealants = field.FieldValue == "X" ? YN.Yes : YN.No; break; case "MissingAllTeeth": screen.MissingAllTeeth = field.FieldValue == "X" ? YN.Yes : YN.No; break; case "Birthdate": DateTime birthdate = new DateTime(1, 1, 1); DateTime.TryParse(field.FieldValue, out birthdate); screen.Birthdate = birthdate; //Check to see if the sheet has Age manually filled out. //If Age was not manually set, automatically calculate the age based on the birthdate entered. //This matches screening functionality. SheetField sheetFieldAge = sheet.SheetFields.FirstOrDefault(x => x.FieldName == "Age"); if (sheetFieldAge != null && string.IsNullOrEmpty(sheetFieldAge.FieldValue)) { screen.Age = PIn.Byte(Patients.DateToAge(birthdate).ToString()); } break; case "Comments": screen.Comments = field.FieldValue; break; } } if (screen.ScreenNum == 0) { Insert(screen); } else { Update(screen); } return(screen); }