예제 #1
0
        /// <summary>
        /// Insert vào tblAliasMapping in db
        /// </summary>
        /// <param name="pitems"></param>
        /// <returns></returns>
        public static string InsertAliasMapping(TblAliasMapping pitems)
        {
            int   i        = 0;
            Query _QueryRS = TblAliasMapping.CreateQuery();

            try
            {
                if (
                    !TblAliasMapping.FetchByParameter(TblAliasMapping.Columns.LocalAlias, Comparison.Equals,
                                                      pitems.LocalAlias).Read())
                {
                    pitems.IsNew = true;
                    pitems.Save(i);
                    return(_QueryRS.GetMax(TblAliasMapping.Columns.Id).ToString());
                }
                else
                {
                    return("-1");
                    //throw new Exception(string.Format("Name:{0} Đã tồn tại", pitems.IPAddress));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
 /// <summary>
 /// Update tblAliasMaping
 /// </summary>
 /// <param name="pitems"></param>
 public static void UpdateAliasMapping(TblAliasMapping pitems)
 {
     try
     {
         if (TblAliasMapping.FetchByID(pitems.Id) != null)
         {
             pitems.IsNew = false;
             pitems.Save();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }