Exemple #1
0
        protected T CallFunction <T>(int functionID, string inputValue) where T : new()
        {
            try
            {
                DataSet ds = CallFunction(functionID, inputValue);
                //List<T> list = new List<T>();
                if (ds == null)
                {
                    return(default(T));
                }
                if (ds.Tables.Count == 0)
                {
                    return(default(T));
                }

                return(CDb.Map <T>(ds.Tables[0]));
            }
            catch (Exception ex)
            {
                CLogManager.WritePL("CallFunction", ex.Message + " " + ex.StackTrace);
                if (typeof(T) == typeof(CApplicationMessage))
                {
                    return(CDb.Map <T>("<Message Code=\"SYSTEM_ERROR\" Name = \"Unknow Error\" Result=\"0\" Description = \"" + ex.Message + "\" />"));
                    //return (T)new CApplicationMessage() { Code = "SYSTEM_ERROR", Name = "Unknow Error", Description = ex.Message };
                }
            }
            return(default(T));
        }
Exemple #2
0
        protected IList <T> CallFunctionWithList <T>(int functionID, string inputValue, ref COutputValue output) where T : new()
        {
            try
            {
                DataSet ds = CallFunction(functionID, inputValue);
                //List<T> list = new List<T>();
                if (ds == null)
                {
                    return(null);
                }
                if (ds.Tables.Count == 0)
                {
                    return(null);
                }

                IList <T> list = CDb.MapList <T>(ds.Tables[0]);
                if (ds.Tables.Count > 1)
                {
                    output = CDb.Map <COutputValue>(ds.Tables[1]);
                }

                return(list);
            }
            catch (Exception ex)
            {
                output = new COutputValue()
                {
                    Code = "SYSTEM_ERROR", Name = "Error", Description = ex.Message
                };
            }
            return(null);
        }
Exemple #3
0
        protected T CallFunction <T>(int functionID, string inputValue) where T : new()
        {
            try
            {
                DataSet ds = CallFunction(functionID, inputValue);
                if (ds == null)
                {
                    return(default(T));
                }
                if (ds.Tables.Count == 0)
                {
                    return(default(T));
                }

                return(CDb.Map <T>(ds.Tables[0]));
            }
            catch (Exception ex)
            {
                if (typeof(T) == typeof(CApplicationMessage))
                {
                    return(CDb.Map <T>("<Message Code=\"SYSTEM_ERROR\" Name = \"Unknow Error\" Result=\"0\" Description = \"" + ex.Message + "\" />"));
                }
            }
            return(default(T));
        }
Exemple #4
0
 protected IList <T> CallFunctionWithList <T>(int functionID, string inputValue) where T : new()
 {
     try
     {
         DataSet ds = CallFunction(functionID, inputValue);
         //List<T> list = new List<T>();
         if (ds == null)
         {
             return(null);
         }
         if (ds.Tables.Count == 0)
         {
             return(null);
         }
         return(CDb.MapList <T>(ds.Tables[0]));
     }
     catch (Exception ex)
     {
     }
     return(null);
 }
Exemple #5
0
 protected IList <T> CallFunctionWithList <T>(int functionID, string inputValue) where T : new()
 {
     try
     {
         DataSet ds = CallFunction(functionID, inputValue);
         if (ds == null)
         {
             return(null);
         }
         if (ds.Tables.Count == 0)
         {
             return(null);
         }
         return(CDb.MapList <T>(ds.Tables[0]));
     }
     catch (Exception ex)
     {
         string stack = GetStackTrace(new StackTrace());
         CLogManager.WriteDAL("CallFunctionWithList:IList(1,2)", stack + "::::" + ex.Message);
     }
     return(null);
 }