Ejemplo n.º 1
0
        ///<summary>Called when logging user off or closing opendental.</summary>
        public static void LogOff()
        {
            if (!PrefC.HasClinicsEnabled)
            {
                _clinicNum = 0;
                return;
            }
            switch (PrefC.GetString(PrefName.ClinicTrackLast))
            {
            case "Workstation":
                ComputerPref compPref = ComputerPrefs.LocalComputer;
                compPref.ClinicNum = Clinics.ClinicNum;
                ComputerPrefs.Update(compPref);
                break;

            case "User":
                List <UserOdPref> UserPrefs = UserOdPrefs.GetByUserAndFkeyType(Security.CurUser.UserNum, UserOdFkeyType.ClinicLast);                      //should only be one or none.
                if (UserPrefs.Count == 0)
                {
                    //this situation should never happen.
                    UserOdPref pref =
                        new UserOdPref()
                    {
                        UserNum  = Security.CurUser.UserNum,
                        FkeyType = UserOdFkeyType.ClinicLast,
                        Fkey     = Clinics.ClinicNum
                    };
                    UserOdPrefs.Insert(pref);
                    break;
                }
                UserPrefs.ForEach(x => x.Fkey = Clinics.ClinicNum);
                UserPrefs.ForEach(UserOdPrefs.Update);
                break;

            case "None":
            default:
                break;
            }
            _clinicNum = 0;
        }
Ejemplo n.º 2
0
        ///<summary>Called when logging user off or closing opendental.</summary>
        public static void LogOff()
        {
            if (!PrefC.HasClinicsEnabled)
            {
                _clinicNum = 0;
                return;
            }
            switch (PrefC.GetString(PrefName.ClinicTrackLast))
            {
            case "Workstation":
                ComputerPrefs.LocalComputer.ClinicNum = Clinics.ClinicNum;
                ComputerPrefs.Update(ComputerPrefs.LocalComputer);
                break;

            case "User":                    //handled below
            case "None":
            default:
                break;
            }
            //We want to always upsert a user pref for the user because we will be looking at it for MobileWeb regardless of the preference for
            //ClinicTrackLast.
            List <UserOdPref> UserPrefs = UserOdPrefs.GetByUserAndFkeyType(Security.CurUser.UserNum, UserOdFkeyType.ClinicLast);        //should only be one or none.

            if (UserPrefs.Count == 0)
            {
                UserOdPref pref = new UserOdPref()
                {
                    UserNum  = Security.CurUser.UserNum,
                    FkeyType = UserOdFkeyType.ClinicLast,
                    Fkey     = Clinics.ClinicNum
                };
                UserOdPrefs.Insert(pref);
            }
            UserPrefs.ForEach(x => {
                x.Fkey = Clinics.ClinicNum;
                UserOdPrefs.Update(x);
            });
            _clinicNum = 0;
        }