Example #1
0
        public OfficerPrefsBE GetOfficerPrefs()
        {
            if (myOfficerPrefs == null)
            {
                myOfficerPrefs = new OfficerPrefsBE(this);
            }

            return(myOfficerPrefs);
        }
Example #2
0
        public void CopyPreferences(int fromOfficer, int toOfficer, bool clearFirst)
        {
            myA.GetOfficerPrefs().LoadByOfficerId(fromOfficer);
            myA.GetOfficerPrefs().LoadByOfficerId(toOfficer);
            lmDatasets.officeDB.OfficerPrefsRow[] fromPrefs = (lmDatasets.officeDB.OfficerPrefsRow[])myA.DB.OfficerPrefs.Select("OfficerId=" + fromOfficer.ToString());
            lmDatasets.officeDB.OfficerPrefsRow[] toPrefs   = (lmDatasets.officeDB.OfficerPrefsRow[])myA.DB.OfficerPrefs.Select("OfficerId=" + toOfficer.ToString());

            if (clearFirst)
            {
                foreach (officeDB.OfficerPrefsRow opr in toPrefs)
                {
                    opr.Delete();
                }
            }
            OfficerPrefsBE obe = myA.GetOfficerPrefs();

            foreach (officeDB.OfficerPrefsRow opr in fromPrefs)
            {
                officeDB.OfficerPrefsRow newPref = (officeDB.OfficerPrefsRow)obe.Add(null);
                newPref.PrefName  = opr.PrefName;
                newPref.PrefValue = opr.PrefValue;
                newPref.OfficerId = toOfficer;
            }
        }