private void RefreshFields(EmployeeTerritory tmp)
 {
     _EmployeeTerritoryInfoExtension.Refresh(this);
     _MyEmployee  = null;
     _MyTerritory = null;
     OnChange();            // raise an event
 }
        public static void Refresh(EmployeeTerritory tmp)
        {
            EmployeeTerritoryInfo tmpInfo = GetExistingByPrimaryKey(tmp.EmployeeID, tmp.TerritoryID);

            if (tmpInfo == null)
            {
                return;
            }
            tmpInfo.RefreshFields(tmp);
        }
        internal void Update(Territory myTerritory)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }
            SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];

            EmployeeTerritory.Update(cn, _MyEmployee, myTerritory);
            MarkOld();
        }
        internal void DeleteSelf(Territory myTerritory)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }
            // if we're new then don't update the database
            if (this.IsNew)
            {
                return;
            }
            SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];

            EmployeeTerritory.Remove(cn, _EmployeeID, myTerritory.TerritoryID);
            MarkNew();
        }
 public virtual EmployeeTerritory Get()
 {
     return(_Editable = EmployeeTerritory.Get(_EmployeeID, _TerritoryID));
 }