public virtual DataTable GetReportData(string fieldName, string condition) { DataTable result = new DataTable(); IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.GetReportData(fieldName, condition); }); return(result); }
public virtual IList <DTO> FindBySQLCommandText(string SQLCommandText) { IList <DTO> result = null; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.FindBySQLCommandText(SQLCommandText); }); return(result); }
/// <summary> /// 返回数据校验结果 /// </summary> /// <param name="dto"></param> /// <returns>若返回结果为有内容的字符串,则其内容为数据校验不通过的原因</returns> public virtual string DataValidate(DTO dto) { string result = ""; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.DataValidate(dto); }); return(result); }
public virtual Dictionary <string, string> GetColumnNameAlias() { Dictionary <string, string> result = new Dictionary <string, string>(); IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.GetColumnNameAlias(); }); return(result); }
public virtual IList <string> GetFieldList(string fieldName) { IList <string> result = new List <string>(); IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.GetFieldList(fieldName); }); return(result); }
//public virtual async Task<bool> IsExistRecordAsyn(ExpressionNode match) //{ // //Task<bool> result = Task.FromResult<bool>(false); // IBaseService<DTO, Entity> service = this.CreateClient(); // ICommunicationObject communicationObject = service as ICommunicationObject; // ExtensionMethod.UsingEx<ICommunicationObject>(communicationObject, delegate (ICommunicationObject client) // { // service.IsExistRecordAsyn(match); // }); // return false; //} public virtual DataTable GetFieldTypeList() { DataTable result = new DataTable(); IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.GetFieldTypeList(); }); return(result); }
//public virtual async Task<int> GetRecordCountAsync() //{ // //Task<int> result = Task.FromResult<int>(0); // IBaseService<DTO, Entity> service = this.CreateClient(); // ICommunicationObject communicationObject = service as ICommunicationObject; // ExtensionMethod.UsingEx<ICommunicationObject>(communicationObject, delegate (ICommunicationObject client) // { // service.GetRecordCountAsync(); // }); // return 0; //} public virtual int GetRecordCount(ExpressionNode match) { int result = 0; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.GetRecordCount(match); }); return(result); }
//public virtual async Task<bool> IsExistRecordAsyn(object id) //{ // //Task<bool> result = Task.FromResult<bool>(false); // IBaseService<DTO, Entity> service = this.CreateClient(); // ICommunicationObject communicationObject = service as ICommunicationObject; // ExtensionMethod.UsingEx<ICommunicationObject>(communicationObject, delegate (ICommunicationObject client) // { // service.IsExistRecordAsyn(id); // }); // return false; //} public virtual bool IsExistRecord(ExpressionNode match) { bool result = false; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.IsExistRecord(match); }); return(result); }
public virtual IList <DTO> Find(ExpressionNode match) { IList <DTO> result = null; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.Find(match); }); return(result); }
//public virtual async Task<DTO> FindByIDAsync(object id) //{ // Task<DTO> result = null; // IBaseService<DTO, Entity> service = this.CreateClient(); // ICommunicationObject communicationObject = service as ICommunicationObject; // ExtensionMethod.UsingEx<ICommunicationObject>(communicationObject, delegate (ICommunicationObject client) // { // result = service.FindByIDAsync(id); // }); // return await result; //} public virtual DTO FindSingle(ExpressionNode match) { DTO result = default(DTO); IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.FindSingle(match); }); return(result); }
//public virtual async Task<bool> DeleteByExpressionAsync(ExpressionNode match) //{ // //Task<bool> result = Task.FromResult<bool>(false); // IBaseService<DTO, Entity> service = this.CreateClient(); // ICommunicationObject communicationObject = service as ICommunicationObject; // ExtensionMethod.UsingEx<ICommunicationObject>(communicationObject, delegate (ICommunicationObject client) // { // service.DeleteByExpressionAsync(match); // }); // return false; //} public virtual bool DeleteByCondition(string condition) { bool result = false; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.DeleteByCondition(condition); }); return(result); }
public bool UpdateEx(DTO t, object key, string[] UpdateFieldNames) { bool result = false; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.UpdateEx(t, key, UpdateFieldNames); }); return(result); }
public OperationFeedBack <bool> DeleteWithFeedBack(DTO dto) { OperationFeedBack <Boolean> result = null; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.DeleteWithFeedBack(dto); }); return(result); }
public virtual DTO InsertEx(DTO dto) { DTO result = null; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; //string dataerror = service.GetDataError(dto); //if ((dataerror != null) && (dataerror != "")) { throw new FaultException<BaseError>(new BaseError(dataerror), new FaultReason(dataerror)); } ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.InsertEx(dto); }); return(result); }
//public virtual async Task<IList<DTO>> FindAsync(ExpressionNode match) //{ // Task<IList<DTO>> result = null; // IBaseService<DTO, Entity> service = this.CreateClient(); // ICommunicationObject communicationObject = service as ICommunicationObject; // ExtensionMethod.UsingEx<ICommunicationObject>(communicationObject, delegate (ICommunicationObject client) // { // result = service.FindAsync(match); // }); // return await result; //} public virtual IList <DTO> FindWithPager(ExpressionNode match, ref PagerInfo info) { IList <DTO> result = null; IBaseService <DTO, Entity> service = this.CreateClient(); ICommunicationObject communicationObject = service as ICommunicationObject; PagerInfo pagerInfo = info; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.FindWithPager(match, ref pagerInfo); }); info.RecordCount = (pagerInfo.RecordCount); return(result); }
/// <summary> /// 插入复数条数据记录 /// </summary> /// <param name="list">新记录集合</param> /// <returns>插入后的数据记录集合</returns> /// <remarks> /// ★使用该方法的时候需要注意,请保证list中的所有对象相互都是数据合法的 /// 例如,假设合法性校验需要保证【名称】属性不重复,则不能在参数list的中出现多个对象具有相同的【名称】。 /// 该方法无法阻止这类数据的存储,请开发者自行在调用本方法前进行数据校验 /// </remarks> public virtual IEnumerable <DTO> InsertRangeEx(IEnumerable <DTO> list) { IEnumerable <DTO> result = null; IBaseService <DTO, Entity> service = this.CreateClient(); //foreach (DTO dto in list) //{ // string dataerror = service.GetDataError(dto); // if ((dataerror != null) && (dataerror != "")) { throw new Exception(dataerror); } //} ICommunicationObject communicationObject = service as ICommunicationObject; ExtensionMethod.UsingEx <ICommunicationObject>(communicationObject, delegate(ICommunicationObject client) { result = service.InsertRangeEx(list); }); return(result); }