Example #1
0
        public static LanguageObject LanguageRowToObject(DataRow Language, string alias)
        {
            LanguageObject obj = new LanguageObject();

            try
            {
                if (Language != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(Language, LanguageObject.ConvertColumnToAlias(LanguageObject.LAN_ID, alias), false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.LanID         = RowFunctions.GetValueFromRowToGuid(Language, LanguageObject.ConvertColumnToAlias(LanguageObject.LAN_ID, alias), true, DataRowVersion.Current);
                        obj.Language      = RowFunctions.GetValueFromRowToString(Language, LanguageObject.ConvertColumnToAlias(LanguageObject.LANGUAGE, alias), false, DataRowVersion.Current);
                        obj.LanguageDutch = RowFunctions.GetValueFromRowToString(Language, LanguageObject.ConvertColumnToAlias(LanguageObject.LANGUAGE_DUTCH, alias), false, DataRowVersion.Current);
                    }
                    return(obj);
                }
                obj = null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(obj);
        }
 public void Remove(LanguageObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public int Add(LanguageObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Called by LanguageObject when it changes
 internal void LanguageObjectChanged(LanguageObject Language)
 {
     try
     {
         int index = List.IndexOf(Language);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         LanguageObject Language = new LanguageObject();
         List.Add(Language);
         return(Language);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         LanguageObject Language = (LanguageObject)value;
         Language.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    LanguageObject oldLanguage = (LanguageObject)oldValue;
                    LanguageObject newLanguage = (LanguageObject)newValue;
                    oldLanguage.Parent = null;
                    newLanguage.Parent = this;

                    OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
                }
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }