예제 #1
0
 public static void CheckFetchExecuteResult(BaseExecuteResult fetchresult)
 {
     if (fetchresult != null && fetchresult.Failed)
     {
         ThrowExecuteResult(fetchresult.InnerException.ErrorMessage);
     }
 }
예제 #2
0
 public static void BuilderExecuteResult <T>(BaseExecuteResult <T> result, Exception e)
 {
     if (result != null && e != null)
     {
         result.ExecuteResult               = default(T);
         result.InnerException.ErrorCode    = Utils.DefaultErrorCode;
         result.InnerException.ErrorMessage = e.Message;
     }
 }
예제 #3
0
 public static void CheckUpdateExecuteResult(BaseExecuteResult updateResult)
 {
     if (updateResult == null || updateResult.Failed)
     {
         string errorMsg;
         if (updateResult == null)
         {
             errorMsg = SR.NullReturnValue;
         }
         else
         {
             errorMsg = updateResult.InnerException.ErrorMessage;
         }
         string text = string.Format(SR.UpdateExecuteResultError, errorMsg);
         throw new ExecuteResultException(text);
     }
 }
예제 #4
0
 protected void UpdateDataCollectionWithTransaction(BaseExecuteResult <TCollection> result, BaseUpdateParameter <TCollection> updateParam)
 {
     if (updateParam != null && updateParam.InputData.Count > 0)
     {
         DbConnection dbConn = this.Database.CreateConnection();
         dbConn.Open();
         DbTransaction trans = dbConn.BeginTransaction();
         try
         {
             bool returnValue = updateParam.ReturnValue;
             if (returnValue)
             {
                 //result.ExecuteResult = this.CreateDataCollection();
                 AddDataCollection(result);
             }
             TData cloneData;
             foreach (TData data in updateParam.InputData)
             {
                 cloneData = (TData)data.Clone();
                 this.UpdateDataCore(cloneData, trans);
                 if (returnValue)
                 {
                     result.ExecuteResult.Add(cloneData);
                 }
             }
             trans.Commit();
         }
         catch (Exception e)
         {
             trans.Rollback();
             Utils.BuilderExecuteResult(result, e);
         }
         finally
         {
             if (dbConn.State == ConnectionState.Open)
             {
                 dbConn.Close();
             }
         }
     }
 }
예제 #5
0
 protected virtual void AddDataCollection(BaseExecuteResult <TCollection> result)
 {
     result.ExecuteResult = ActivatorEx.CreateInstance <TCollection>();
 }
예제 #6
0
        private BaseExecuteResult ExecuteRemoteResult(string methodName, BaseParameter param, BaseExecuteResult result)
        {
            InvokeContext context = new InvokeContext();

            context.IsStatic   = true;
            context.Arguments  = new object[] { param };
            context.MethodName = methodName;
            context.TypeName   = "Topevery.FMP.ObjectModel.FileManager,Topevery.FMP.ObjectModel";
            Uri uri = this.CombinePath(this.ServerUrl, HandlerStrings.RuntimeServicePath);

            context = this.Invoke(uri, context);
            if (context != null)
            {
                if (context.InnerException != null)
                {
                    result.InnerException = CreateExceptionResult(result.InnerException, context.InnerException.Message);
                }
                else
                {
                    result = context.ReturnValue as BaseExecuteResult;
                }
            }
            return(result);
        }