Example #1
0
 private void FormRecallTypeEdit_Load(object sender, System.EventArgs e)
 {
     textDescription.Text=RecallTypeCur.Description;
      	defaultIntervalOld=RecallTypeCur.DefaultInterval;
     comboSpecial.Items.Add(Lan.g(this,"none"));
     comboSpecial.Items.Add(Lan.g(this,"Prophy"));
     comboSpecial.Items.Add(Lan.g(this,"ChildProphy"));
     comboSpecial.Items.Add(Lan.g(this,"Perio"));
     SetSpecialIdx();
     CountForType=Recalls.GetCountForType(RecallTypeCur.RecallTypeNum);
     TriggerList=RecallTriggers.GetForType(RecallTypeCur.RecallTypeNum);//works if 0, too.
     SetSpecialText();
     FillTriggers();
     textYears.Text=RecallTypeCur.DefaultInterval.Years.ToString();
     textMonths.Text=RecallTypeCur.DefaultInterval.Months.ToString();
     textWeeks.Text=RecallTypeCur.DefaultInterval.Weeks.ToString();
     textDays.Text=RecallTypeCur.DefaultInterval.Days.ToString();
     textPattern.Text=RecallTypeCur.TimePattern;
     FillProcs();
 }
		private void FormRecallTypeEdit_Load(object sender, System.EventArgs e) {
			textDescription.Text=RecallTypeCur.Description;
		 	defaultIntervalOld=RecallTypeCur.DefaultInterval;
			comboSpecial.Items.Add(Lan.g(this,"none"));
			comboSpecial.Items.Add(Lan.g(this,"Prophy"));
			comboSpecial.Items.Add(Lan.g(this,"ChildProphy"));
			comboSpecial.Items.Add(Lan.g(this,"Perio"));
			SetSpecialIdx();
			CountForType=Recalls.GetCountForType(RecallTypeCur.RecallTypeNum);
			TriggerList=RecallTriggers.GetForType(RecallTypeCur.RecallTypeNum);//works if 0, too.
			SetSpecialText();
			FillTriggers();
			if(PrefC.GetLong(PrefName.RecallTypeSpecialChildProphy)==RecallTypeCur.RecallTypeNum){
				textRecallAgeAdult.Text=PrefC.GetInt(PrefName.RecallAgeAdult).ToString();
			}
			else{
				groupAgeLimit.Visible=false;
			}
			textYears.Text=RecallTypeCur.DefaultInterval.Years.ToString();
			textMonths.Text=RecallTypeCur.DefaultInterval.Months.ToString();
			textWeeks.Text=RecallTypeCur.DefaultInterval.Weeks.ToString();
			textDays.Text=RecallTypeCur.DefaultInterval.Days.ToString();
			textPattern.Text=RecallTypeCur.TimePattern;
			FillProcs();
		}
Example #3
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if(textDescription.Text==""){
         MsgBox.Show(this,"Description cannot be blank.");
         return;
     }
     if(  textYears.errorProvider1.GetError(textYears)!=""
         || textMonths.errorProvider1.GetError(textMonths)!=""
         || textWeeks.errorProvider1.GetError(textWeeks)!=""
         || textDays.errorProvider1.GetError(textDays)!=""
         ){
         MsgBox.Show(this,"Please fix data entry errors first.");
         return;
     }
     //if(RecallTypes.List comboSpecial.SelectedIndex
     /*
     if(listTriggers.Items.Count==0 && comboSpecial.SelectedIndex!=2) {//except child prophy
         if(!MsgBox.Show(this,true,"Warning! clearing all triggers for a recall type will cause all patient recalls of that type to be deleted, even those with notes.  Continue anyway?")){
             return;
         }
     }*/
     RecallTypeCur.Description=textDescription.Text;
     Interval interval=new Interval(
         PIn.Int(textDays.Text),
         PIn.Int(textWeeks.Text),
         PIn.Int(textMonths.Text),
         PIn.Int(textYears.Text));
     RecallTypeCur.DefaultInterval=interval;
     RecallTypeCur.TimePattern=textPattern.Text;
     if(listProcs.Items.Count==0){
         RecallTypeCur.Procedures="";
     }
     //otherwise, already taken care of.
     try{
         if(RecallTypeCur.IsNew) {
             RecallTypes.Insert(RecallTypeCur);
         }
         else {
             RecallTypes.Update(RecallTypeCur);
         }
     }
     catch(Exception ex){
         MessageBox.Show(ex.Message);
         return;
     }
     RecallTriggers.SetForType(RecallTypeCur.RecallTypeNum,TriggerList);
     bool changed=false;
     if(comboSpecial.SelectedIndex==0){//none
         if(PrefC.GetLong(PrefName.RecallTypeSpecialProphy)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialProphy,0);
             changed=true;
         }
         if(PrefC.GetLong(PrefName.RecallTypeSpecialChildProphy)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialChildProphy,0);
             changed=true;
         }
         if(PrefC.GetLong(PrefName.RecallTypeSpecialPerio)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialPerio,0);
             changed=true;
         }
     }
     else if(comboSpecial.SelectedIndex==1){//Prophy
         if(Prefs.UpdateLong(PrefName.RecallTypeSpecialProphy,RecallTypeCur.RecallTypeNum)){
             changed=true;
         }
         if(PrefC.GetLong(PrefName.RecallTypeSpecialChildProphy)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialChildProphy,0);
             changed=true;
         }
         if(PrefC.GetLong(PrefName.RecallTypeSpecialPerio)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialPerio,0);
             changed=true;
         }
     }
     else if(comboSpecial.SelectedIndex==2){//ChildProphy
         if(PrefC.GetLong(PrefName.RecallTypeSpecialProphy)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialProphy,0);
             changed=true;
         }
         if(Prefs.UpdateLong(PrefName.RecallTypeSpecialChildProphy,RecallTypeCur.RecallTypeNum)){
             changed=true;
         }
         if(PrefC.GetLong(PrefName.RecallTypeSpecialPerio)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialPerio,0);
             changed=true;
         }
     }
     else if(comboSpecial.SelectedIndex==3){//Perio
         if(PrefC.GetLong(PrefName.RecallTypeSpecialProphy)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialProphy,0);
             changed=true;
         }
         if(PrefC.GetLong(PrefName.RecallTypeSpecialChildProphy)==RecallTypeCur.RecallTypeNum){
             Prefs.UpdateLong(PrefName.RecallTypeSpecialChildProphy,0);
             changed=true;
         }
         if(Prefs.UpdateLong(PrefName.RecallTypeSpecialPerio,RecallTypeCur.RecallTypeNum)){
             changed=true;
         }
     }
     DataValid.SetInvalid(InvalidType.RecallTypes);
     if(changed){
         DataValid.SetInvalid(InvalidType.Prefs);
     }
     //Ask user to update recalls for patients if they changed the DefaultInterval.
     if(!RecallTypeCur.IsNew && defaultIntervalOld!=RecallTypeCur.DefaultInterval) {
         if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Default interval has been changed.  Reset all current patient intervals of this type?")) {
             Recalls.UpdateDefaultIntervalForPatients(RecallTypeCur.RecallTypeNum,defaultIntervalOld,RecallTypeCur.DefaultInterval);
         }
     }
     DialogResult=DialogResult.OK;
 }
Example #4
0
		private static void To3_1_0() {
			if(FromVersion < new Version("3.1.0.0")) {
				ExecuteFile("convert_3_1_0.txt");//Might throw an exception which we handle
				//add Sirona Sidexis:
				string command="INSERT INTO program (ProgName,ProgDesc,Enabled,Path,CommandLine,Note"
					+") VALUES("
					+"'Sirona', "
					+"'Sirona Sidexis from www.sirona.com', "
					+"'0', "
					+"'"+POut.String(@"C:\sidexis\sidexis.exe")+"', "
					+"'', "
					+"'')";
				int programNum=Db.NonQ32(command,true);//we now have a ProgramNum to work with
				command="INSERT INTO programproperty (ProgramNum,PropertyDesc,PropertyValue"
					+") VALUES("
					+"'"+programNum.ToString()+"', "
					+"'Enter 0 to use PatientNum, or 1 to use ChartNum', "
					+"'0')";
				Db.NonQ32(command);
				command="INSERT INTO toolbutitem (ProgramNum,ToolBar,ButtonText) "
					+"VALUES ("
					+"'"+programNum.ToString()+"', "
					+"'"+((int)ToolBarsAvail.ChartModule).ToString()+"', "
					+"'Sirona')";
				Db.NonQ32(command);
				//convert recall
				//For inactive patients, assume no meaningful info if patients inactive,
				//so no need to create a recall. Only convert active patients.
				command="SELECT PatNum,RecallStatus,RecallInterval "
					+"FROM patient WHERE PatStatus=0";
				DataTable patTable=Db.GetTable(command);
				DataTable table;
				DateTime previousDate;
				DateTime dueDate;
				int patNum;
				int status;
				int interval;
				Interval newInterval;
				for(int i=0;i<patTable.Rows.Count;i++) {
					patNum=PIn.Int(patTable.Rows[i][0].ToString());
					status=PIn.Int(patTable.Rows[i][1].ToString());
					interval=PIn.Int(patTable.Rows[i][2].ToString());
					//get previous date
					command="SELECT MAX(procedurelog.procdate) "
						+"FROM procedurelog,procedurecode "
						+"WHERE procedurelog.PatNum="+patNum.ToString()
						+" AND procedurecode.ADACode = procedurelog.ADACode "
						+"AND procedurecode.SetRecall = 1 "
						+"AND (procedurelog.ProcStatus = 2 "
						+"OR procedurelog.ProcStatus = 3 "
						+"OR procedurelog.ProcStatus = 4) "
						+"GROUP BY procedurelog.PatNum";
					table=Db.GetTable(command);
					if(table.Rows.Count==0) {
						previousDate=DateTime.MinValue;
					}
					else {
						previousDate=PIn.Date(table.Rows[0][0].ToString());
					}
					//If no useful info and no trigger. No recall created
					if(status==0 && (interval==0 || interval==6)
						&& previousDate==DateTime.MinValue)//and no trigger
					{
						continue;
					}
					if(interval==0) {
						newInterval=new Interval(0,0,6,0);
					}
					else {
						newInterval=new Interval(0,0,interval,0);
					}
					if(previousDate==DateTime.MinValue) {
						dueDate=DateTime.MinValue;
					}
					else {
						dueDate=previousDate+newInterval;
					}
					command="INSERT INTO recall (PatNum,DateDueCalc,DateDue,DatePrevious,"
						+"RecallInterval,RecallStatus"
						+") VALUES ("
						+"'"+POut.Long(patNum)+"', "
						+POut.Date(dueDate)+", "
						+POut.Date(dueDate)+", "
						+POut.Date(previousDate)+", "
						+"'"+POut.Long(newInterval.ToInt())+"', "
						+"'"+POut.Long(status)+"')";
					Db.NonQ32(command);
				}//for int i<patTable
				command="UPDATE preference SET ValueString = '3.1.0.0' WHERE PrefName = 'DataBaseVersion'";
				Db.NonQ32(command);
			}
			To3_1_3();
		}