Exemplo n.º 1
0
		///<Summary>Supply the field that we are testing.  All other fields which intersect with it will be moved down.  Each time one (or maybe some) is moved down, this method is called recursively.  The end result should be no intersections among fields near the original field that grew.</Summary>
		public static void MoveAllDownWhichIntersect(Sheet sheet,SheetField field,int amountOfGrowth) {
			//Phase 1 is to move everything that intersects with the field down. Phase 2 is to call this method on everything that was moved.
			//Phase 1: Move 
			List<SheetField> affectedFields=new List<SheetField>();
			foreach(SheetField field2 in sheet.SheetFields) {
				if(field2==field){
					continue;
				}
				if(field2.YPos<field.YPos){//only fields which are below this one
					continue;
				}
				if(field2.FieldType==SheetFieldType.Drawing){
					continue;
					//drawings do not get moved down.
				}
				if(field.Bounds.IntersectsWith(field2.Bounds)) {
					field2.YPos+=amountOfGrowth;
					affectedFields.Add(field2);
				}
			}
			//Phase 2: Recursion
			foreach(SheetField field2 in affectedFields) {
			  //reuse the same amountOfGrowth again.
			  MoveAllDownWhichIntersect(sheet,field2,amountOfGrowth);
			}
		}
Exemplo n.º 2
0
 public static void CreatePdf(Sheet sheet,string fullFileName)
 {
     PdfDocument document=new PdfDocument();
     PdfPage page=document.AddPage();
     CreatePdfPage(sheet,page);
     document.Save(fullFileName);
 }
Exemplo n.º 3
0
		public static void MoveAllDownBelowThis(Sheet sheet,SheetField field,int amountOfGrowth){
			foreach(SheetField field2 in sheet.SheetFields) {
				if(field2.YPos>field.YPos) {//for all fields that are below this one
					field2.YPos+=amountOfGrowth;//bump down by amount that this one grew
				}
			}
		}
Exemplo n.º 4
0
 /// <summary>
 /// </summary>
 private bool CompareSheets(Sheet sheetFromDb,Sheet newSheet)
 {
     bool isEqual=true;
     //the 2 sheets are sorted before comparison because in some cases SheetFields[i] refers to a different field in sheetFromDb than in newSheet
     Sheet sortedSheetFromDb=new Sheet();
     Sheet sortedNewSheet=new Sheet();
     sortedSheetFromDb.SheetFields=sheetFromDb.SheetFields.OrderBy(sf => sf.SheetFieldNum).ToList();
     sortedNewSheet.SheetFields=newSheet.SheetFields.OrderBy(sf => sf.SheetFieldNum).ToList();
     for(int i=0;i<sortedSheetFromDb.SheetFields.Count;i++) {
         // read each parameter of the SheetField like Fontsize,FieldValue, FontIsBold, XPos, YPos etc.
         foreach(FieldInfo fieldinfo in sortedSheetFromDb.SheetFields[i].GetType().GetFields()) {
             string dbSheetFieldValue="";
             string newSheetFieldValue="";
             //.ToString() works for Int64, Int32, Enum, DateTime(bithdate), Boolean, Double
             if(fieldinfo.GetValue(sortedSheetFromDb.SheetFields[i])!=null) {
                 dbSheetFieldValue=fieldinfo.GetValue(sortedSheetFromDb.SheetFields[i]).ToString();
             }
             if(fieldinfo.GetValue(newSheet.SheetFields[i])!=null) {
                 newSheetFieldValue=fieldinfo.GetValue(sortedNewSheet.SheetFields[i]).ToString();
             }
             if(dbSheetFieldValue!=newSheetFieldValue) {
                 isEqual=false;
             }
         }
     }
     return isEqual;
 }
Exemplo n.º 5
0
		///<summary>Just before printing or displaying the final sheet output, the heights and y positions of various fields are adjusted according to their growth behavior.  This also now gets run every time a user changes the value of a textbox while filling out a sheet.</summary>
		public static void CalculateHeights(Sheet sheet,Graphics g){
			//Sheet sheetCopy=sheet.Clone();
			int calcH;
			Font font;
			FontStyle fontstyle;
			foreach(SheetField field in sheet.SheetFields) {
				if(field.GrowthBehavior==GrowthBehaviorEnum.None){
					continue;
				}
				fontstyle=FontStyle.Regular;
				if(field.FontIsBold){
					fontstyle=FontStyle.Bold;
				}
				font=new Font(field.FontName,field.FontSize,fontstyle);
				//calcH=(int)g.MeasureString(field.FieldValue,font).Height;//this was too short
				calcH=GraphicsHelper.MeasureStringH(g,field.FieldValue,font,field.Width);
				if(calcH<=field.Height){
					continue;
				}
				int amountOfGrowth=calcH-field.Height;
				field.Height=calcH;
				if(field.GrowthBehavior==GrowthBehaviorEnum.DownLocal){
					MoveAllDownWhichIntersect(sheet,field,amountOfGrowth);
				}
				else if(field.GrowthBehavior==GrowthBehaviorEnum.DownGlobal){
					MoveAllDownBelowThis(sheet,field,amountOfGrowth);
					
				}
			}
			//g.Dispose();
			//return sheetCopy;
		}
Exemplo n.º 6
0
		///<Summary>This is normally done in FormSheetFillEdit, but if we bypass that window for some reason, we can also save a new sheet here.  Does not save any drawings.  Does not save signatures.  Does not save any parameters (PatNum parameters never get saved anyway).</Summary>
		public static void SaveNewSheet(Sheet sheet) {
			//No need to check RemotingRole; no call to db.
			if(!sheet.IsNew) {
				throw new Exception("Only new sheets allowed");
			}
			Insert(sheet);
			foreach(SheetField fld in sheet.SheetFields) {
				fld.SheetNum=sheet.SheetNum;
				SheetFields.Insert(fld);
			}
		}
Exemplo n.º 7
0
 public static bool ContainsStaticField(Sheet sheet,string fieldName)
 {
     //No need to check RemotingRole; no call to db
     foreach(SheetField field in sheet.SheetFields) {
         if(field.FieldType!=SheetFieldType.StaticText) {
             continue;
         }
         if(field.FieldValue.Contains("["+fieldName+"]")) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 8
0
		///<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);
				}
			}
		}
Exemplo n.º 9
0
		public FormSheetFillEdit(Sheet sheet){
			InitializeComponent();
			Lan.F(this);
			SheetCur=sheet;
			if(sheet.IsLandscape){
				Width=sheet.Height+190;
				Height=sheet.Width+65;
			}
			else{
				Width=sheet.Width+190;
				Height=sheet.Height+65;
			}
			if(Width>SystemInformation.WorkingArea.Width){
				Width=SystemInformation.WorkingArea.Width;
			}
			if(Height>SystemInformation.WorkingArea.Height){
				Height=SystemInformation.WorkingArea.Height;
			}
			PointList=new List<Point>();
		}
Exemplo n.º 10
0
		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;
		}
Exemplo n.º 11
0
		private void butPrint_Click(object sender, System.EventArgs e) {
			//only visible if sheet==null.
			if(comboSendStatus.SelectedIndex==(int)RxSendStatus.InElectQueue
				|| comboSendStatus.SelectedIndex==(int)RxSendStatus.SentElect) 
			{
				//do not change status
			}
			else {
				comboSendStatus.SelectedIndex=(int)RxSendStatus.Printed;
			}
			if(!SaveRx()){
				return;
			}
			SheetDef sheetDef;
			List<SheetDef> customSheetDefs=SheetDefs.GetCustomForType(SheetTypeEnum.Rx);
			if(customSheetDefs.Count==0){
				sheetDef=SheetsInternal.GetSheetDef(SheetInternalType.Rx);
			}
			else{
				sheetDef=customSheetDefs[0];
				SheetDefs.GetFieldsAndParameters(sheetDef);
			}
			sheet=SheetUtil.CreateSheet(sheetDef,PatCur.PatNum);
			SheetParameter.SetParameter(sheet,"RxNum",RxPatCur.RxNum);
			SheetFiller.FillFields(sheet);
			SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
			SheetPrinting.PrintRx(sheet,RxPatCur.IsControlled);
			DialogResult=DialogResult.OK;
		}
Exemplo n.º 12
0
		private void FormRxEdit_Load(object sender, System.EventArgs e) {
			if(IsNew){
				butView.Visible=false;
				labelView.Visible=false;
				sheet=null;
				if(PrefC.GetBool(PrefName.ShowFeatureEhr) && Security.CurUser.ProvNum!=0) {//Is CPOE
					labelCPOE.Visible=true;
					comboProvNum.Enabled=false;
					butPickProv.Enabled=false;
					RxPatCur.ProvNum=Security.CurUser.ProvNum;
				}
			}
			else{
				sheet=Sheets.GetRx(RxPatCur.PatNum,RxPatCur.RxNum);
				if(sheet==null){
					butView.Visible=false;
					labelView.Visible=false;
				}
				else{
					butPrint.Visible=false;
				}
			}
			//security is handled on the Rx button click in the Chart module
			_provNumSelected=RxPatCur.ProvNum;
			comboProvNum.Items.Clear();
			for(int i=0;i<ProviderC.ListShort.Count;i++) {
				comboProvNum.Items.Add(ProviderC.ListShort[i].GetLongDesc());//Only visible provs added to combobox.
				if(ProviderC.ListShort[i].ProvNum==RxPatCur.ProvNum) {
					comboProvNum.SelectedIndex=i;//Sets combo text too.
				}
			}
			if(_provNumSelected==0) {//Is new
				comboProvNum.SelectedIndex=0;
				_provNumSelected=ProviderC.ListShort[0].ProvNum;
			}
			if(comboProvNum.SelectedIndex==-1) {//The provider exists but is hidden
				comboProvNum.Text=Providers.GetLongDesc(_provNumSelected);//Appends "(hidden)" to the end of the long description.
			}
			textDate.Text=RxPatCur.RxDate.ToString("d");
			checkControlled.Checked=RxPatCur.IsControlled;
			for(int i=0;i<Enum.GetNames(typeof(RxSendStatus)).Length;i++) {
				comboSendStatus.Items.Add(Enum.GetNames(typeof(RxSendStatus))[i]);
			}
			comboSendStatus.SelectedIndex=(int)RxPatCur.SendStatus;
			textDrug.Text=RxPatCur.Drug;
			textSig.Text=RxPatCur.Sig;
			textDisp.Text=RxPatCur.Disp;
			textRefills.Text=RxPatCur.Refills;
			if(PrefC.GetBool(PrefName.ShowFeatureEhr)){
				textDosageCode.Text=RxPatCur.DosageCode;
			}
			else{
				labelDosageCode.Visible=false;
				textDosageCode.Visible=false;
			}
			textNotes.Text=RxPatCur.Notes;
			textPharmacy.Text=Pharmacies.GetDescription(RxPatCur.PharmacyNum);
		}
Exemplo n.º 13
0
        /// <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;
        }
Exemplo n.º 14
0
		///<Summary></Summary>
		public static void Print(Sheet sheet,int copies,bool isRxControlled){
			//parameter null check moved to SheetFiller.
			//could validate field names here later.
			SheetList=new List<Sheet>();
			for(int i=0;i<copies;i++){
				SheetList.Add(sheet.Copy());
			}
			sheetsPrinted=0;
			PrintDocument pd=new PrintDocument();
			pd.OriginAtMargins=true;
			pd.PrintPage+=new PrintPageEventHandler(pd_PrintPage);
			if(pd.DefaultPageSettings.PrintableArea.Width==0) {
				//prevents bug in some printers that do not specify paper size
				pd.DefaultPageSettings.PaperSize=new PaperSize("paper",850,1100);
			}
			if(sheet.SheetType==SheetTypeEnum.LabelPatient
				|| sheet.SheetType==SheetTypeEnum.LabelCarrier
				|| sheet.SheetType==SheetTypeEnum.LabelAppointment
				|| sheet.SheetType==SheetTypeEnum.LabelReferral) 
			{//I think this causes problems for non-label sheet types.
				if(sheet.Width>0 && sheet.Height>0) {
					pd.DefaultPageSettings.PaperSize=new PaperSize("Default",sheet.Width,sheet.Height);
				}
			}
			PrintSituation sit=PrintSituation.Default;
			pd.DefaultPageSettings.Landscape=sheet.IsLandscape;
			switch(sheet.SheetType){
				case SheetTypeEnum.LabelPatient:
				case SheetTypeEnum.LabelCarrier:
				case SheetTypeEnum.LabelReferral:
				case SheetTypeEnum.LabelAppointment:
					sit=PrintSituation.LabelSingle;
					break;
				case SheetTypeEnum.ReferralSlip:
					sit=PrintSituation.Default;
					break;
				case SheetTypeEnum.Rx:
					if(isRxControlled){
						sit=PrintSituation.RxControlled;
					}
					else{
						sit=PrintSituation.Rx;
					}
					break;
			}
			//later: add a check here for print preview.
			#if DEBUG
				pd.DefaultPageSettings.Margins=new Margins(20,20,0,0);
				FormPrintPreview printPreview;
				printPreview=new FormPrintPreview(sit,pd,SheetList.Count,sheet.PatNum,sheet.Description+" sheet from "+sheet.DateTimeSheet.ToShortDateString()+" printed");
				printPreview.ShowDialog();
			#else
				try {
					if(sheet.PatNum!=null){
						if(!PrinterL.SetPrinter(pd,sit,sheet.PatNum,sheet.Description+" sheet from "+sheet.DateTimeSheet.ToShortDateString()+" printed")) {
							return;
						}
					}
					else{
						if(!PrinterL.SetPrinter(pd,sit,0,sheet.Description+" sheet from "+sheet.DateTimeSheet.ToShortDateString()+" printed")) {
							return;
						}
					}
					pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
					pd.Print();
				}
				catch(Exception ex){
					throw ex;
					//MessageBox.Show(Lan.g("Sheet","Printer not available"));
				}
			#endif
		}
Exemplo n.º 15
0
        ///<summary>Takes a screening sheet that is associated to a patient and processes any corresponding ScreenCharts found.
        ///Processing will create treatment planned or completed procedures for the patient.
        ///Supply the sheet and then a bitwise enum of screen chart types to digest.
        ///procOrigVals MUST be two items long, nulls are allowed, the first represents the fluoride field, second is assessment field.</summary>
        public static void ProcessScreenChart(Sheet sheet, ScreenChartType chartTypes, long provNum, long sheetNum, List <SheetField> listChartOrigVals
                                              , List <SheetField> listProcOrigVals)
        {
            //No need to check RemotingRole; no call to db.
            if (sheet == null || sheet.PatNum == 0)
            {
                return;                //An invalid screening sheet was passed in.
            }
            List <string> listToothVals    = new List <string>();
            List <string> listToothValsOld = new List <string>();

            //Process treatment planned sealants.
            foreach (SheetField field in sheet.SheetFields)             //Go through the supplied sheet's fields and find the field.
            {
                if (chartTypes.HasFlag(ScreenChartType.TP) && field.FieldType == SheetFieldType.ScreenChart && field.FieldName == "ChartSealantTreatment")
                {
                    listToothVals = field.FieldValue.Split(';').ToList();
                    if (listToothVals[0] == "1")         //Primary tooth chart
                    {
                        continue;                        //Skip primary tooth charts because we do not need to create any TP procedures for them.
                    }
                    listToothVals.RemoveAt(0);           //Remove the toothchart type value
                    if (listChartOrigVals[0] != null)    //Shouldn't be null if ChartSealantTreatment exists
                    {
                        listToothValsOld = listChartOrigVals[0].FieldValue.Split(';').ToList();
                        listToothValsOld.RemoveAt(0);                        //Remove the toothchart type value
                    }
                    ScreenChartType chartType = ScreenChartType.TP;
                    ProcessScreenChartHelper(sheet.PatNum, listToothVals, chartType, provNum, sheetNum, listToothValsOld);
                    break;
                }
            }
            listToothVals = new List <string>();            //Clear out the tooth values for the next tooth chart.
            //Process completed sealants.
            foreach (SheetField field in sheet.SheetFields) //Go through the supplied sheet's fields and find the field.
            {
                if (chartTypes.HasFlag(ScreenChartType.C) && field.FieldType == SheetFieldType.ScreenChart && field.FieldName == "ChartSealantComplete")
                {
                    listToothVals = field.FieldValue.Split(';').ToList();
                    if (listToothVals[0] == "1")         //Primary tooth chart
                    {
                        continue;                        //Skip primary tooth charts because we do not need to create any TP procedures for them.
                    }
                    listToothVals.RemoveAt(0);           //Remove the toothchart type value
                    if (listChartOrigVals[1] != null)    //Shouldn't be null if ChartSealantTreatment exists
                    {
                        listToothValsOld = listChartOrigVals[1].FieldValue.Split(';').ToList();
                        listToothValsOld.RemoveAt(0);                        //Remove the toothchart type value
                    }
                    ScreenChartType chartType = ScreenChartType.C;
                    ProcessScreenChartHelper(sheet.PatNum, listToothVals, chartType, provNum, sheetNum, listToothValsOld);
                    break;
                }
            }
            //Process if the user wants to TP fluoride and / or assessment procedures.
            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.CheckBox)
                {
                    continue;                    //Only care about check box types.
                }
                if (field.FieldName != "FluorideProc" && field.FieldName != "AssessmentProc")
                {
                    continue;                    //Field name must be one of the two hard coded values.
                }
                //Make D1206 proc with provNum and patNum
                if (field.FieldName == "FluorideProc" && listProcOrigVals[1] != null && listProcOrigVals[1].FieldValue == "" && field.FieldValue == "X")
                {
                    //Original value was blank, new value is "checked", make the D1206 (fluoride) proc.
                    Procedure proc = Procedures.CreateProcForPat(sheet.PatNum, ProcedureCodes.GetCodeNum("D1206"), "", "", ProcStat.C, provNum);
                    if (proc != null)
                    {
                        SecurityLogs.MakeLogEntry(Permissions.ProcEdit, sheet.PatNum, "D1206 " + Lans.g("Screens", "treatment planned during screening"));
                    }
                }
                //Make D0191 proc with provNum and patNum
                if (field.FieldName == "AssessmentProc" && listProcOrigVals[0] != null && listProcOrigVals[0].FieldValue == "" && field.FieldValue == "X")
                {
                    //Original value was blank, new value is "checked", make the D0191 (assessment) proc.
                    Procedure proc = Procedures.CreateProcForPat(sheet.PatNum, ProcedureCodes.GetCodeNum("D0191"), "", "", ProcStat.C, provNum);
                    if (proc != null)
                    {
                        SecurityLogs.MakeLogEntry(Permissions.ProcEdit, sheet.PatNum, "D0191 " + Lans.g("Screens", "treatment planned during screening."));
                    }
                }
            }
        }
Exemplo n.º 16
0
		/*private void buttonEmail_Click(object sender,EventArgs e) {
			int CurPatNum=CaseCur.PatNum;
			EmailMessage message=new EmailMessage();
			message.PatNum=CurPatNum;
			Patient pat=Patients.GetPat(CurPatNum);
			message.ToAddress="";//pat.Email;
			message.FromAddress=PrefC.GetString(PrefName.EmailSenderAddress");
			message.Subject=Lan.g(this,"RE: ")+pat.GetNameFL();
			FormEmailMessageEdit FormE=new FormEmailMessageEdit(message);
			FormE.IsNew=true;
			FormE.ShowDialog();

		}*/

		private void butSlip_Click(object sender,EventArgs e) {
			if(sheet==null) {//create new
				if(!SaveToDb()) {
					return;
				}
				Laboratory lab=ListLabs[listLab.SelectedIndex];
				SheetDef sheetDef;
				if(lab.Slip==0){
					sheetDef=SheetsInternal.GetSheetDef(SheetInternalType.LabSlip);
				}
				else{
					sheetDef=SheetDefs.GetSheetDef(lab.Slip);
				}
				sheet=SheetUtil.CreateSheet(sheetDef,CaseCur.PatNum);
				SheetParameter.SetParameter(sheet,"PatNum",CaseCur.PatNum);
				SheetParameter.SetParameter(sheet,"LabCaseNum",CaseCur.LabCaseNum);
				SheetFiller.FillFields(sheet);
				SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
				FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
				FormS.ShowDialog();
			}
			else {//edit existing
				SheetFields.GetFieldsAndParameters(sheet);
				FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
				FormS.ShowDialog();
			}
			//refresh
			sheet=Sheets.GetLabSlip(CaseCur.PatNum,CaseCur.LabCaseNum);
			if(sheet==null) {
				butSlip.Text=Lan.g(this,"New Slip");
			}
			else {
				butSlip.Text=Lan.g(this,"Edit Slip");
				butCancel.Enabled=false;//user can still click X to close window, but we do handle that as well.
			}
		}
Exemplo n.º 17
0
		///<summary>Creates a Sheet object from a sheetDef, complete with fields and parameters.  Sets date to today.</summary>
		public static Sheet CreateSheet(SheetDef sheetDef,long patNum) {
			Sheet sheet=new Sheet();
			sheet.IsNew=true;
			sheet.DateTimeSheet=DateTime.Now;
			sheet.FontName=sheetDef.FontName;
			sheet.FontSize=sheetDef.FontSize;
			sheet.Height=sheetDef.Height;
			sheet.SheetType=sheetDef.SheetType;
			sheet.Width=sheetDef.Width;
			sheet.PatNum=patNum;
			sheet.Description=sheetDef.Description;
			sheet.IsLandscape=sheetDef.IsLandscape;
			sheet.SheetFields=CreateFieldList(sheetDef.SheetFieldDefs);
			sheet.Parameters=sheetDef.Parameters;
			return sheet;
		}
Exemplo n.º 18
0
		///<summary>Loops through all the fields in the sheet and appends together all the FieldValues.  It obviously excludes all SigBox fieldtypes.  It does include Drawing fieldtypes, so any change at all to any drawing will invalidate the signature.  It does include Image fieldtypes, although that's just a filename and does not really have any meaningful data about the image itself.  The order is absolutely critical.</summary>
		public static string GetSignatureKey(Sheet sheet){
			//No need to check RemotingRole; no call to db
			StringBuilder strBuild=new StringBuilder();
			for(int i=0;i<sheet.SheetFields.Count;i++){
				if(sheet.SheetFields[i].FieldValue==""){
					continue;
				}
				if(sheet.SheetFields[i].FieldType==SheetFieldType.SigBox){
					continue;
				}
				strBuild.Append(sheet.SheetFields[i].FieldValue);
			}
			return strBuild.ToString();
		}
Exemplo n.º 19
0
		///<summary>Converts parameters into sheetfield objects, and then saves those objects in the database.  The parameters will never again enjoy full parameter status, but will just be read-only fields from here on out.  It ignores PatNum parameters, since those are already part of the sheet itself.</summary>
		public static void SaveParameters(Sheet sheet){
			//No need to check RemotingRole; no call to db
			SheetField field;
			for(int i=0;i<sheet.Parameters.Count;i++){
				if(sheet.Parameters[i].ParamName=="PatNum"){
					continue;
				}
				field=new SheetField();
				field.IsNew=true;
				field.SheetNum=sheet.SheetNum;
				field.FieldType=SheetFieldType.Parameter;
				field.FieldName=sheet.Parameters[i].ParamName;
				field.FieldValue=sheet.Parameters[i].ParamValue.ToString();//the object will be an int. Stored as a string.
				field.FontSize=0;
				field.FontName="";
				field.FontIsBold=false;
				field.XPos=0;
				field.YPos=0;
				field.Width=0;
				field.Height=0;
				field.GrowthBehavior=GrowthBehaviorEnum.None;
				field.RadioButtonValue="";
				SheetFields.Insert(field);
			}
		}
Exemplo n.º 20
0
		///<summary></summary>
		public static void Update(Sheet sheet) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),sheet);
				return;
			}
			Crud.SheetCrud.Update(sheet);
		}
Exemplo n.º 21
0
		///<summary></summary>
		public static long Insert(Sheet sheet) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				sheet.SheetNum=Meth.GetLong(MethodBase.GetCurrentMethod(),sheet);
				return sheet.SheetNum;
			}
			return Crud.SheetCrud.Insert(sheet);
		}
Exemplo n.º 22
0
		///<summary>This is not a generic sheet comparer.  It is actually a web form sheet field comparer.  Returns false if any sheet fields that the web form cares about are not equal.</summary>
		private bool CompareSheets(Sheet sheetFromDb,Sheet newSheet) {
			//the 2 sheets are sorted before comparison because in some cases SheetFields[i] refers to a different field in sheetFromDb than in newSheet
			Sheet sortedSheetFromDb=new Sheet();
			Sheet sortedNewSheet=new Sheet();
			sortedSheetFromDb.SheetFields=sheetFromDb.SheetFields.OrderBy(sf => sf.SheetFieldNum).ToList();
			sortedNewSheet.SheetFields=newSheet.SheetFields.OrderBy(sf => sf.SheetFieldNum).ToList();
			for(int i=0;i<sortedSheetFromDb.SheetFields.Count;i++) {
				//Explicitly compare the sheet field values that can be imported via web forms.
				//This makes it so that any future columns added to the sheetfield table will not affect this comparer.
				//When new columns are added, we can now decide on a per column basis if the column matters for comparisons.
				//We will always add new columns below and simply comment them out if we do not want to use them for comparison, this way we know that the column was considered.
				if(sortedSheetFromDb.SheetFields[i].SheetNum!=sortedNewSheet.SheetFields[i].SheetNum
					|| sortedSheetFromDb.SheetFields[i].FieldType!=sortedNewSheet.SheetFields[i].FieldType
					|| sortedSheetFromDb.SheetFields[i].FieldName!=sortedNewSheet.SheetFields[i].FieldName
					|| sortedSheetFromDb.SheetFields[i].FieldValue!=sortedNewSheet.SheetFields[i].FieldValue
					|| sortedSheetFromDb.SheetFields[i].FontSize!=sortedNewSheet.SheetFields[i].FontSize
					|| sortedSheetFromDb.SheetFields[i].FontName!=sortedNewSheet.SheetFields[i].FontName
					|| sortedSheetFromDb.SheetFields[i].FontIsBold!=sortedNewSheet.SheetFields[i].FontIsBold
					|| sortedSheetFromDb.SheetFields[i].XPos!=sortedNewSheet.SheetFields[i].XPos
					|| sortedSheetFromDb.SheetFields[i].YPos!=sortedNewSheet.SheetFields[i].YPos
					|| sortedSheetFromDb.SheetFields[i].Width!=sortedNewSheet.SheetFields[i].Width
					|| sortedSheetFromDb.SheetFields[i].Height!=sortedNewSheet.SheetFields[i].Height
					|| sortedSheetFromDb.SheetFields[i].GrowthBehavior!=sortedNewSheet.SheetFields[i].GrowthBehavior
					|| sortedSheetFromDb.SheetFields[i].RadioButtonValue!=sortedNewSheet.SheetFields[i].RadioButtonValue
					|| sortedSheetFromDb.SheetFields[i].RadioButtonGroup!=sortedNewSheet.SheetFields[i].RadioButtonGroup
					|| sortedSheetFromDb.SheetFields[i].IsRequired!=sortedNewSheet.SheetFields[i].IsRequired
					|| sortedSheetFromDb.SheetFields[i].TabOrder!=sortedNewSheet.SheetFields[i].TabOrder
					|| sortedSheetFromDb.SheetFields[i].ReportableName!=sortedNewSheet.SheetFields[i].ReportableName
					|| sortedSheetFromDb.SheetFields[i].TextAlign!=sortedNewSheet.SheetFields[i].TextAlign
					|| sortedSheetFromDb.SheetFields[i].ItemColor!=sortedNewSheet.SheetFields[i].ItemColor
					) 
				{
					return false;//No need to keep looping, we know the sheets are not equal at this point.
				}
			}
			return true;//All web form sheet fields are equal.
		}
Exemplo n.º 23
0
        /*private void buttonEmail_Click(object sender,EventArgs e) {
            int CurPatNum=CaseCur.PatNum;
            EmailMessage message=new EmailMessage();
            message.PatNum=CurPatNum;
            Patient pat=Patients.GetPat(CurPatNum);
            message.ToAddress="";//pat.Email;
            message.FromAddress=PrefC.GetString(PrefName.EmailSenderAddress");
            message.Subject=Lan.g(this,"RE: ")+pat.GetNameFL();
            FormEmailMessageEdit FormE=new FormEmailMessageEdit(message);
            FormE.IsNew=true;
            FormE.ShowDialog();

        }*/
        private void butSlip_Click(object sender,EventArgs e)
        {
            if(sheet==null) {//create new
                if(!SaveToDb()) {
                    return;
                }
                Laboratory lab=ListLabs[listLab.SelectedIndex];
                SheetDef sheetDef;
                if(lab.Slip==0){
                    sheetDef=SheetsInternal.GetSheetDef(SheetInternalType.LabSlip);
                }
                else{
                    sheetDef=SheetDefs.GetSheetDef(lab.Slip);
                }
                sheet=SheetUtil.CreateSheet(sheetDef,CaseCur.PatNum);
                SheetParameter.SetParameter(sheet,"PatNum",CaseCur.PatNum);
                SheetParameter.SetParameter(sheet,"LabCaseNum",CaseCur.LabCaseNum);
                SheetFiller.FillFields(sheet);
                SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
                FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
                FormS.ShowDialog();
                //if(FormS.DialogResult!=DialogResult.OK) {
                //	sheet=null;
                //	return;
                //}
            }
            else {//edit existing
                SheetFields.GetFieldsAndParameters(sheet);
                FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
                FormS.ShowDialog();
                //if(FormS.DialogResult!=DialogResult.OK) {
                //	return;
                //}
            }
            //refresh
            sheet=Sheets.GetLabSlip(CaseCur.PatNum,CaseCur.LabCaseNum);
            if(sheet==null) {
                butSlip.Text=Lan.g(this,"New Slip");
            }
            else {
                butSlip.Text=Lan.g(this,"Edit Slip");
            }
        }
Exemplo n.º 24
0
		public static string SendSheetWithFields(Sheet sheet) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetString(MethodBase.GetCurrentMethod(),sheet);
			}
			if(sheet.SheetFields[0].FieldName=="FieldNameGreen") {
				return "fieldOK";
			}
			return "error";
		}
Exemplo n.º 25
0
		public static void CreatePdfPage(Sheet sheet,PdfPage page) {
			page.Width=p(sheet.Width);//XUnit.FromInch((double)sheet.Width/100);  //new XUnit((double)sheet.Width/100,XGraphicsUnit.Inch);
			page.Height=p(sheet.Height);//new XUnit((double)sheet.Height/100,XGraphicsUnit.Inch);
			if(sheet.IsLandscape){
				page.Orientation=PageOrientation.Landscape;
			}
			XGraphics g=XGraphics.FromPdfPage(page);
			g.SmoothingMode=XSmoothingMode.HighQuality;
			//g.PageUnit=XGraphicsUnit. //wish they had pixel
			//XTextFormatter tf = new XTextFormatter(g);//needed for text wrap
			//tf.Alignment=XParagraphAlignment.Left;
			//pd.DefaultPageSettings.Landscape=
			//already done?:SheetUtil.CalculateHeights(sheet,g);//this is here because of easy access to g.
			XFont xfont;
			XFontStyle xfontstyle;
			//first, draw images--------------------------------------------------------------------------------------
			foreach(SheetField field in sheet.SheetFields){
				if(field.FieldType!=SheetFieldType.Image){
					continue;
				}
				string filePathAndName=ODFileUtils.CombinePaths(SheetUtil.GetImagePath(),field.FieldName);
				Bitmap bitmapOriginal=null;
				if(field.FieldName=="Patient Info.gif") {
					bitmapOriginal=Properties.Resources.Patient_Info;
				}
				else if(File.Exists(filePathAndName)) {
					bitmapOriginal=new Bitmap(filePathAndName);
				}
				else {
					continue;
				}
				Bitmap bitmapResampled=(Bitmap)bitmapOriginal.Clone();
				if(bitmapOriginal.HorizontalResolution!=96 || bitmapOriginal.VerticalResolution!=96){//to avoid slowdown for other pdfs
					//The scaling on the XGraphics.DrawImage() function causes unreadable output unless the image is in 96 DPI native format.
					//We use GDI here first to convert the image to the correct size and DPI, then pass the second image to XGraphics.DrawImage().
					bitmapResampled.Dispose();
					bitmapResampled=null;
					bitmapResampled=new Bitmap(field.Width,field.Height);
					Graphics gr=Graphics.FromImage(bitmapResampled);
					gr.DrawImage(bitmapOriginal,0,0,field.Width,field.Height);
					gr.Dispose();
				}
				g.DrawImage(bitmapResampled,p(field.XPos),p(field.YPos),p(field.Width),p(field.Height));
				bitmapResampled.Dispose();
				bitmapResampled=null;
				bitmapOriginal.Dispose();
				bitmapOriginal=null;
			}
			//then, drawings--------------------------------------------------------------------------------------------
			XPen pen=new XPen(XColors.Black,p(2));
			string[] pointStr;
			List<Point> points;
			Point point;
			string[] xy;
			foreach(SheetField field in sheet.SheetFields){
				if(field.FieldType!=SheetFieldType.Drawing){
					continue;
				}
				pointStr=field.FieldValue.Split(';');
				points=new List<Point>();
				for(int j=0;j<pointStr.Length;j++){
					xy=pointStr[j].Split(',');
					if(xy.Length==2){
						point=new Point(PIn.Int(xy[0]),PIn.Int(xy[1]));
						points.Add(point);
					}
				}
				for(int i=1;i<points.Count;i++){
					g.DrawLine(pen,p(points[i-1].X),p(points[i-1].Y),p(points[i].X),p(points[i].Y));
				}
			}
			//then, rectangles and lines----------------------------------------------------------------------------------
			XPen pen2=new XPen(XColors.Black,p(1));
			foreach(SheetField field in sheet.SheetFields){
				if(field.FieldType==SheetFieldType.Rectangle){
					g.DrawRectangle(pen2,p(field.XPos),p(field.YPos),p(field.Width),p(field.Height));
				}
				if(field.FieldType==SheetFieldType.Line){
					g.DrawLine(pen2,p(field.XPos),p(field.YPos),
						p(field.XPos+field.Width),
						p(field.YPos+field.Height));
				}
			}
			//then, draw text--------------------------------------------------------------------------------------------
			Bitmap doubleBuffer=new Bitmap(sheet.Width,sheet.Height);
			Graphics gfx=Graphics.FromImage(doubleBuffer);
			foreach(SheetField field in sheet.SheetFields){
				if(field.FieldType!=SheetFieldType.InputField
					&& field.FieldType!=SheetFieldType.OutputText
					&& field.FieldType!=SheetFieldType.StaticText)
				{
					continue;
				}
				xfontstyle=XFontStyle.Regular;
				if(field.FontIsBold){
					xfontstyle=XFontStyle.Bold;
				}
				xfont=new XFont(field.FontName,field.FontSize,xfontstyle);
				//xfont=new XFont(field.FontName,field.FontSize,xfontstyle);
				//Rectangle rect=new Rectangle((int)p(field.XPos),(int)p(field.YPos),(int)p(field.Width),(int)p(field.Height));
				XRect xrect=new XRect(p(field.XPos),p(field.YPos),p(field.Width),p(field.Height));
				//XStringFormat format=new XStringFormat();
				//tf.DrawString(field.FieldValue,font,XBrushes.Black,xrect,XStringFormats.TopLeft);
				GraphicsHelper.DrawStringX(g,gfx,1d/p(1),field.FieldValue,xfont,XBrushes.Black,xrect);
			}
			gfx.Dispose();
			//then, checkboxes----------------------------------------------------------------------------------
			XPen pen3=new XPen(XColors.Black,p(1.6f));
			foreach(SheetField field in sheet.SheetFields){
				if(field.FieldType!=SheetFieldType.CheckBox){
					continue;
				}
				if(field.FieldValue=="X"){
					g.DrawLine(pen3,p(field.XPos),p(field.YPos),p(field.XPos+field.Width),p(field.YPos+field.Height));
					g.DrawLine(pen3,p(field.XPos+field.Width),p(field.YPos),p(field.XPos),p(field.YPos+field.Height));
				}
			}
			//then signature boxes----------------------------------------------------------------------
			foreach(SheetField field in sheet.SheetFields){
				if(field.FieldType!=SheetFieldType.SigBox){
					continue;
				}
				SignatureBoxWrapper wrapper=new SignatureBoxWrapper();
				wrapper.Width=field.Width;
				wrapper.Height=field.Height;
				if(field.FieldValue.Length>0){//a signature is present
					bool sigIsTopaz=false;
					if(field.FieldValue[0]=='1'){
						sigIsTopaz=true;
					}
					string signature="";
					if(field.FieldValue.Length>1){
						signature=field.FieldValue.Substring(1);
					}
					string keyData=Sheets.GetSignatureKey(sheet);
					wrapper.FillSignature(sigIsTopaz,keyData,signature);
				}
				XImage sigBitmap=XImage.FromGdiPlusImage(wrapper.GetSigImage());
				g.DrawImage(sigBitmap,p(field.XPos),p(field.YPos),p(field.Width-2),p(field.Height-2));
			}
		}
Exemplo n.º 26
0
        ///<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);
        }
Exemplo n.º 27
0
 private void FormLabCaseEdit_Load(object sender, System.EventArgs e)
 {
     textPatient.Text=Patients.GetPat(CaseCur.PatNum).GetNameFL();
     ListLabs=Laboratories.Refresh();
     for(int i=0;i<ListLabs.Count;i++){
         listLab.Items.Add(ListLabs[i].Description+" "+ListLabs[i].Phone);
         if(ListLabs[i].LaboratoryNum==CaseCur.LaboratoryNum){
             listLab.SelectedIndex=i;
         }
     }
     for(int i=0;i<ProviderC.ListShort.Count;i++){
         comboProv.Items.Add(ProviderC.ListShort[i].Abbr);
         if(ProviderC.ListShort[i].ProvNum==CaseCur.ProvNum){
             comboProv.SelectedIndex=i;
         }
     }
     Appointment apt=Appointments.GetOneApt(CaseCur.AptNum);
     if(apt!=null){
         if(apt.AptStatus==ApptStatus.UnschedList){
             textAppointment.Text=Lan.g(this,"Unscheduled");
         }
         else{
             textAppointment.Text=apt.AptDateTime.ToShortDateString()+" "+apt.AptDateTime.ToShortTimeString();
         }
         textAppointment.Text+=", "+apt.ProcDescript;
     }
     apt=Appointments.GetOneApt(CaseCur.PlannedAptNum);
     if(apt!=null){
         textPlanned.Text=apt.ProcDescript;
         if(textPlanned.Text==""){
             textPlanned.Text=Lan.g(this,"Attached");
         }
     }
     if(CaseCur.DateTimeCreated.Year>1880){
         textDateCreated.Text=CaseCur.DateTimeCreated.ToString();
     }
     if(CaseCur.DateTimeSent.Year>1880) {
         textDateSent.Text=CaseCur.DateTimeSent.ToString();
     }
     if(CaseCur.DateTimeRecd.Year>1880) {
         textDateRecd.Text=CaseCur.DateTimeRecd.ToString();
     }
     if(CaseCur.DateTimeChecked.Year>1880) {
         textDateChecked.Text=CaseCur.DateTimeChecked.ToString();
     }
     if(CaseCur.DateTimeDue.Year>1880) {
         textDateDue.Text=CaseCur.DateTimeDue.ToShortDateString()+" "+CaseCur.DateTimeDue.ToShortTimeString();
     }
     textInstructions.Text=CaseCur.Instructions;
     sheet=Sheets.GetLabSlip(CaseCur.PatNum,CaseCur.LabCaseNum);
     if(sheet==null) {
         butSlip.Text=Lan.g(this,"New Slip");
     }
     else {
         butSlip.Text=Lan.g(this,"Edit Slip");
     }
 }
Exemplo n.º 28
0
		public static void PrintRx(Sheet sheet,bool isControlled){
			Print(sheet,1,isControlled);
		}
Exemplo n.º 29
0
 /// <summary>Compares values of the sheet with values that have been inserted into the db.  Returns false if the data was not saved properly.</summary>
 private bool DataExistsInDb(Sheet sheet)
 {
     bool dataExistsInDb=true;
     if(sheet!=null) {
         long SheetNum=sheet.SheetNum;
         Sheet sheetFromDb=Sheets.GetSheet(SheetNum);
         if(sheetFromDb!=null) {
             dataExistsInDb=CompareSheets(sheetFromDb,sheet);
         }
     }
     return dataExistsInDb;
 }
Exemplo n.º 30
0
		///<Summary>Surround with try/catch.</Summary>
		public static void Print(Sheet sheet){
			Print(sheet,1,false);
		}
Exemplo n.º 31
0
		/// <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;
		}
Exemplo n.º 32
0
		///<Summary>Surround with try/catch.</Summary>
		public static void Print(Sheet sheet,int copies){
			Print(sheet,copies,false);
		}