コード例 #1
0
 //Family Module
 private void PatientDashboardDataEventArgsFactory(FamilyModules.LoadData data)
 {
     Fam                   = data.Fam;
     Pat                   = data.Pat;
     PatNote               = data.PatNote;
     ListInsSubs           = data.ListInsSubs;
     ListInsPlans          = data.ListInsPlans;
     ListPatPlans          = data.ListPatPlans;
     ListBenefits          = data.ListBenefits;
     ListRecalls           = data.ListRecalls;
     ListPatFields         = data.ArrPatFields.ToList();
     SuperFamilyMembers    = data.SuperFamilyMembers;
     SuperFamilyGuarantors = data.SuperFamilyGuarantors;
     DictCloneSpecialities = data.DictCloneSpecialities;
     PatPict               = data.PatPict;
     HasPatPict            = data.HasPatPict;
     PayorTypeDesc         = data.PayorTypeDesc;
     ListRefAttaches       = data.ListRefAttaches;
     ListGuardians         = data.ListGuardians;
     ListCustRefEntries    = data.ListCustRefEntries;
     ListPatRestricts      = data.ListPatRestricts;
     ListPatFieldDefLinks  = data.ListPatFieldDefLinks;
     DiscountPlan          = data.DiscountPlan;
     ResponsibleParty      = data.ResponsibleParty;
     ListMergeLinks        = data.ListMergeLinks;
 }
コード例 #2
0
        ///<summary>Gets the bool value for a YN pref.  If Unknown, then returns the default.  If you want the 3 state version, then use PrefC.GetEnum&lt;YN&gt; or PrefC.GetCheckState.</summary>
        public static bool GetYN(PrefName prefName)
        {
            YN yn = (YN)PIn.Int(Prefs.GetOne(prefName).ValueString);

            if (yn == YN.Yes)
            {
                return(true);
            }
            if (yn == YN.No)
            {
                return(false);
            }
            //unknown, so use the default
            PrefValueType prefValueType = prefName.GetValueType();

            if (prefValueType == PrefValueType.YN_DEFAULT_FALSE)
            {
                return(false);
            }
            if (prefValueType == PrefValueType.YN_DEFAULT_TRUE)
            {
                return(true);
            }
            throw new ArgumentException("Invalid type");
        }
コード例 #3
0
 ///<summary>Creates a new ODGridCell with the initial value of 'myText' and then initial selected index of 'selectedIdx'.
 ///Meant to be used with combo box columns.</summary>
 public ODGridCell(string myText, int selectedIdx)
 {
     text           = myText;
     _selectedIndex = selectedIdx;
     colorText      = Color.Empty;
     bold           = YN.Unknown;
 }
コード例 #4
0
 ///<summary>Creates a new ODGridCell.</summary>
 public ODGridCell(string myText)
 {
     text      = myText;
     colorText = Color.Empty;
     bold      = YN.Unknown;
     underline = YN.Unknown;
 }
コード例 #5
0
 ///<summary>Creates a new ODGridCell.</summary>
 public ODGridCell()
 {
     text      = "";
     colorText = Color.Empty;
     bold      = YN.Unknown;
     //colorBackG=Color.Empty;
 }
コード例 #6
0
 ///<summary>True if the computer name of this session is included in the HasVerboseLogging PrefValue.</summary>
 public static bool IsVerboseLoggingSession()
 {
     try {
         if (Prefs.DictIsNull())                  //Do not allow PrefC.GetString below if we haven't loaded the Pref cache yet. This would cause a recursive loop and stack overflow.
         {
             throw new Exception("Prefs cache is null");
         }
         if (_isVerboseLoggingSession == YN.Unknown)
         {
             if (PrefC.GetString(PrefName.HasVerboseLogging).ToLower().Split(',').ToList().Exists(x => x == Environment.MachineName.ToLower()))
             {
                 _isVerboseLoggingSession = YN.Yes;
                 //Switch logger to a directory that won't have permissions issues.
                 Logger.UseMyDocsDirectory();
             }
             else
             {
                 _isVerboseLoggingSession = YN.No;
             }
         }
         return(_isVerboseLoggingSession == YN.Yes);
     }
     catch (Exception e) {
         e.DoNothing();
         return(false);
     }
 }
コード例 #7
0
ファイル: FormScreenGroup.cs プロジェクト: nampn/ODental
 private string getX(YN ynValue)
 {
     if (ynValue == YN.Yes)
     {
         return("X");
     }
     return("");
 }
コード例 #8
0
        ///<summary>Sets the foreground text to red if any row has a DOS between textDOSFrom and textDOSTo and matches textClaimFee </summary>
        private void HighlightRows()
        {
            DateTime dateFrom           = PIn.Date(textDateFrom.Text);
            DateTime dateTo             = PIn.Date(textDateTo.Text);
            double   fee                = PIn.Double(textClaimFee.Text);
            int      rowsHighlightCount = 0;
            int      lastHighlightIndex = 0;

            gridClaims.BeginUpdate();
            for (int i = 0; i < gridClaims.Rows.Count; i++)
            {
                gridClaims.Rows[i].ColorText = Color.Black; //reset row highlighting
                gridClaims.Rows[i].Bold      = false;       //reset row highlighting
                Claim claim       = (Claim)gridClaims.Rows[i].Tag;
                YN    isFeeMatch  = YN.No;                  //If fee matches then yes, if fee doesnt match then no, if no fee entered then unknown
                YN    isDateMatch = YN.No;                  //If both dates match then yes, if both dates dont match then no, if no dates entered then unknown
                //Check fee
                if (textClaimFee.Text == "")                //No fee entered
                {
                    isFeeMatch = YN.Unknown;
                }
                else
                {
                    if (claim.ClaimFee.ToString("f").Contains(textClaimFee.Text))
                    {
                        isFeeMatch = YN.Yes;
                    }
                }
                //Check date
                if (dateFrom == DateTime.MinValue && dateTo == DateTime.MinValue)               //No dates entered
                {
                    isDateMatch = YN.Unknown;
                }
                else                    //At least one date entered
                {
                    if ((dateFrom.CompareTo(claim.DateService) <= 0 || dateFrom == DateTime.MinValue) &&
                        (dateTo.CompareTo(claim.DateService) >= 0 || dateTo == DateTime.MinValue))
                    {
                        isDateMatch = YN.Yes;
                    }
                }
                if ((isFeeMatch == YN.Yes || isDateMatch == YN.Yes) && (isFeeMatch != YN.No && isDateMatch != YN.No))          //If either match and neither don't match
                //Highlight row
                {
                    gridClaims.Rows[i].ColorText = Color.Red;
                    gridClaims.Rows[i].Bold      = true;
                    rowsHighlightCount++;
                    lastHighlightIndex = i;
                }
            }
            gridClaims.EndUpdate();
            if (rowsHighlightCount == 1)
            {
                gridClaims.SetSelected(lastHighlightIndex, true);
                FillClaimDetails(lastHighlightIndex);
            }
        }
コード例 #9
0
ファイル: FormTxtMsgEdit.cs プロジェクト: steev90/opendental
        /// <summary>May be called from other parts of the program without showing this form. You must still create an instance of this form though. Checks CallFire bridge, if it is OK to send a text, etc. (Buttons to load this form are usually  disabled if it is not OK, but this is needed for Confirmations, Recalls, etc.) </summary>
        public void SendText(long patNum, string wirelessPhone, string message, YN txtMsgOk)
        {
            if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start", patNum, wirelessPhone, message, txtMsgOk))
            {
                return;
            }
            if (wirelessPhone == "")
            {
                MsgBox.Show(this, "Please enter a phone number.");
                return;
            }
            if (!Programs.IsEnabled(ProgramName.CallFire))
            {
                MsgBox.Show(this, "CallFire Program Link must be enabled.");
                return;
            }
            if (txtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo))
            {
                MsgBox.Show(this, "It is not OK to text this patient.");
                return;
            }
            if (txtMsgOk == YN.No)
            {
                MsgBox.Show(this, "It is not OK to text this patient.");
                return;
            }
            string key = ProgramProperties.GetPropVal(ProgramName.CallFire, "Key From CallFire");
            string msg = wirelessPhone + "," + message.Replace(",", "");     //ph#,msg Commas in msg cause error.

            try {
                CallFireService.SMSService callFire = new CallFireService.SMSService();
                callFire.sendSMSCampaign(
                    key,
                    new string[] { msg },
                    "Open Dental");
            }
            catch (Exception ex) {
                MsgBox.Show(this, "Error sending text message.\r\n\r\n" + ex.Message);
                return;
            }
            Commlog commlog = new Commlog();

            commlog.CommDateTime   = DateTime.Now;
            commlog.DateTStamp     = DateTime.Now;
            commlog.CommType       = DefC.Short[(int)DefCat.CommLogTypes][0].DefNum; //The first one in the list.  We can enhance later.
            commlog.Mode_          = CommItemMode.Text;
            commlog.Note           = msg;                                            //phone,note
            commlog.PatNum         = patNum;
            commlog.SentOrReceived = CommSentOrReceived.Sent;
            commlog.UserNum        = Security.CurUser.UserNum;
            commlog.DateTimeEnd    = DateTime.Now;
            Commlogs.Insert(commlog);
            SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Insert Text Message");
        }
コード例 #10
0
ファイル: FormTxtMsgEdit.cs プロジェクト: mnisl/OD
		/// <summary>May be called from other parts of the program without showing this form. You must still create an instance of this form though. Checks CallFire bridge, if it is OK to send a text, etc. (Buttons to load this form are usually  disabled if it is not OK, but this is needed for Confirmations, Recalls, etc.) </summary>
		public bool SendText(long patNum,string wirelessPhone,string message,YN txtMsgOk) {
			if(Plugins.HookMethod(this,"FormTxtMsgEdit.SendText_Start",patNum,wirelessPhone,message,txtMsgOk)) {
				return false;
			}
			if(Plugins.HookMethod(this,"FormTxtMsgEdit.SendText_Start2",patNum,wirelessPhone,message,txtMsgOk)) {
				return true;
			}
			if(wirelessPhone=="") {
				MsgBox.Show(this,"Please enter a phone number.");
				return false;
			}
			if(!Programs.IsEnabled(ProgramName.CallFire)) {
				MsgBox.Show(this,"CallFire Program Link must be enabled.");
				return false;
			}
			if(txtMsgOk==YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)){
				MsgBox.Show(this,"It is not OK to text this patient.");
				return false;
			}
			if(txtMsgOk==YN.No){
				MsgBox.Show(this,"It is not OK to text this patient.");
				return false;
			}
			if(message.Length>160) {
				MsgBox.Show(this,"Text length must be less than 160 characters.");
				return false;
			}
			string key=ProgramProperties.GetPropVal(ProgramName.CallFire,"Key From CallFire");
			string msg=wirelessPhone+","+message.Replace(",","");//ph#,msg Commas in msg cause error.
			try {
				CallFireService.SMSService callFire=new CallFireService.SMSService();
				callFire.sendSMSCampaign(
					key,
					new string[] { msg },
					"Open Dental");
			}
			catch(Exception ex) {
				MsgBox.Show(this,"Error sending text message.\r\n\r\n"+ex.Message);
				return false;
			}
			Commlog commlog=new Commlog();
			commlog.CommDateTime=DateTime.Now;
			commlog.DateTStamp=DateTime.Now;
			commlog.CommType=DefC.Short[(int)DefCat.CommLogTypes][0].DefNum;//The first one in the list.  We can enhance later.
			commlog.Mode_=CommItemMode.Text;
			commlog.Note=msg;//phone,note
			commlog.PatNum=patNum;
			commlog.SentOrReceived=CommSentOrReceived.Sent;
			commlog.UserNum=Security.CurUser.UserNum;
			commlog.DateTimeEnd=DateTime.Now;
			Commlogs.Insert(commlog);
			SecurityLogs.MakeLogEntry(Permissions.CommlogEdit,commlog.PatNum,"Insert Text Message");
			return true;
		}
コード例 #11
0
ファイル: ConvertDatabases2.cs プロジェクト: nampn/ODental
        public static System.Version LatestVersion = new Version("12.1.7.0"); //This value must be changed when a new conversion is to be triggered.

        #endregion Fields

        #region Methods

        /// <summary>Does nothing if this pref is already present</summary>
        public static void Set_7_5_17_AutoMerge(YN InsPlanConverstion_7_5_17_AutoMergeYN)
        {
            string command="SELECT COUNT(*) FROM preference WHERE PrefName='InsPlanConverstion_7_5_17_AutoMergeYN'";
            if(Db.GetCount(command)=="0") {
                command="INSERT INTO preference(PrefName,ValueString) VALUES('InsPlanConverstion_7_5_17_AutoMergeYN','"+POut.Int((int)InsPlanConverstion_7_5_17_AutoMergeYN)+"')";
                Db.NonQ(command);
            }
            else {
                command="UPDATE preference SET ValueString ='"+POut.Int((int)InsPlanConverstion_7_5_17_AutoMergeYN)+"' WHERE PrefName = 'InsPlanConverstion_7_5_17_AutoMergeYN'";
                Db.NonQ(command);
            }
        }
コード例 #12
0
		private void butOK_Click(object sender,EventArgs e) {
			if(!radioMergeY.Checked && !radioMergeN.Checked) {
				MessageBox.Show("One of the options must be selected before clicking OK.");
				return;
			}
			if(radioMergeY.Checked){
				InsPlanConverstion_7_5_17_AutoMergeYN=YN.Yes;
			}
			if(radioMergeN.Checked) {
				InsPlanConverstion_7_5_17_AutoMergeYN=YN.No;
			}
			DialogResult=DialogResult.OK;
		}
コード例 #13
0
        ///<summary>Gets YN value for use in pref setup windows with a 3 state checkbox.</summary>
        public static System.Windows.Forms.CheckState GetYNCheckState(PrefName prefName)
        {
            YN yn = (YN)PIn.Int(Prefs.GetOne(prefName).ValueString);

            if (yn == YN.Yes)
            {
                return(System.Windows.Forms.CheckState.Checked);
            }
            if (yn == YN.No)
            {
                return(System.Windows.Forms.CheckState.Unchecked);
            }
            return(System.Windows.Forms.CheckState.Indeterminate);
        }
コード例 #14
0
ファイル: Prefs.cs プロジェクト: ChemBrain/OpenDental
        ///<summary>Updates a pref of type YN.  Returns true if a change was required, or false if no change needed.</summary>
        public static bool UpdateYN(PrefName prefName, System.Windows.Forms.CheckState checkState)
        {
            YN yn = YN.Unknown;

            if (checkState == System.Windows.Forms.CheckState.Checked)
            {
                yn = YN.Yes;
            }
            if (checkState == System.Windows.Forms.CheckState.Unchecked)
            {
                yn = YN.No;
            }
            return(UpdateYN(prefName, yn));
        }
コード例 #15
0
 private void radioPatient_Click(object sender, EventArgs e)
 {
     if (textWirelessPhone.ReadOnly) //The user clicked the "Patient" radio button multiple times consecutively.
     {
         return;                     //Leave so that the phone number is not wiped out unnecessarily.
     }
     butPatFind.Enabled         = true;
     textPatient.Enabled        = true;
     textWirelessPhone.ReadOnly = true;
     textPatient.Text           = "";
     textWirelessPhone.Text     = "";
     PatNum   = 0;
     TxtMsgOk = YN.Unknown;
 }
コード例 #16
0
        private void butPatFind_Click(object sender, EventArgs e)
        {
            FormPatientSelect formP = new FormPatientSelect();

            formP.ShowDialog();
            if (formP.DialogResult != DialogResult.OK)
            {
                return;
            }
            Patient patCur = Patients.GetPat(formP.SelectedPatNum);

            PatNum                 = patCur.PatNum;
            TxtMsgOk               = patCur.TxtMsgOk;
            textPatient.Text       = patCur.GetNameLF();
            textWirelessPhone.Text = patCur.WirelessPhone;
        }
コード例 #17
0
        private void SetCheckState(CheckBox checkBox, YN state)
        {
            switch (state)
            {
            case YN.Unknown:
                checkBox.CheckState = CheckState.Indeterminate;
                break;

            case YN.Yes:
                checkBox.CheckState = CheckState.Checked;
                break;

            case YN.No:
                checkBox.CheckState = CheckState.Unchecked;
                break;
            }
        }
コード例 #18
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!radioMergeY.Checked && !radioMergeN.Checked)
     {
         MessageBox.Show("One of the options must be selected before clicking OK.");
         return;
     }
     if (radioMergeY.Checked)
     {
         InsPlanConverstion_7_5_17_AutoMergeYN = YN.Yes;
     }
     if (radioMergeN.Checked)
     {
         InsPlanConverstion_7_5_17_AutoMergeYN = YN.No;
     }
     DialogResult = DialogResult.OK;
 }
コード例 #19
0
ファイル: Dunnings.cs プロジェクト: romeroyonatan/opendental
		///<summary>Will return null if no dunning matches the given criteria.</summary>
		public static Dunning GetDunning(Dunning[] dunList,long billingType,int ageAccount,YN insIsPending) {
			//No need to check RemotingRole; no call to db.
			//loop backwards through Dunning list and find the first dunning that matches criteria.
			for(int i=dunList.Length-1;i>=0;i--){
				if(dunList[i].BillingType!=0//0 in the list matches all
					&& dunList[i].BillingType!=billingType){
					continue;
				}
				if(ageAccount < dunList[i].AgeAccount){//match if age is >= item in list
					continue;
				}
				if(dunList[i].InsIsPending!=YN.Unknown//unknown in the list matches all
					&& dunList[i].InsIsPending!=insIsPending){
					continue;
				}
				return dunList[i];
			}
			return null;
		}
コード例 #20
0
 public TestModel(sbyte sByte, char c, short s, int i, long l, byte b, ushort us, uint ui, ulong ul, float f, double d, bool bo, string str, DateTime date, Decimal dec, YN en)
 {
     Sb   = sByte;
     C    = c;
     S    = s;
     I    = i;
     L    = l;
     B    = b;
     Us   = us;
     Ui   = ui;
     Ul   = ul;
     F    = f;
     D    = d;
     Bo   = bo;
     Str  = str;
     Date = date;
     Dec  = dec;
     En   = en;
 }
コード例 #21
0
        private bool SyncPhoneNums()
        {
            string syncError = null;

            Cursor = Cursors.WaitCursor;
            ODProgress.ShowAction(
                () => PhoneNumbers.SyncAllPats(),
                startingMessage: Lan.g(this, "Syncing all patient phone numbers to the phonenumber table") + "...",
                actionException: ex => syncError = Lan.g(this, "The patient phone number sync failed with the message") + ":\r\n" + ex.Message + "\r\n" + Lan.g(this, "Please try again.")
                );
            Cursor = Cursors.Default;
            if (!string.IsNullOrEmpty(syncError))
            {
                MessageBox.Show(this, syncError);
                return(false);
            }
            _usePhonenumTable = YN.Yes;          //so it won't sync again if you clicked the button
            return(true);
        }
コード例 #22
0
 protected void Button10_Click(object sender, EventArgs e)
 {
     Session["Isotimia"] = DropDownList5.SelectedValue;
     YN.Update();
     YN.DataBind();
     YN_App();
     DropDownList5.SelectedValue = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isotimia().ToString();
     if (DropDownList5.SelectedValue == "0")
     {
         DropDownList11.SelectedValue = "0";
         DropDownList12.SelectedValue = "0";
         DropDownList13.SelectedValue = "0";
         DropDownList15.SelectedValue = "0";
         DropDownList14.SelectedValue = "1";
         Button11_Click(e, e);
         Button12_Click(e, e);
         Button13_Click(e, e);
         Button14_Click(e, e);
         Button15_Click(e, e);
     }
 }
コード例 #23
0
        private void PB_UpdateSelectedTask(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine($"Updating task: {(SmartTask)((Button)sender).DataContext}");

            // Get XAML items from Grid
            Grid elements = (Grid)((Button)sender).Parent;

            // Retrieve each field from the edit menu
            try
            {
                DateTimeOffset date        = (DateTimeOffset)((CalendarDatePicker)elements.FindName("CDP_edit_date")).Date;
                int            hour        = (int)((TimePicker)elements.FindName("TP_edit_time")).SelectedTime.Value.Hours;
                int            minute      = (int)((TimePicker)elements.FindName("TP_edit_time")).SelectedTime.Value.Minutes;
                int            durHour     = (int)((ComboBox)elements.FindName("TB_edit_durHours")).SelectedItem;
                int            durMinute   = (int)((ComboBox)elements.FindName("TB_edit_durMins")).SelectedItem;
                TaskType       taskType    = (TaskType)((ComboBox)elements.FindName("CB_edit_taskType")).SelectedItem;
                RepeatType     repeatType  = (RepeatType)((ComboBox)elements.FindName("CB_edit_repeat")).SelectedItem;
                string         title       = ((TextBox)elements.FindName("TB_edit_title")).Text;
                string         description = ((TextBox)elements.FindName("TB_edit_description")).Text;
                YN             required    = (YN)((ComboBox)elements.FindName("CB_edit_required")).SelectedItem;
                string         url         = ((TextBox)elements.FindName("TB_edit_url")).Text;

                // Create a new task from the schedule
                SmartTask newTask = schedule.CreateTask(nextEventID++, date, hour, minute, durHour, durMinute, taskType, repeatType, title, description, required, url);

                // Remove the existing task
                ((SmartTask)((Button)sender).DataContext).DeleteTask();

                // Add the updated task back to the schedule
                schedule.AddTask(newTask);
            }
            catch (Exception err)
            {
                Debug.WriteLine($"Exception thrown in task update: {err.Message}");
            }

            RefreshScheduleView();
        }
コード例 #24
0
ファイル: LedgersTests.cs プロジェクト: ChemBrain/OpenDental
        private void CheckAgingProcLifo(long patNum, double bal_0_30, double bal_31_60, double bal_61_90, double balOver90, double payPlanDue, YN prefVal)
        {
            int agingProcLifoPrev = PrefC.GetInt(PrefName.AgingProcLifo);

            try {
                PrefT.UpdateInt(PrefName.AgingProcLifo, (int)prefVal);
                Ledgers.ComputeAging(patNum, DateTime.Today);
                PatAssertBalances(patNum, bal_0_30, bal_31_60, bal_61_90, balOver90, payPlanDue);
            }
            finally {
                PrefT.UpdateInt(PrefName.AgingProcLifo, agingProcLifoPrev);
            }
        }
コード例 #25
0
ファイル: Dunnings.cs プロジェクト: steev90/opendental
 ///<summary>Will return null if no dunning matches the given criteria.</summary>
 public static Dunning GetDunning(Dunning[] dunList, long billingType, int ageAccount, YN insIsPending)
 {
     //No need to check RemotingRole; no call to db.
     //loop backwards through Dunning list and find the first dunning that matches criteria.
     for (int i = dunList.Length - 1; i >= 0; i--)
     {
         if (dunList[i].BillingType != 0 &&          //0 in the list matches all
             dunList[i].BillingType != billingType)
         {
             continue;
         }
         if (ageAccount < dunList[i].AgeAccount)                //match if age is >= item in list
         {
             continue;
         }
         if (dunList[i].InsIsPending != YN.Unknown &&          //unknown in the list matches all
             dunList[i].InsIsPending != insIsPending)
         {
             continue;
         }
         return(dunList[i]);
     }
     return(null);
 }
コード例 #26
0
ファイル: FormChooseDatabase.cs プロジェクト: nampn/ODental
        ///<summary>Gets the settings from the config file, and fills the form with those values.  Gets run twice at startup.  If certain command-line parameters were passed in when starting the program, then the config file will not be processed at all.</summary>
        public void GetConfig()
        {
            if (WebServiceUri != "" ||      //if a URI was passed in
                DatabaseName != "")    //or if a direct db was specified
            {
                return;                //do not even bother with the config file
            }
            //command-line support for the upper portion of this window will be added later.
            //Improvement should be made here to avoid requiring admin priv.
            //Search path should be something like this:
            //1. /home/username/.opendental/config.xml (or corresponding user path in Windows)
            //2. /etc/opendental/config.xml (or corresponding machine path in Windows) (should be default for new installs)
            //3. Application Directory/FreeDentalConfig.xml (read-only if user is not admin)
            string xmlPath = ODFileUtils.CombinePaths(Application.StartupPath, "FreeDentalConfig.xml");

            if (!File.Exists(xmlPath))
            {
                FileStream fs;
                try {
                    fs = File.Create(xmlPath);
                }
                catch {
                    MessageBox.Show("The very first time that the program is run, it must be run as an Admin.  If using Vista, right click, run as Admin.");
                    Application.Exit();
                    return;
                }
                fs.Close();
                comboComputerName.Text = "localhost";
                                #if (TRIALONLY)
                comboDatabase.Text = "demo";
                                #else
                comboDatabase.Text = "opendental";
                                #endif
                textUser.Text = "root";
                if (listType.Items.Count > 0)               //not true on startup
                {
                    listType.SelectedIndex = 0;
                }
                //return;
            }
            XmlDocument document = new XmlDocument();
            try{
                document.Load(xmlPath);
                XPathNavigator Navigator = document.CreateNavigator();
                XPathNavigator nav;
                //Database type
                nav = Navigator.SelectSingleNode("//DatabaseType");
                if (listType.Items.Count > 0)               //not true on startup
                {
                    listType.SelectedIndex = 0;
                }
                DataConnection.DBtype = DatabaseType.MySql;
                if (nav != null && nav.Value == "Oracle" && listType.Items.Count > 1)
                {
                    listType.SelectedIndex = 1;
                    DataConnection.DBtype  = DatabaseType.Oracle;
                }
                //See if there's a ConnectionString
                nav = Navigator.SelectSingleNode("//ConnectionString");
                if (nav != null)
                {
                    //If there is a ConnectionString, then use it.
                    textConnectionString.Text = nav.Value;
                    return;
                }
                //See if there's a DatabaseConnection
                nav = Navigator.SelectSingleNode("//DatabaseConnection");
                if (nav != null)
                {
                    //If there is a DatabaseConnection, then use it.
                    groupServer.Enabled    = false;
                    comboComputerName.Text = nav.SelectSingleNode("ComputerName").Value;
                    if (!IsAccessedFromMainMenu)
                    {
                        comboDatabase.Text = nav.SelectSingleNode("Database").Value;
                    }
                    textUser.Text     = nav.SelectSingleNode("User").Value;
                    textPassword.Text = nav.SelectSingleNode("Password").Value;
                    XPathNavigator noshownav = nav.SelectSingleNode("NoShowOnStartup");
                    if (noshownav != null)
                    {
                        string noshow = noshownav.Value;
                        if (noshow == "True")
                        {
                            NoShow = YN.Yes;
                            checkNoShow.Checked = true;
                        }
                    }
                    return;
                }
                nav = Navigator.SelectSingleNode("//ServerConnection");

                /* example:
                 * <ServerConnection>
                 *      <URI>http://server/OpenDentalServer/ServiceMain.asmx</URI>
                 *      <UsingEcw>True</UsingEcw>
                 * </ServerConnection>
                 */
                if (nav != null)
                {
                    //If there is a ServerConnection, then use it.
                    checkConnectServer.Checked = true;
                    groupDirect.Enabled        = false;
                    textURI.Text = nav.SelectSingleNode("URI").Value;
                    XPathNavigator ecwnav = nav.SelectSingleNode("UsingEcw");
                    if (ecwnav != null)
                    {
                        string usingecw = ecwnav.Value;
                        if (usingecw == "True")
                        {
                            NoShow = YN.Yes;
                            checkUsingEcw.Checked = true;
                        }
                    }
                    textUser2.Select();
                    return;
                }
            }
            catch (Exception) {
                //Common error: root element is missing
                //MessageBox.Show(e.Message);
            }
            comboComputerName.Text     = "localhost";
            comboDatabase.Text         = "opendental";
            textUser.Text              = "root";
            checkConnectServer.Checked = false;
            groupDirect.Enabled        = true;
            groupServer.Enabled        = false;
            if (listType.Items.Count > 1)
            {
                listType.SelectedIndex = 0;
            }
            DataConnection.DBtype = DatabaseType.MySql;
        }
コード例 #27
0
 /// <summary>Sets UI for preferences that we know for sure will exist.</summary>
 private void FillStandardPrefs()
 {
     #region Account Tab
     checkAgingMonthly.Checked = PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily);
     foreach (PayClinicSetting prompt in Enum.GetValues(typeof(PayClinicSetting)))
     {
         comboPaymentClinicSetting.Items.Add(Lan.g(this, prompt.GetDescription()));
     }
     comboPaymentClinicSetting.SelectedIndex = PrefC.GetInt(PrefName.PaymentClinicSetting);
     checkPaymentsPromptForPayType.Checked   = PrefC.GetBool(PrefName.PaymentsPromptForPayType);
     for (int i = 0; i < Enum.GetNames(typeof(AutoSplitPreference)).Length; i++)
     {
         comboAutoSplitPref.Items.Add(Lans.g(this, Enum.GetNames(typeof(AutoSplitPreference))[i]));
     }
     comboAutoSplitPref.SelectedIndex    = PrefC.GetInt(PrefName.AutoSplitLogic);
     checkBillShowTransSinceZero.Checked = PrefC.GetBool(PrefName.BillingShowTransSinceBalZero);
     textClaimIdentifier.Text            = PrefC.GetString(PrefName.ClaimIdPrefix);
     checkReceiveReportsService.Checked  = PrefC.GetBool(PrefName.ClaimReportReceivedByService);
     _claimReportReceiveInterval         = PrefC.GetInt(PrefName.ClaimReportReceiveInterval);
     if (_claimReportReceiveInterval == 0)
     {
         radioTime.Checked = true;
         DateTime fullDateTime = PrefC.GetDateT(PrefName.ClaimReportReceiveTime);
         textReportCheckTime.Text = fullDateTime.ToShortTimeString();
     }
     else
     {
         textReportCheckInterval.Text = POut.Int(_claimReportReceiveInterval);
         radioInterval.Checked        = true;
     }
     List <RigorousAccounting> listEnums = Enum.GetValues(typeof(RigorousAccounting)).OfType <RigorousAccounting>().ToList();
     for (int i = 0; i < listEnums.Count; i++)
     {
         comboRigorousAccounting.Items.Add(listEnums[i].GetDescription());
     }
     comboRigorousAccounting.SelectedIndex = PrefC.GetInt(PrefName.RigorousAccounting);
     List <RigorousAdjustments> listAdjEnums = Enum.GetValues(typeof(RigorousAdjustments)).OfType <RigorousAdjustments>().ToList();
     for (int i = 0; i < listAdjEnums.Count; i++)
     {
         comboRigorousAdjustments.Items.Add(listAdjEnums[i].GetDescription());
     }
     comboRigorousAdjustments.SelectedIndex = PrefC.GetInt(PrefName.RigorousAdjustments);
     checkHidePaysplits.Checked             = PrefC.GetBool(PrefName.PaymentWindowDefaultHideSplits);
     foreach (PayPlanVersions version in Enum.GetValues(typeof(PayPlanVersions)))
     {
         comboPayPlansVersion.Items.Add(Lan.g("enumPayPlanVersions", version.GetDescription()));
     }
     comboPayPlansVersion.SelectedIndex = PrefC.GetInt(PrefName.PayPlansVersion) - 1;
     textBillingElectBatchMax.Text      = PrefC.GetInt(PrefName.BillingElectBatchMax).ToString();
     checkBillingShowProgress.Checked   = PrefC.GetBool(PrefName.BillingShowSendProgress);
     #endregion Account Tab
     #region Advanced Tab
     checkPasswordsMustBeStrong.Checked         = PrefC.GetBool(PrefName.PasswordsMustBeStrong);
     checkPasswordsStrongIncludeSpecial.Checked = PrefC.GetBool(PrefName.PasswordsStrongIncludeSpecial);
     checkPasswordForceWeakToStrong.Checked     = PrefC.GetBool(PrefName.PasswordsWeakChangeToStrong);
     checkLockIncludesAdmin.Checked             = PrefC.GetBool(PrefName.SecurityLockIncludesAdmin);
     textLogOffAfterMinutes.Text      = PrefC.GetInt(PrefName.SecurityLogOffAfterMinutes).ToString();
     checkUserNameManualEntry.Checked = PrefC.GetBool(PrefName.UserNameManualEntry);
     textDateLock.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString();
     textDaysLock.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString();
     long signalInactive = PrefC.GetLong(PrefName.SignalInactiveMinutes);
     textInactiveSignal.Text = (signalInactive == 0 ? "" : signalInactive.ToString());
     long sigInterval = PrefC.GetLong(PrefName.ProcessSigsIntervalInSecs);
     textSigInterval.Text = (sigInterval == 0 ? "" : sigInterval.ToString());
     string patSearchMinChars = PrefC.GetString(PrefName.PatientSelectSearchMinChars);
     textPatSelectMinChars.Text = Math.Min(10, Math.Max(1, PIn.Int(patSearchMinChars, false))).ToString();       //enforce minimum 1 maximum 10
     string patSearchPauseMs = PrefC.GetString(PrefName.PatientSelectSearchPauseMs);
     textPatSelectPauseMs.Text = Math.Min(10000, Math.Max(1, PIn.Int(patSearchPauseMs, false))).ToString();      //enforce minimum 1 maximum 10000
     checkPatientSelectFilterRestrictedClinics.Checked = PrefC.GetBool(PrefName.PatientSelectFilterRestrictedClinics);
     YN searchEmptyParams = PIn.Enum <YN>(PrefC.GetInt(PrefName.PatientSelectSearchWithEmptyParams));
     if (searchEmptyParams != YN.Unknown)
     {
         checkPatSearchEmptyParams.CheckState = CheckState.Unchecked;
         checkPatSearchEmptyParams.Checked    = searchEmptyParams == YN.Yes;
     }
     _usePhonenumTable = PrefC.GetEnum <YN>(PrefName.PatientPhoneUsePhonenumberTable);
     if (_usePhonenumTable != YN.Unknown)
     {
         checkUsePhoneNumTable.CheckState = CheckState.Unchecked;
         checkUsePhoneNumTable.Checked    = _usePhonenumTable == YN.Yes;
     }
     #endregion Advanced Tab
     #region Appts Tab
     checkApptsRequireProcs.Checked  = PrefC.GetBool(PrefName.ApptsRequireProc);
     checkUseOpHygProv.Checked       = PrefC.GetBool(PrefName.ApptSecondaryProviderConsiderOpOnly);
     checkEnterpriseApptList.Checked = PrefC.GetBool(PrefName.EnterpriseApptList);
     checkEnableNoneView.Checked     = PrefC.GetBool(PrefName.EnterpriseNoneApptViewDefaultDisabled);
     #endregion Appts Tab
     #region Family Tab
     checkSuperFam.Checked            = PrefC.GetBool(PrefName.ShowFeatureSuperfamilies);
     checkPatClone.Checked            = PrefC.GetBool(PrefName.ShowFeaturePatientClone);
     checkShowFeeSchedGroups.Checked  = PrefC.GetBool(PrefName.ShowFeeSchedGroups);
     checkSuperFamCloneCreate.Checked = PrefC.GetBool(PrefName.CloneCreateSuperFamily);
     //users should only see the snapshot trigger and service runtime if they have it set to something other than ClaimCreate.
     //if a user wants to be able to change claimsnapshot settings, the following MySQL statement should be run:
     //UPDATE preference SET ValueString = 'Service'	 WHERE PrefName = 'ClaimSnapshotTriggerType'
     if (PIn.Enum <ClaimSnapshotTrigger>(PrefC.GetString(PrefName.ClaimSnapshotTriggerType), true) == ClaimSnapshotTrigger.ClaimCreate)
     {
         groupClaimSnapshot.Visible = false;
     }
     foreach (ClaimSnapshotTrigger trigger in Enum.GetValues(typeof(ClaimSnapshotTrigger)))
     {
         comboClaimSnapshotTrigger.Items.Add(trigger.GetDescription());
     }
     comboClaimSnapshotTrigger.SelectedIndex = (int)PIn.Enum <ClaimSnapshotTrigger>(PrefC.GetString(PrefName.ClaimSnapshotTriggerType), true);
     textClaimSnapshotRunTime.Text           = PrefC.GetDateT(PrefName.ClaimSnapshotRunTime).ToShortTimeString();
     #endregion Family Tab
     #region Reports Tab
     checkUseReportServer.Checked = (PrefC.GetString(PrefName.ReportingServerCompName) != "" || PrefC.GetString(PrefName.ReportingServerURI) != "");
     textServerName.Text          = PrefC.GetString(PrefName.ReportingServerCompName);
     comboDatabase.Text           = PrefC.GetString(PrefName.ReportingServerDbName);
     textMysqlUser.Text           = PrefC.GetString(PrefName.ReportingServerMySqlUser);
     string decryptedPass;
     CDT.Class1.Decrypt(PrefC.GetString(PrefName.ReportingServerMySqlPassHash), out decryptedPass);
     textMysqlPass.Text     = decryptedPass;
     textMiddleTierURI.Text = PrefC.GetString(PrefName.ReportingServerURI);
     FillComboDatabases();
     SetReportServerUIEnabled();
     #endregion Reports Tab
 }
コード例 #28
0
        ///<summary>Return false to indicate exit app.  Only called when program first starts up at the beginning of FormOpenDental.PrefsStartup.</summary>
        public bool Convert(string fromVersion, string toVersion, bool isSilent, Form currentForm = null)
        {
            FromVersion = new Version(fromVersion);
            ToVersion   = new Version(toVersion);        //Application.ProductVersion);
            if (FromVersion >= new Version("3.4.0") && PrefC.GetBool(PrefName.CorruptedDatabase))
            {
                FormOpenDental.ExitCode = 201;              //Database was corrupted due to an update failure
                if (!isSilent)
                {
                    MsgBox.Show(this, "Your database is corrupted because an update failed.  Please contact us.  This database is unusable and you will need to restore from a backup.");
                }
                return(false);               //shuts program down.
            }
            if (FromVersion == ToVersion)
            {
                return(true);                         //no conversion necessary
            }
            if (FromVersion.CompareTo(ToVersion) > 0) //"Cannot convert database to an older version."
            //no longer necessary to catch it here.  It will be handled soon enough in CheckProgramVersion
            {
                return(true);
            }
            if (FromVersion < new Version("2.8.0"))
            {
                FormOpenDental.ExitCode = 130;              //Database must be upgraded to 2.8 to continue
                if (!isSilent)
                {
                    MsgBox.Show(this, "This database is too old to easily convert in one step. Please upgrade to 2.1 if necessary, then to 2.8.  Then you will be able to upgrade to this version. We apologize for the inconvenience.");
                }
                return(false);
            }
            if (FromVersion < new Version("6.6.2"))
            {
                FormOpenDental.ExitCode = 131;              //Database must be upgraded to 11.1 to continue
                if (!isSilent)
                {
                    MsgBox.Show(this, "This database is too old to easily convert in one step. Please upgrade to 11.1 first.  Then you will be able to upgrade to this version. We apologize for the inconvenience.");
                }
                return(false);
            }
            if (FromVersion < new Version("3.0.1"))
            {
                if (!isSilent)
                {
                    MsgBox.Show(this, "This is an old database.  The conversion must be done using MySQL 4.1 (not MySQL 5.0) or it will fail.");
                }
            }
            if (FromVersion.ToString() == "2.9.0.0" || FromVersion.ToString() == "3.0.0.0" || FromVersion.ToString() == "4.7.0.0")
            {
                FormOpenDental.ExitCode = 190;              //Cannot convert this database version which was only for development purposes
                if (!isSilent)
                {
                    MsgBox.Show(this, "Cannot convert this database version which was only for development purposes.");
                }
                return(false);
            }
            if (FromVersion > new Version("4.7.0") && FromVersion.Build == 0)
            {
                FormOpenDental.ExitCode = 190;              //Cannot convert this database version which was only for development purposes
                if (!isSilent)
                {
                    MsgBox.Show(this, "Cannot convert this database version which was only for development purposes.");
                }
                return(false);
            }
            if (FromVersion >= LatestVersion)
            {
                return(true);               //no conversion necessary
            }
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                FormOpenDental.ExitCode = 140;              //Web client cannot convert database
                if (!isSilent)
                {
                    MsgBox.Show(this, "Web client cannot convert database.  Must be using a direct connection.");
                }
                return(false);
            }
            if (ReplicationServers.ServerIsBlocked())
            {
                FormOpenDental.ExitCode = 150;              //Replication server is blocked from performing updates
                if (!isSilent)
                {
                    MsgBox.Show(this, "This replication server is blocked from performing updates.");
                }
                return(false);
            }
#if TRIALONLY
            //Trial users should never be able to update a database.
            if (PrefC.GetString(PrefName.RegistrationKey) != "") //Allow databases with no reg key to update.  Needed by our conversion department.
            {
                FormOpenDental.ExitCode = 191;                   //Trial versions cannot connect to live databases
                if (!isSilent)
                {
                    MsgBox.Show(this, "Trial versions cannot connect to live databases.  Please run the Setup.exe in the AtoZ folder to reinstall your original version.");
                }
                return(false);
            }
#endif
            if (PrefC.GetString(PrefName.WebServiceServerName) != "" &&       //using web service
                !ODEnvironment.IdIsThisComputer(PrefC.GetString(PrefName.WebServiceServerName).ToLower()))                   //and not on web server
            {
                if (isSilent)
                {
                    FormOpenDental.ExitCode = 141;   //Updates are only allowed from a designated web server
                    return(false);                   //if you are in debug mode and you really need to update the DB, you can manually clear the WebServiceServerName preference.
                }
                //This will be handled in CheckProgramVersion, giving the user option to downgrade or exit program.
                return(true);
            }
            //If MyISAM and InnoDb mix, then try to fix
            if (DataConnection.DBtype == DatabaseType.MySql)           //not for Oracle
            {
                string namesInnodb = InnoDb.GetInnodbTableNames();     //Or possibly some other format.
                int    numMyisam   = DatabaseMaintenances.GetMyisamTableCount();
                if (namesInnodb != "" && numMyisam > 0)
                {
                    if (!isSilent)
                    {
                        MessageBox.Show(Lan.g(this, "A mixture of database tables in InnoDB and MyISAM format were found.  A database backup will now be made, and then the following InnoDB tables will be converted to MyISAM format: ") + namesInnodb);
                    }
                    if (!Shared.MakeABackup(isSilent, BackupLocation.ConvertScript, false))
                    {
                        Cursor.Current          = Cursors.Default;
                        FormOpenDental.ExitCode = 101;                      //Database Backup failed
                        return(false);
                    }
                    if (!DatabaseMaintenances.ConvertTablesToMyisam())
                    {
                        FormOpenDental.ExitCode = 102;                      //Failed to convert InnoDB tables to MyISAM format
                        if (!isSilent)
                        {
                            MessageBox.Show(Lan.g(this, "Failed to convert InnoDB tables to MyISAM format. Please contact support."));
                        }
                        return(false);
                    }
                    if (!isSilent)
                    {
                        MessageBox.Show(Lan.g(this, "All tables converted to MyISAM format successfully."));
                    }
                    namesInnodb = "";
                }
                if (namesInnodb == "" && numMyisam > 0)             //if all tables are myisam
                //but default storage engine is innodb, then kick them out.
                {
                    if (DatabaseMaintenances.GetStorageEngineDefaultName().ToUpper() != "MYISAM") //Probably InnoDB but could be another format.
                    {
                        FormOpenDental.ExitCode = 103;                                            //Default database .ini setting is innoDB
                        if (!isSilent)
                        {
                            MessageBox.Show(Lan.g(this, "The database tables are in MyISAM format, but the default database engine format is InnoDB. You must change the default storage engine within the my.ini (or my.cnf) file on the database server and restart MySQL in order to fix this problem. Exiting."));
                        }
                        return(false);
                    }
                }
            }
#if DEBUG
            if (!isSilent && MessageBox.Show("You are in Debug mode.  Your database can now be converted" + "\r"
                                             + "from version" + " " + FromVersion.ToString() + "\r"
                                             + "to version" + " " + ToVersion.ToString() + "\r"
                                             + "You can click Cancel to skip conversion and attempt to run the newer code against the older database."
                                             , "", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return(true);               //If user clicks cancel, then do nothing
            }
#else
            if (!isSilent && MessageBox.Show(Lan.g(this, "Your database will now be converted") + "\r"
                                             + Lan.g(this, "from version") + " " + FromVersion.ToString() + "\r"
                                             + Lan.g(this, "to version") + " " + ToVersion.ToString() + "\r"
                                             + Lan.g(this, "The conversion works best if you are on the server.  Depending on the speed of your computer, it can be as fast as a few seconds, or it can take as long as 10 minutes.")
                                             , "", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return(false);               //If user clicks cancel, then close the program
            }
#endif
            Cursor.Current = Cursors.WaitCursor;
            Action actionCloseConvertProgress = null;
#if !DEBUG
            if (!isSilent)
            {
                if (DataConnection.DBtype != DatabaseType.MySql &&
                    !MsgBox.Show(this, true, "If you have not made a backup, please Cancel and backup before continuing.  Continue?"))
                {
                    return(false);
                }
            }
            if (DataConnection.DBtype == DatabaseType.MySql)
            {
                if (!Shared.MakeABackup(isSilent, BackupLocation.ConvertScript, false))
                {
                    Cursor.Current          = Cursors.Default;
                    FormOpenDental.ExitCode = 101;                  //Database Backup failed
                    return(false);
                }
            }
            //We've been getting an increasing number of phone calls with databases that have duplicate preferences which is impossible
            //unless a user has gotten this far and another computer in the office is in the middle of an update as well.
            //The issue is most likely due to the blocking messageboxes above which wait indefinitely for user input right before upgrading the database.
            //This means that the cache for this computer could be stale and we need to manually refresh our cache to double check
            //that the database isn't flagged as corrupt, an update isn't in progress, or that the database version hasn't changed (someone successfully updated already).
            Prefs.RefreshCache();
            //Now check the preferences that should stop this computer from executing an update.
            if (PrefC.GetBool(PrefName.CorruptedDatabase) ||
                (PrefC.GetString(PrefName.UpdateInProgressOnComputerName) != "" && PrefC.GetString(PrefName.UpdateInProgressOnComputerName) != Environment.MachineName))
            {
                //At this point, the pref "corrupted database" being true means that a computer is in the middle of running the upgrade script.
                //There will be another corrupted database check on start up which will take care of the scenario where this is truly a corrupted database.
                //Also, we need to make sure that the update in progress preference is set to this computer because we JUST set it to that value before entering this method.
                //If it has changed, we absolutely know without a doubt that another computer is trying to update at the same time.
                FormOpenDental.ExitCode = 142;              //Update is already in progress from another computer
                if (!isSilent)
                {
                    MsgBox.Show(this, "An update is already in progress from another computer.");
                }
                return(false);
            }
            //Double check that the database version has not changed.  This check is here just in case another computer has successfully updated the database already.
            Version versionDatabase = new Version(PrefC.GetString(PrefName.DataBaseVersion));
            if (FromVersion != versionDatabase)
            {
                FormOpenDental.ExitCode = 143;              //Database has already been updated from another computer
                if (!isSilent)
                {
                    MsgBox.Show(this, "The database has already been updated from another computer.");
                }
                return(false);
            }
            try {
#endif
            if (FromVersion < new Version("7.5.17"))                     //Insurance Plan schema conversion
            {
                if (isSilent)
                {
                    FormOpenDental.ExitCode = 139;                          //Update must be done manually to fix Insurance Plan Schema
                    Application.Exit();
                    return(false);
                }
                Cursor.Current = Cursors.Default;
                YN InsPlanConverstion_7_5_17_AutoMergeYN = YN.Unknown;
                if (FromVersion < new Version("7.5.1"))
                {
                    FormInsPlanConvert_7_5_17 form = new FormInsPlanConvert_7_5_17();
                    if (PrefC.GetBoolSilent(PrefName.InsurancePlansShared, true))
                    {
                        form.InsPlanConverstion_7_5_17_AutoMergeYN = YN.Yes;
                    }
                    else
                    {
                        form.InsPlanConverstion_7_5_17_AutoMergeYN = YN.No;
                    }
                    form.ShowDialog();
                    if (form.DialogResult == DialogResult.Cancel)
                    {
                        MessageBox.Show("Your database has not been altered.");
                        return(false);
                    }
                    InsPlanConverstion_7_5_17_AutoMergeYN = form.InsPlanConverstion_7_5_17_AutoMergeYN;
                }
                ConvertDatabases.Set_7_5_17_AutoMerge(InsPlanConverstion_7_5_17_AutoMergeYN);                        //does nothing if this pref is already present for some reason.
                Cursor.Current = Cursors.WaitCursor;
            }
            if (!isSilent && FromVersion > new Version("16.3.0") && FromVersion < new Version("16.3.29") && ApptReminderRules.IsReminders)
            {
                //16.3.29 is more strict about reminder rule setup. Prompt the user and allow them to exit the update if desired.
                //Get all currently enabled reminder rules.
                List <bool> listReminderFlags = ApptReminderRules.Get_16_3_29_ConversionFlags();
                if (listReminderFlags?[0] ?? false)                        //2 reminders scheduled for same day of appointment. 1 will be converted to future day reminder.
                {
                    MsgBox.Show(this, "You have multiple appointment reminders set to send on the same day of the appointment. One of these will be converted to send 1 day prior to the appointment.  Please review automated reminder rule setup after update has finished.");
                }
                if (listReminderFlags?[1] ?? false)                        //2 reminders scheduled for future day of appointment. 1 will be converted to same day reminder.
                {
                    MsgBox.Show(this, "You have multiple appointment reminders set to send 1 or more days prior to the day of the appointment. One of these will be converted to send 1 hour prior to the appointment.  Please review automated reminder rule setup after update has finished.");
                }
            }
            if (FromVersion >= new Version("17.3.1") && FromVersion < new Version("17.3.23") && DataConnection.DBtype == DatabaseType.MySql &&
                (Tasks.HasAnyLongDescripts() || TaskNotes.HasAnyLongNotes() || Commlogs.HasAnyLongNotes()))
            {
                if (isSilent)
                {
                    FormOpenDental.ExitCode = 138;                          //Update must be done manually in order to get data loss notification(s).
                    Application.Exit();
                    return(false);
                }
                if (!MsgBox.Show(this, true, "Data will be lost during this update."
                                 + "\r\nContact support in order to retrieve the data from a backup after the update."
                                 + "\r\n\r\nContinue?"))
                {
                    MessageBox.Show("Your database has not been altered.");
                    return(false);
                }
            }
            if (FromVersion >= new Version("3.4.0"))
            {
                Prefs.UpdateBool(PrefName.CorruptedDatabase, true);
            }
            ConvertDatabases.FromVersion = FromVersion;
#if !DEBUG
            //Typically the UpdateInProgressOnComputerName preference will have already been set within FormUpdate.
            //However, the user could have cancelled out of FormUpdate after successfully downloading the Setup.exe
            //OR the Setup.exe could have been manually sent to our customer (during troubleshooting with HQ).
            //For those scenarios, the preference will be empty at this point and we need to let other computers know that an update going to start.
            //Updating the string (again) here will guarantee that all computers know an update is in fact in progress from this machine.
            Prefs.UpdateString(PrefName.UpdateInProgressOnComputerName, Environment.MachineName);
#endif
            //Show a progress window that will indecate to the user that there is an active update in progress.  Currently okay to show during isSilent.
            actionCloseConvertProgress = ODProgressOld.ShowProgressStatus("ConvertDatabases", hasMinimize: false, currentForm: currentForm);
            ConvertDatabases.To2_8_2();                //begins going through the chain of conversion steps
            InvokeConvertMethods();                    //continues going through the chain of conversion steps starting at v17.1.1 via reflection.
            actionCloseConvertProgress();
            Cursor.Current = Cursors.Default;
            if (FromVersion >= new Version("3.4.0"))
            {
                //CacheL.Refresh(InvalidType.Prefs);//or it won't know it has to update in the next line.
                Prefs.UpdateBool(PrefName.CorruptedDatabase, false, true);                      //more forceful refresh in order to properly change flag
            }
            Cache.Refresh(InvalidType.Prefs);
            if (!isSilent)
            {
                MsgBox.Show(this, "Database update successful");
            }
            return(true);

#if !DEBUG
        }

        catch (System.IO.FileNotFoundException e) {
            actionCloseConvertProgress?.Invoke();
            FormOpenDental.ExitCode = 160;                  //File not found exception
            if (!isSilent)
            {
                MessageBox.Show(e.FileName + " " + Lan.g(this, "could not be found. Your database has not been altered and is still usable if you uninstall this version, then reinstall the previous version."));
            }
            if (FromVersion >= new Version("3.4.0"))
            {
                Prefs.UpdateBool(PrefName.CorruptedDatabase, false);
            }
            return(false);
        }
        catch (System.IO.DirectoryNotFoundException) {
            actionCloseConvertProgress?.Invoke();
            FormOpenDental.ExitCode = 160;                  //ConversionFiles folder could not be found
            if (!isSilent)
            {
                MessageBox.Show(Lan.g(this, "ConversionFiles folder could not be found. Your database has not been altered and is still usable if you uninstall this version, then reinstall the previous version."));
            }
            if (FromVersion >= new Version("3.4.0"))
            {
                Prefs.UpdateBool(PrefName.CorruptedDatabase, false);
            }
            return(false);
        }
        catch (Exception ex) {
            actionCloseConvertProgress?.Invoke();
            FormOpenDental.ExitCode = 201;                  //Database was corrupted due to an update failure
            if (!isSilent)
            {
                MessageBox.Show(ex.Message + "\r\n\r\n"
                                + Lan.g(this, "Conversion unsuccessful. Your database is now corrupted and you cannot use it.  Please contact us."));
            }
            //Then, application will exit, and database will remain tagged as corrupted.
            return(false);
        }
#endif
        }
コード例 #29
0
		//private Color colorBackG;
		
		///<summary>Creates a new ODGridCell.</summary>
		public ODGridCell(){
			text="";
			colorText=Color.Empty;
			bold=YN.Unknown;
			//colorBackG=Color.Empty;
		}
コード例 #30
0
ファイル: FormChooseDatabase.cs プロジェクト: nampn/ODental
 ///<summary>Gets the settings from the config file, and fills the form with those values.  Gets run twice at startup.  If certain command-line parameters were passed in when starting the program, then the config file will not be processed at all.</summary>
 public void GetConfig()
 {
     if(WebServiceUri!=""//if a URI was passed in
         || DatabaseName!="")//or if a direct db was specified
     {
         return;//do not even bother with the config file
     }
     //command-line support for the upper portion of this window will be added later.
     //Improvement should be made here to avoid requiring admin priv.
     //Search path should be something like this:
     //1. /home/username/.opendental/config.xml (or corresponding user path in Windows)
     //2. /etc/opendental/config.xml (or corresponding machine path in Windows) (should be default for new installs)
     //3. Application Directory/FreeDentalConfig.xml (read-only if user is not admin)
     string xmlPath=ODFileUtils.CombinePaths(Application.StartupPath,"FreeDentalConfig.xml");
     if(!File.Exists(xmlPath)){
         FileStream fs;
         try {
             fs=File.Create(xmlPath);
         }
         catch {
             MessageBox.Show("The very first time that the program is run, it must be run as an Admin.  If using Vista, right click, run as Admin.");
             Application.Exit();
             return;
         }
         fs.Close();
         comboComputerName.Text="localhost";
         #if(TRIALONLY)
             comboDatabase.Text="demo";
         #else
             comboDatabase.Text="opendental";
         #endif
         textUser.Text="root";
         if(listType.Items.Count>0) {//not true on startup
             listType.SelectedIndex=0;
         }
         //return;
     }
     XmlDocument document=new XmlDocument();
     try{
         document.Load(xmlPath);
         XPathNavigator Navigator=document.CreateNavigator();
         XPathNavigator nav;
         //Database type
         nav=Navigator.SelectSingleNode("//DatabaseType");
         if(listType.Items.Count>0) {//not true on startup
             listType.SelectedIndex=0;
         }
         DataConnection.DBtype=DatabaseType.MySql;
         if(nav!=null && nav.Value=="Oracle" && listType.Items.Count>1){
             listType.SelectedIndex=1;
             DataConnection.DBtype=DatabaseType.Oracle;
         }
         //See if there's a ConnectionString
         nav=Navigator.SelectSingleNode("//ConnectionString");
         if(nav!=null) {
             //If there is a ConnectionString, then use it.
             textConnectionString.Text=nav.Value;
             return;
         }
         //See if there's a DatabaseConnection
         nav=Navigator.SelectSingleNode("//DatabaseConnection");
         if(nav!=null) {
             //If there is a DatabaseConnection, then use it.
             groupServer.Enabled=false;
             comboComputerName.Text=nav.SelectSingleNode("ComputerName").Value;
             if(!IsAccessedFromMainMenu) {
                 comboDatabase.Text=nav.SelectSingleNode("Database").Value;
             }
             textUser.Text=nav.SelectSingleNode("User").Value;
             textPassword.Text=nav.SelectSingleNode("Password").Value;
             XPathNavigator noshownav=nav.SelectSingleNode("NoShowOnStartup");
             if(noshownav!=null){
                 string noshow=noshownav.Value;
                 if(noshow=="True"){
                     NoShow=YN.Yes;
                     checkNoShow.Checked=true;
                 }
             }
             return;
         }
         nav=Navigator.SelectSingleNode("//ServerConnection");
         /* example:
         <ServerConnection>
             <URI>http://server/OpenDentalServer/ServiceMain.asmx</URI>
             <UsingEcw>True</UsingEcw>
         </ServerConnection>
         */
         if(nav!=null) {
             //If there is a ServerConnection, then use it.
             checkConnectServer.Checked=true;
             groupDirect.Enabled=false;
             textURI.Text=nav.SelectSingleNode("URI").Value;
             XPathNavigator ecwnav=nav.SelectSingleNode("UsingEcw");
             if(ecwnav!=null){
                 string usingecw=ecwnav.Value;
                 if(usingecw=="True"){
                     NoShow=YN.Yes;
                     checkUsingEcw.Checked=true;
                 }
             }
             textUser2.Select();
             return;
         }
     }
     catch(Exception) {
         //Common error: root element is missing
         //MessageBox.Show(e.Message);
     }
     comboComputerName.Text="localhost";
     comboDatabase.Text="opendental";
     textUser.Text="root";
     checkConnectServer.Checked=false;
     groupDirect.Enabled=true;
     groupServer.Enabled=false;
     if(listType.Items.Count>1){
         listType.SelectedIndex=0;
     }
     DataConnection.DBtype=DatabaseType.MySql;
 }
コード例 #31
0
ファイル: ClassConvertDatabase.cs プロジェクト: nampn/ODental
        ///<summary>Return false to indicate exit app.  Only called when program first starts up at the beginning of FormOpenDental.PrefsStartup.</summary>
        public bool Convert(string fromVersion, string toVersion, bool silent)
        {
            FromVersion = new Version(fromVersion);
            ToVersion   = new Version(toVersion);        //Application.ProductVersion);
            if (FromVersion == ToVersion)
            {
                return(true);               //no conversion necessary
            }
            if (FromVersion >= new Version("3.4.0") && PrefC.GetBool(PrefName.CorruptedDatabase))
            {
                MsgBox.Show(this, "Your database is corrupted because a conversion failed.  Please contact us.  This database is unusable and you will need to restore from a backup.");
                return(false);                        //shuts program down.
            }
            if (FromVersion.CompareTo(ToVersion) > 0) //"Cannot convert database to an older version."
            //no longer necessary to catch it here.  It will be handled soon enough in CheckProgramVersion
            {
                return(true);
            }
            if (FromVersion < new Version("2.8.0"))
            {
                MsgBox.Show(this, "This database is too old to easily convert in one step. Please upgrade to 2.1 if necessary, then to 2.8.  Then you will be able to upgrade to this version. We apologize for the inconvenience.");
                return(false);
            }
            if (FromVersion < new Version("6.6.2"))
            {
                MsgBox.Show(this, "This database is too old to easily convert in one step. Please upgrade to 11.1 first.  Then you will be able to upgrade to this version. We apologize for the inconvenience.");
                return(false);
            }
            if (FromVersion < new Version("3.0.1"))
            {
                MsgBox.Show(this, "This is an old database.  The conversion must be done using MySQL 4.1 (not MySQL 5.0) or it will fail.");
            }
            if (FromVersion.ToString() == "2.9.0.0" || FromVersion.ToString() == "3.0.0.0" || FromVersion.ToString() == "4.7.0.0")
            {
                MsgBox.Show(this, "Cannot convert this database version which was only for development purposes.");
                return(false);
            }
            if (FromVersion > new Version("4.7.0") && FromVersion.Build == 0)
            {
                MsgBox.Show(this, "Cannot convert this database version which was only for development purposes.");
                return(false);
            }
            if (FromVersion >= ConvertDatabases.LatestVersion)
            {
                return(true);               //no conversion necessary
            }
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                MsgBox.Show(this, "Web client cannot convert database.  Must be using a direct connection.");
                return(false);
            }
            if (ReplicationServers.ServerIsBlocked())
            {
                MsgBox.Show(this, "This replication server is blocked from performing updates.");
                return(false);
            }
            if (PrefC.GetString(PrefName.WebServiceServerName) != "" &&       //using web service
                !ODEnvironment.IdIsThisComputer(PrefC.GetString(PrefName.WebServiceServerName).ToLower()))                   //and not on web server
            {
                MessageBox.Show(Lan.g(this, "Updates are only allowed from the web server: ") + PrefC.GetString(PrefName.WebServiceServerName));
                return(false);
            }
            //If MyISAM and InnoDb mix, then try to fix
            if (DataConnection.DBtype == DatabaseType.MySql)                    //not for Oracle
            {
                string namesInnodb = DatabaseMaintenance.GetInnodbTableNames(); //Or possibly some other format.
                int    numMyisam   = DatabaseMaintenance.GetMyisamTableCount();
                if (namesInnodb != "" && numMyisam > 0)
                {
                    MessageBox.Show(Lan.g(this, "A mixture of database tables in InnoDB and MyISAM format were found.  A database backup will now be made, and then the following InnoDB tables will be converted to MyISAM format: ") + namesInnodb);
                    try {
                        MiscData.MakeABackup();                        //Does not work for Oracle, due to some MySQL specific commands inside.
                    }
                    catch (Exception e) {
                        Cursor.Current = Cursors.Default;
                        if (e.Message != "")
                        {
                            MessageBox.Show(e.Message);
                        }
                        MsgBox.Show(this, "Backup failed. Your database has not been altered.");
                        return(false);
                    }
                    if (!DatabaseMaintenance.ConvertTablesToMyisam())
                    {
                        MessageBox.Show(Lan.g(this, "Failed to convert InnoDB tables to MyISAM format. Please contact support."));
                        return(false);
                    }
                    MessageBox.Show(Lan.g(this, "All tables converted to MyISAM format successfully."));
                    namesInnodb = "";
                }
                if (namesInnodb == "" && numMyisam > 0)             //if all tables are myisam
                //but default storage engine is innodb, then kick them out.
                {
                    if (DatabaseMaintenance.GetStorageEngineDefaultName().ToUpper() != "MYISAM")                    //Probably InnoDB but could be another format.
                    {
                        MessageBox.Show(Lan.g(this, "The database tables are in MyISAM format, but the default database engine format is InnoDB. You must change the default storage engine within the my.ini (or my.cnf) file on the database server and restart MySQL in order to fix this problem. Exiting."));
                        return(false);
                    }
                }
            }
#if DEBUG
            if (!silent && MessageBox.Show("You are in Debug mode.  Your database can now be converted" + "\r"
                                           + "from version" + " " + FromVersion.ToString() + "\r"
                                           + "to version" + " " + ToVersion.ToString() + "\r"
                                           + "You can click Cancel to skip conversion and attempt to the newer code against the older database."
                                           , "", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return(true);               //If user clicks cancel, then do nothing
            }
#else
            if (!silent && MessageBox.Show(Lan.g(this, "Your database will now be converted") + "\r"
                                           + Lan.g(this, "from version") + " " + FromVersion.ToString() + "\r"
                                           + Lan.g(this, "to version") + " " + ToVersion.ToString() + "\r"
                                           + Lan.g(this, "The conversion works best if you are on the server.  Depending on the speed of your computer, it can be as fast as a few seconds, or it can take as long as 10 minutes.")
                                           , "", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return(false);               //If user clicks cancel, then close the program
            }
#endif
            Cursor.Current = Cursors.WaitCursor;
#if !DEBUG
            if (DataConnection.DBtype != DatabaseType.MySql &&
                !MsgBox.Show(this, true, "If you have not made a backup, please Cancel and backup before continuing.  Continue?"))
            {
                return(false);
            }
            try{
                if (DataConnection.DBtype == DatabaseType.MySql)
                {
                    MiscData.MakeABackup();                    //Does not work for Oracle, due to some MySQL specific commands inside.
                }
            }
            catch (Exception e) {
                Cursor.Current = Cursors.Default;
                if (e.Message != "")
                {
                    MessageBox.Show(e.Message);
                }
                MsgBox.Show(this, "Backup failed. Your database has not been altered.");
                return(false);
            }
            try{
#endif
            if (FromVersion < new Version("7.5.17"))
            {
                Cursor.Current = Cursors.Default;
                YN InsPlanConverstion_7_5_17_AutoMergeYN = YN.Unknown;
                if (FromVersion < new Version("7.5.1"))
                {
                    FormInsPlanConvert_7_5_17 form = new FormInsPlanConvert_7_5_17();
                    if (PrefC.GetBoolSilent(PrefName.InsurancePlansShared, true))
                    {
                        form.InsPlanConverstion_7_5_17_AutoMergeYN = YN.Yes;
                    }
                    else
                    {
                        form.InsPlanConverstion_7_5_17_AutoMergeYN = YN.No;
                    }
                    form.ShowDialog();
                    if (form.DialogResult == DialogResult.Cancel)
                    {
                        MessageBox.Show("Your database has not been altered.");
                        return(false);
                    }
                    InsPlanConverstion_7_5_17_AutoMergeYN = form.InsPlanConverstion_7_5_17_AutoMergeYN;
                }
                ConvertDatabases.Set_7_5_17_AutoMerge(InsPlanConverstion_7_5_17_AutoMergeYN);                //does nothing if this pref is already present for some reason.
                Cursor.Current = Cursors.WaitCursor;
            }
            if (FromVersion >= new Version("3.4.0"))
            {
                Prefs.UpdateBool(PrefName.CorruptedDatabase, true);
            }
            ConvertDatabases.FromVersion = FromVersion;
            ConvertDatabases.To2_8_2();            //begins going through the chain of conversion steps
            Cursor.Current = Cursors.Default;
            if (!silent)
            {
                MsgBox.Show(this, "Conversion successful");
            }
            if (FromVersion >= new Version("3.4.0"))
            {
                //CacheL.Refresh(InvalidType.Prefs);//or it won't know it has to update in the next line.
                Prefs.UpdateBool(PrefName.CorruptedDatabase, false, true);              //more forceful refresh in order to properly change flag
            }
            Cache.Refresh(InvalidType.Prefs);
            return(true);

#if !DEBUG
        }

        catch (System.IO.FileNotFoundException e) {
            MessageBox.Show(e.FileName + " " + Lan.g(this, "could not be found. Your database has not been altered and is still usable if you uninstall this version, then reinstall the previous version."));
            if (FromVersion >= new Version("3.4.0"))
            {
                Prefs.UpdateBool(PrefName.CorruptedDatabase, false);
            }
            //Prefs.Refresh();
            return(false);
        }
        catch (System.IO.DirectoryNotFoundException) {
            MessageBox.Show(Lan.g(this, "ConversionFiles folder could not be found. Your database has not been altered and is still usable if you uninstall this version, then reinstall the previous version."));
            if (FromVersion >= new Version("3.4.0"))
            {
                Prefs.UpdateBool(PrefName.CorruptedDatabase, false);
            }
            //Prefs.Refresh();
            return(false);
        }
        catch (Exception ex) {
            //	MessageBox.Show();
            MessageBox.Show(ex.Message + "\r\n\r\n"
                            + Lan.g(this, "Conversion unsuccessful. Your database is now corrupted and you cannot use it.  Please contact us."));
            //Then, application will exit, and database will remain tagged as corrupted.
            return(false);
        }
#endif
        }
コード例 #32
0
        private void PB_AddToSchedule_Click(object sender, RoutedEventArgs e)
        {
            bool filled = true;

            // Check to see if required fields are filled in:

            // Title
            if (TB_NewTitle.Text.Length == 0)
            {
                filled = false;
                TB_AsteriskTitle.Text = "*";
            }
            else
            {
                TB_AsteriskTitle.Text = "";
            }

            // Date
            if (!CDP_NewItemDate.Date.HasValue)
            {
                filled = false;
                TB_AsteriskDate.Text = "*";
            }
            else
            {
                TB_AsteriskDate.Text = "";
            }

            // Task type
            if (CB_TypePicker.SelectedItem == null)
            {
                filled = false;
                TB_AsteriskType.Text = "*";
            }
            else
            {
                TB_AsteriskType.Text = "";
            }

            // Duration is not required for a FullDay event
            if ((TaskType)CB_TypePicker.SelectedItem != TaskType.FullDay && CB_DurHoursPicker == null)
            {
                filled = false;
                TB_AsteriskDuration.Text = "*";
            }
            else
            {
                TB_AsteriskDuration.Text = "";
            }

            // Duration is not required for a FullDay event
            if ((TaskType)CB_TypePicker.SelectedItem != TaskType.FullDay && CB_DurMinsPicker == null)
            {
                filled = false;
                TB_AsteriskDuration.Text = "*";
            }
            else
            {
                TB_AsteriskDuration.Text = "";
            }

            // Time
            if ((TaskType)CB_TypePicker.SelectedItem != TaskType.FullDay && !TP_NewItemTime.SelectedTime.HasValue)
            {
                filled = false;
                TB_AsteriskTime.Text = "*";
            }
            else
            {
                TB_AsteriskTime.Text = "";
            }

            // Required?
            if (CB_RequiredPicker.SelectedValue == null)
            {
                filled = false;
                TB_AsteriskRequired.Text = "*";
            }
            else
            {
                TB_AsteriskRequired.Text = "";
            }

            // Repeat
            if (CB_RepeatPicker.SelectedValue == null)
            {
                filled = false;
                TB_AsteriskRepeat.Text = "*";
            }
            else
            {
                TB_AsteriskRepeat.Text = "";
            }


            if (!filled)
            {
                TB_RequiredFields.Text = "The marked(*) fields are required.";
                return;
            }
            // Remove failed text markers from UI
            TB_RequiredFields.Text = "";

            // Create SmartTask object out of the text fields

            // Get full DateTime from composite boxes
            DateTimeOffset date   = CDP_NewItemDate.Date.Value;
            int            hour   = TP_NewItemTime.SelectedTime.Value.Hours;
            int            minute = TP_NewItemTime.SelectedTime.Value.Minutes;
            DateTime       when   = new DateTime(date.Year, date.Month, date.Day, hour, minute, 0);

            // Get duration
            int        durHour    = (int)CB_DurHoursPicker.SelectedItem;
            int        durMinute  = (int)CB_DurMinsPicker.SelectedItem;
            TaskType   taskType   = (TaskType)CB_TypePicker.SelectedValue;
            RepeatType repeatType = (RepeatType)CB_RepeatPicker.SelectedValue;
            YN         required   = (YN)CB_RequiredPicker.SelectedValue;

            // Create a new task from the schedule
            SmartTask newTask = schedule.CreateTask(nextEventID++, date, hour, minute, durHour, durMinute, taskType, repeatType, TB_NewTitle.Text, TB_NewDescription.Text, required, TB_NewURL.Text);

            // Add to global schedule variable
            schedule.AddTask(newTask);

            if (selectedDate.Date == when.Date)
            {
                //Update the ListView viewer when adding a new task to the current date
                RefreshScheduleView();
            }
        }
コード例 #33
0
 ///<summary></summary>
 public static string GetMessage(Dunning[] dunList, int billingType, int ageAccount, YN insIsPending)
 {
     //loop backwards through Dunning list and find the first dunning that matches criteria.
     for (int i = dunList.Length - 1; i >= 0; i--)
     {
         if (dunList[i].BillingType != 0 &&          //0 in the list matches all
             dunList[i].BillingType != billingType)
         {
             continue;
         }
         if (ageAccount < dunList[i].AgeAccount)                //match if age is >= item in list
         {
             continue;
         }
         if (dunList[i].InsIsPending != YN.Unknown &&          //unknown in the list matches all
             dunList[i].InsIsPending != insIsPending)
         {
             continue;
         }
         return(dunList[i].DunMessage);
     }
     return("");
 }
コード例 #34
0
		///<summary>Creates a new ODGridCell.</summary>
		public ODGridCell(string myText){
			text=myText;
			colorText=Color.Empty;
			bold=YN.Unknown;
		}
コード例 #35
0
ファイル: FormScreenEdit.cs プロジェクト: mnisl/OD
		private void SetCheckState(CheckBox checkBox,YN state){
			switch(state){
				case YN.Unknown:
					checkBox.CheckState=CheckState.Indeterminate;
					break;
				case YN.Yes:
					checkBox.CheckState=CheckState.Checked;
					break;
				case YN.No:
					checkBox.CheckState=CheckState.Unchecked;
					break;
			}
		}
コード例 #36
0
ファイル: FormScreenGroup.cs プロジェクト: nampn/ODental
 private string getX(YN ynValue)
 {
     if(ynValue==YN.Yes)
         return "X";
     return "";
 }
コード例 #37
0
        ///<summary>Every optional parameter provided should coincide with a command line argument.
        ///The values passed in will typically override any settings loaded in from the config file.
        ///Passing in a value for webServiceUri or databaseName will cause the config file to not even be considered.</summary>
        public static ChooseDatabaseModel GetChooseDatabaseModelFromConfig(string webServiceUri = "", YN webServiceIsEcw  = YN.Unknown, string odUser = ""
                                                                           , string serverName  = "", string databaseName = "", string mySqlUser      = "", string mySqlPassword = "", string mySqlPassHash = "", YN noShow = YN.Unknown
                                                                           , string odPassword  = "", bool useDynamicMode = false, string odPassHash  = "")
        {
            ChooseDatabaseModel chooseDatabaseModel = new ChooseDatabaseModel();

            //Even if we are passed a URI as a command line argument we still need to check the FreeDentalConfig file for middle tier automatic log in.
            //The only time we do not need to do that is if a direct DB has been passed in.
            if (string.IsNullOrEmpty(databaseName))
            {
                CentralConnections.GetChooseDatabaseConnectionSettings(out chooseDatabaseModel.CentralConnectionCur, out chooseDatabaseModel.ConnectionString
                                                                       , out chooseDatabaseModel.NoShow, out chooseDatabaseModel.DbType, out chooseDatabaseModel.ListAdminCompNames, out chooseDatabaseModel.UseDynamicMode
                                                                       , out chooseDatabaseModel.AllowAutoLogin);
            }
            //Command line args should always trump settings from the config file.
            #region Command Line Arguements
            if (webServiceUri != "")           //if a URI was passed in
            {
                chooseDatabaseModel.CentralConnectionCur.ServiceURI = webServiceUri;
            }
            if (webServiceIsEcw != YN.Unknown)
            {
                chooseDatabaseModel.CentralConnectionCur.WebServiceIsEcw = (webServiceIsEcw == YN.Yes ? true : false);
            }
            if (odUser != "")
            {
                chooseDatabaseModel.CentralConnectionCur.OdUser = odUser;
            }
            if (odPassword != "")
            {
                chooseDatabaseModel.CentralConnectionCur.OdPassword = odPassword;
            }
            if (!string.IsNullOrEmpty(odPassHash))
            {
                chooseDatabaseModel.CentralConnectionCur.OdPassHash = odPassHash;
            }
            if (serverName != "")
            {
                chooseDatabaseModel.CentralConnectionCur.ServerName = serverName;
            }
            if (databaseName != "")
            {
                chooseDatabaseModel.CentralConnectionCur.DatabaseName = databaseName;
            }
            if (mySqlUser != "")
            {
                chooseDatabaseModel.CentralConnectionCur.MySqlUser = mySqlUser;
            }
            if (mySqlPassword != "")
            {
                chooseDatabaseModel.CentralConnectionCur.MySqlPassword = mySqlPassword;
            }
            if (mySqlPassHash != "")
            {
                string decryptedPwd;
                CDT.Class1.Decrypt(mySqlPassHash, out decryptedPwd);
                chooseDatabaseModel.CentralConnectionCur.MySqlPassword = decryptedPwd;
            }
            if (noShow != YN.Unknown)
            {
                chooseDatabaseModel.NoShow = noShow;
            }
            if (odUser != "" && odPassword != "")
            {
                chooseDatabaseModel.NoShow = YN.Yes;
            }
            //If they are overridding to say to use dynamic mode.
            if (useDynamicMode)
            {
                chooseDatabaseModel.UseDynamicMode = useDynamicMode;
            }
            #endregion
            return(chooseDatabaseModel);
        }
コード例 #38
0
ファイル: Prefs.cs プロジェクト: ChemBrain/OpenDental
 ///<summary>Updates a pref of type YN.  Returns true if a change was required, or false if no change needed.</summary>
 public static bool UpdateYN(PrefName prefName, YN newValue)
 {
     return(UpdateLong(prefName, (int)newValue));
 }
コード例 #39
0
 ///<summary>Call this when we have a new Pref cache in order to re-establish logging preference from this computer.</summary>
 public static void InvalidateVerboseLogging()
 {
     _isVerboseLoggingSession = YN.Unknown;
 }