Ejemplo n.º 1
0
        public static BaseActionReturnModel CreateException(Exception exc, bool needToLogInDatabase,
                                                            [CallerMemberName] string callingMethodeName = "",
                                                            [CallerLineNumber] int sourceLineNumber      = 0)
        {
            BaseActionReturnModel r = new BaseActionReturnModel();

            // create and log the exception
            r.Succeeded     = false;
            r.Exception     = exc;
            r.ReturnMessage = "Error in " + callingMethodeName + " at line " + sourceLineNumber + " (" + DateTime.Now.ToString() + ")";
            //TODO send to log
            if (needToLogInDatabase)
            {
                // log to database
            }
            return(r);
        }
Ejemplo n.º 2
0
        public static BaseActionReturnModel CreateSuccededResult(string Message, bool NeedToLogInDatabase,
                                                                 object Object, bool hasCommunication,
                                                                 [CallerMemberName] string callingMethodeName = "",
                                                                 [CallerLineNumber] int sourceLineNumber      = 0)
        {
            BaseActionReturnModel r = new BaseActionReturnModel();

            // create and log the exception
            r.Succeeded        = true;
            r.Exception        = null;
            r.ReturnMessage    = Message;
            r.HasCommunication = hasCommunication;
            // Warning Object could be null
            r.ReturnedObject = Object;
            //TODO send to log
            if (NeedToLogInDatabase)
            {
                // log to database
            }
            return(r);
        }