public static void CheckFetchExecuteResult(BaseExecuteResult fetchresult) { if (fetchresult != null && fetchresult.Failed) { ThrowExecuteResult(fetchresult.InnerException.ErrorMessage); } }
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; } }
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); } }
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(); } } } }
protected virtual void AddDataCollection(BaseExecuteResult <TCollection> result) { result.ExecuteResult = ActivatorEx.CreateInstance <TCollection>(); }
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); }