protected override void AfterAdd(DataRow row) { officeDB.OfficerPrefsRow dr = (officeDB.OfficerPrefsRow)row; string ObjectName = this.myOfficerPrefsDT.TableName; dr.PrefId = this.myA.AtMng.PKIDGet(ObjectName, 10); }
public void SetPref(string prefName, string prefValue) { officeDB.OfficerPrefsRow[] opr = (officeDB.OfficerPrefsRow[])myA.DB.OfficerPrefs.Select("officerid=" + myA.AtMng.OfficerLoggedOn.OfficerId + " and prefname='" + prefName + "'", ""); if (opr.Length == 0) { //add new pref officeDB.OfficerPrefsRow newOpr = (officeDB.OfficerPrefsRow)myA.GetOfficerPrefs().Add(myA.AtMng.OfficerLoggedOn); newOpr.OfficerId = myA.AtMng.OfficerLoggedOn.OfficerId; newOpr.PrefName = prefName; newOpr.PrefValue = prefValue; } else { if (prefValue != opr[0].PrefValue) { opr[0].PrefValue = prefValue; } } }
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; } }