public ResultOperation IsValid(FileUploadHtml fileUploadHtml, sysBpmsVariable variable, Guid?entityId, Guid?entitydefid, string currentUserName) { ResultOperation resultOperation = new ResultOperation(); if (variable != null && !entityId.HasValue) { sysBpmsEntityDef entityDef = new EntityDefService(base.UnitOfWork).GetInfo(variable.EntityDefID.Value); entitydefid = variable.EntityDefID.Value; entityId = new EntityDefEngine(base.EngineSharedModel, base.UnitOfWork).GetEntityID(entityDef, variable, base.EngineSharedModel.BaseQueryModel); } Dictionary <Guid, HttpPostedFileBase> files = fileUploadHtml.Value == null ? new Dictionary <Guid, HttpPostedFileBase>() : (((Dictionary <Guid, object>)fileUploadHtml.Value).ToDictionary(c => c.Key.ToGuidObj(), c => c.Value == null ? null : c.Value is HttpPostedFileBase ? (HttpPostedFileBase)c.Value : new HttpPostedFileWrapper((HttpPostedFile)c.Value))); if (files.Any()) { foreach (var item in files) { ResultOperation result = this.IsValid(entitydefid, entityId, item.Value?.InputStream, item.Value?.FileName, item.Key); if (!result.IsSuccess) { resultOperation.AddError(result.GetErrors()); } } } else { resultOperation = this.IsValid(entitydefid, entityId, null, null, fileUploadHtml.DocumentdefId.ToGuidObjNull().Value); } return(resultOperation); }
public List <sysBpmsDocument> GetList(Guid?documentDefId, Guid?VariableId, Guid?documentFolderId) { if (VariableId.HasValue) { sysBpmsVariable variable = new VariableService(base.UnitOfWork).GetInfo(VariableId.Value); sysBpmsEntityDef entityDef = new EntityDefService(base.UnitOfWork).GetInfo(variable.EntityDefID.Value); Guid? entityId = new EntityDefEngine(base.EngineSharedModel, base.UnitOfWork).GetEntityID(entityDef, variable, base.EngineSharedModel.BaseQueryModel); if (entityId.HasValue) { return(new DocumentService(base.UnitOfWork).GetList(documentDefId, variable.EntityDefID, entityId, "", false, documentFolderId, null)); } else { return(new List <sysBpmsDocument>()); } } else { if (documentDefId.HasValue || documentFolderId.HasValue) { return(new DocumentService(base.UnitOfWork).GetList(documentDefId, null, null, "", false, documentFolderId, base.EngineSharedModel.CurrentThreadID)); } else { return(new List <sysBpmsDocument>()); } } }
public override ResultOperation SaveValues(DataModel dataModel, Dictionary <string, DataModel> allSavedEntities = null) { //this kind of Variable are bind to one property and therefore DataModel item is equivalent to variable name. var result = new EntityDefEngine(base.EngineSharedModel, base.UnitOfWork).SaveIntoDataBase(this.EntityDef, this.Variable, dataModel, base.AdditionalParams, allSavedEntities); result.Item1.CurrentObject = result.Item2; return(result.Item1); }
/// <param name="containerQuery">It is generally used in combosearch which add a parent query that filter table's rows according to query parameter and text field</param> public List <DataModel> GetResult(PagingProperties currentPaging, string containerQuery = null, string[] includes = null) { List <DataModel> dataModel = new List <DataModel>(); DataTable dataTable = new EntityDefEngine(base.EngineSharedModel, base.UnitOfWork).GetEntity(EntityDef, this.Variable, base.AdditionalParams, currentPaging, containerQuery, includes); foreach (DataRow _row in dataTable.Rows) { dataModel.Add(new DataModel(_row)); } return(dataModel); }
public ResultOperation SaveFile(FileUploadHtml fileUploadHtml, sysBpmsVariable variable, Guid?entityId, Guid?entitydefid, string captionOf, string currentUserName) { ResultOperation resultOperation = new ResultOperation(); if (variable != null && !entityId.HasValue) { sysBpmsEntityDef entityDef = new EntityDefService(base.UnitOfWork).GetInfo(variable.EntityDefID.Value); entitydefid = variable.EntityDefID.Value; entityId = new EntityDefEngine(base.EngineSharedModel, base.UnitOfWork).GetEntityID(entityDef, variable, base.EngineSharedModel.BaseQueryModel); } Dictionary <Guid, HttpPostedFileBase> files = fileUploadHtml.Value == null ? new Dictionary <Guid, HttpPostedFileBase>() : (((Dictionary <Guid, object>)fileUploadHtml.Value).ToDictionary(c => c.Key.ToGuidObj(), c => c.Value == null ? null : c.Value is HttpPostedFileBase ? (HttpPostedFileBase)c.Value : new HttpPostedFileWrapper((HttpPostedFile)c.Value))); foreach (var item in files) { if (resultOperation.IsSuccess) { resultOperation = this.SaveFile(item.Value?.InputStream, item.Value?.FileName, entityId, entitydefid, item.Key, captionOf, !fileUploadHtml.Multiple); } } return(resultOperation); }