public UserByIdentityEntity GetObject(int id) { return(BaseEntity.Create <UserByIdentityEntity>(this.GetDataTable(new KeyValuePair <string, object>(this.PrimaryKey, id)))); }
/// <summary> /// 获取用户的通知列表 /// </summary> /// <param name="userId">用户主键</param> /// <param name="parentId">那个类别</param> /// <param name="topLimit">获取前几个</param> /// <param name="containContents">是否包含内容</param> /// <returns>通知列表</returns> public List <BaseContactEntity> GetTopListByUser(string userId, string parentId, int topLimit, bool containContents = false) { List <BaseContactEntity> result = new List <BaseContactEntity>(); // 获取用户信息 string commandText = string.Empty; BaseUserEntity userEntity = BaseUserManager.GetObjectByCache(userId); if (userEntity != null) { commandText = " (Enabled = 1 AND DeletionStateCode = 0 AND AuditStatus=2 AND IsOpen = 1) OR (Enabled = 1 AND AuditStatus=2 AND DeletionStateCode = 0 AND Id IN ("; if (!string.IsNullOrEmpty(parentId)) { commandText = " (ParentId = '" + parentId + "' AND Enabled = 1 AND DeletionStateCode = 0 AND AuditStatus=2 AND IsOpen = 1) OR (ParentId = '" + parentId + "' AND Enabled = 1 AND DeletionStateCode = 0 AND Id IN ("; } // 获取用户所在的单位的信息 BaseOrganizeEntity organizeEntity = BaseOrganizeManager.GetObjectByCache(userEntity.CompanyId); if (organizeEntity != null) { // 所在省 if (!string.IsNullOrEmpty(organizeEntity.ProvinceId)) { commandText += " SELECT (ContactId FROM BaseContactDetails WHERE Category = '0' AND ReceiverId = '" + organizeEntity.ProvinceId + "') "; } // 所在市 if (!string.IsNullOrEmpty(organizeEntity.CityId)) { commandText += " UNION SELECT (ContactId FROM BaseContactDetails WHERE Category = '1' AND ReceiverId = '" + organizeEntity.CityId + "') "; } // 所在县 if (!string.IsNullOrEmpty(organizeEntity.DistrictId)) { commandText += " UNION SELECT (ContactId FROM BaseContactDetails WHERE Category = '2' AND ReceiverId = '" + organizeEntity.DistrictId + "') "; } } // 发给所在单位的 if (!string.IsNullOrEmpty(userEntity.CompanyId)) { commandText += " UNION SELECT (ContactId FROM BaseContactDetails WHERE Category = '3' AND ReceiverId = '" + userEntity.CompanyId + "') "; } // 发给自己的 if (!string.IsNullOrEmpty(userEntity.Id)) { commandText += " UNION SELECT (ContactId FROM BaseContactDetails WHERE Category = '4' AND ReceiverId = '" + userEntity.Id + "') ) )"; } string order = BaseContactEntity.FieldPriority + "," + BaseContactEntity.FieldCreateOn + " DESC "; using (IDataReader dataReader = this.ExecuteReaderByWhere(commandText, null, topLimit, order)) { while (dataReader.Read()) { // 2015-11-18 吉日嘎拉 消息的内容不能有,否则会出错,缓存的内容也太大 BaseContactEntity contactEntity = BaseEntity.Create <BaseContactEntity>(dataReader, false); // 是否要内容 if (!containContents) { contactEntity.Contents = null; } result.Add(contactEntity); } } } return(result); }
/// <summary> /// 获取实体 /// </summary> /// <param name="parameters">参数</param> public BaseOrganizationScopeEntity GetEntity(List <KeyValuePair <string, object> > parameters) { return(BaseEntity.Create <BaseOrganizationScopeEntity>(GetDataTable(parameters))); }
/// <summary> /// 根据字典编码、主键获取实体 /// </summary> /// <param name="dictionaryCode">字典编码</param> /// <param name="itemKey">字典项主键</param> /// <param name="itemValue">字典项值</param> /// <returns></returns> public BaseDictionaryItemEntity GetEntity(string dictionaryCode, string itemKey, string itemValue = null) { BaseDictionaryItemEntity entity = null; if (!string.IsNullOrEmpty(dictionaryCode) && !string.IsNullOrEmpty(itemKey)) { var entityBaseDictionary = new BaseDictionaryManager(UserInfo).GetEntityByCode(dictionaryCode); if (entityBaseDictionary != null) { var parameters = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>(BaseDictionaryItemEntity.FieldDictionaryId, entityBaseDictionary.Id), new KeyValuePair <string, object>(BaseDictionaryItemEntity.FieldItemKey, itemKey), new KeyValuePair <string, object>(BaseDictionaryItemEntity.FieldDeleted, 0), new KeyValuePair <string, object>(BaseDictionaryItemEntity.FieldEnabled, 1) }; if (!string.IsNullOrEmpty(itemValue)) { parameters.Add(new KeyValuePair <string, object>(BaseDictionaryItemEntity.FieldItemValue, itemValue)); } var cacheKey = CurrentTableName + ".Entity." + dictionaryCode + "." + itemKey; var cacheTime = TimeSpan.FromMilliseconds(86400000); entity = CacheUtil.Cache <BaseDictionaryItemEntity>(cacheKey, () => BaseEntity.Create <BaseDictionaryItemEntity>(GetDataTable(parameters)), true, false, cacheTime); } } return(entity); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public BaseServicesLicenseEntity GetObject(string id) { return(BaseEntity.Create <BaseServicesLicenseEntity>(this.ExecuteReader(new KeyValuePair <string, object>(BaseServicesLicenseEntity.FieldId, id)))); }
public BaseStationEntity GetObject(int id) { return(BaseEntity.Create <BaseStationEntity>(this.ExecuteReader(new KeyValuePair <string, object>(BaseStationEntity.FieldId, id)))); // return BaseEntity.Create<BaseStationEntity>(this.GetDataTable(new KeyValuePair<string, object>(this.PrimaryKey, id))); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public TAB_USEREntity GetObject(string id) { return(BaseEntity.Create <TAB_USEREntity>(this.GetDataTable(new KeyValuePair <string, object>(this.PrimaryKey, id)))); }
/// <summary> /// 获取一个操作权限的主键 /// 若不存在就自动增加一个 /// </summary> /// <param name="permissionCode">操作权限编号</param> /// <param name="permissionItemName">操作权限名称</param> /// <returns>主键</returns> public string GetIdByAdd(string permissionCode, string permissionName = null) { // 判断当前判断的权限是否存在,否则很容易出现前台设置了权限,后台没此项权限 // 需要自动的能把前台判断过的权限,都记录到后台来 List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseModuleEntity.FieldCode, permissionCode)); parameters.Add(new KeyValuePair <string, object>(BaseModuleEntity.FieldEnabled, 1)); parameters.Add(new KeyValuePair <string, object>(BaseModuleEntity.FieldDeletionStateCode, 0)); BaseModuleEntity entity = BaseEntity.Create <BaseModuleEntity>(this.GetDataTable(parameters, BaseModuleEntity.FieldId)); string result = string.Empty; if (entity != null) { result = entity.Id.ToString(); } else { entity = new BaseModuleEntity(); } // 若是在调试阶段、有没在的权限被判断了,那就自动加入这个权限,不用人工加入权限了,工作效率会提高很多, // 哪些权限是否有被调用什么的,还可以进行一些诊断 // #if (DEBUG) if (String.IsNullOrEmpty(result)) { /* * // 这里需要进行一次加锁,方式并发冲突发生 * lock (PermissionLock) * { * entity.Code = permissionCode; * if (string.IsNullOrEmpty(permissionName)) * { * entity.FullName = permissionCode; * } * else * { * entity.FullName = permissionName; * } * entity.ParentId = null; * entity.IsScope = 0; * entity.IsPublic = 0; * // permissionEntity.CategoryCode = "Application"; * entity.IsMenu = 0; * entity.IsVisible = 1; * entity.DeletionStateCode = 0; * entity.Enabled = 1; * entity.AllowDelete = 1; * entity.AllowEdit = 1; * // 这里是防止主键重复? * // permissionEntity.Id = BaseBusinessLogic.NewGuid(); * result = this.AddObject(entity); * } */ } else { // 更新最后一次访问日期,设置为当前服务器日期 SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetDBNow(BaseModuleEntity.FieldLastCall); sqlBuilder.SetWhere(BaseModuleEntity.FieldId, result); sqlBuilder.EndUpdate(); } // #endif return(result); }
//----------------------------------------------------- // 启动工作流 步骤流 //----------------------------------------------------- /// <summary> /// 启动工作流(步骤流转) /// </summary> /// <param name="workFlowManager">审批流程管理器</param> /// <param name="objectId">单据主键</param> /// <param name="objectFullName">单据名称</param> /// <param name="categoryCode">单据分类</param> /// <param name="categoryFullName">单据分类名称</param> /// <param name="workFlowCode">工作流程</param> /// <param name="auditIdea">审批意见</param> /// <param name="dtWorkFlowActivity">需要走的流程</param> /// <returns>主键</returns> public string AutoStatr(IWorkFlowManager workFlowManager, string objectId, string objectFullName, string categoryCode, string categoryFullName = null, string workFlowCode = null, string auditIdea = null, DataTable dtWorkFlowActivity = null) { if (workFlowManager == null && !string.IsNullOrEmpty(categoryCode)) { if (string.IsNullOrEmpty(workFlowCode)) { workFlowCode = categoryCode; } workFlowManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo).GetWorkFlowManagerByCode(workFlowCode); // workFlowManager = new BaseUserBillManager(this.DbHelper, this.UserInfo, categoryCode); } BaseWorkFlowAuditInfo workFlowAuditInfo = new BaseWorkFlowAuditInfo(); workFlowAuditInfo.CategoryCode = categoryCode; workFlowAuditInfo.ObjectId = objectId; workFlowAuditInfo.CallBackTable = workFlowManager.CurrentTableName; workFlowAuditInfo.ProcessCode = workFlowCode; string currentId = string.Empty; // 看审批流程是否被定义 if (dtWorkFlowActivity == null || dtWorkFlowActivity.Rows.Count == 0) { BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo); var dt = workFlowProcessManager.GetDataTable( new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldCode, workFlowCode) , new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldDeletionStateCode, 0), BaseWorkFlowProcessEntity.FieldSortCode); BaseWorkFlowProcessEntity workFlowProcessEntity = null; foreach (DataRow dr in dt.Rows) { workFlowProcessEntity = BaseEntity.Create <BaseWorkFlowProcessEntity>(dr); // 这里是进入条件,结束条件进行筛选 // 进入条件是否满足 if (!string.IsNullOrEmpty(workFlowProcessEntity.EnterConstraint)) { if (!Evaluate(workFlowAuditInfo.CallBackTable, objectId, workFlowProcessEntity.EnterConstraint)) { // 没有满足入口条件 dr.Delete(); } } } dt.AcceptChanges(); if (dt.Rows.Count == 0) { return(currentId); } workFlowProcessEntity = BaseEntity.Create <BaseWorkFlowProcessEntity>(dt); // 这里是获取用户的走的流程 dtWorkFlowActivity = new BaseWorkFlowActivityManager(this.UserInfo).GetActivityDTById(workFlowProcessEntity.Id.ToString()); // dtWorkFlowActivity = new BaseWorkFlowActivityManager(this.UserInfo).GetActivityDTByCode(workFlowCode); if (dtWorkFlowActivity.Rows.Count == 0) { return(currentId); } } lock (WorkFlowCurrentLock) { BaseWorkFlowStepEntity workFlowStepEntity = null; // 这里需要读取一下 if (dtWorkFlowActivity == null) { } workFlowStepEntity = BaseEntity.Create <BaseWorkFlowStepEntity>(dtWorkFlowActivity.Rows[0]); if (!string.IsNullOrEmpty(workFlowStepEntity.AuditUserId)) { // 若是任意人可以审核的,需要进行一次人工选任的工作 if (workFlowStepEntity.AuditUserId.Equals("Anyone")) { return(null); } } // 1. 先把已有的流程设置功能都删除掉 BaseWorkFlowStepManager workFlowStepManager = new BaseWorkFlowStepManager(this.DbHelper, this.UserInfo); workFlowStepManager.Delete(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldCategoryCode, categoryCode) , new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldObjectId, objectId)); // 2. 把当前的流程设置保存好 BaseWorkFlowActivityEntity activityEntity = null; // 是否已经满足了条件了 bool endConstraint = false; foreach (DataRow dr in dtWorkFlowActivity.Rows) { // 是否已经结束流程了 if (endConstraint) { dr.Delete(); } else { activityEntity = BaseEntity.Create <BaseWorkFlowActivityEntity>(dr); // 这里是进入条件,结束条件进行筛选 // 进入条件是否满足 if (!string.IsNullOrEmpty(activityEntity.EnterConstraint)) { if (!Evaluate(workFlowAuditInfo.CallBackTable, objectId, activityEntity.EnterConstraint)) { // 没有满足入口条件 dr.Delete(); } } // 结束条件是否满足 if (!string.IsNullOrEmpty(activityEntity.EndConstraint)) { if (Evaluate(workFlowAuditInfo.CallBackTable, objectId, activityEntity.EndConstraint)) { // 已经满足了结束条件了 dr.Delete(); endConstraint = true; } } } } dtWorkFlowActivity.AcceptChanges(); // 没有任何审核流程步骤了 if (dtWorkFlowActivity.Rows.Count == 0) { return(null); } // 建立审核步骤表,需要走哪些审核步骤的具体步骤表 foreach (DataRow dr in dtWorkFlowActivity.Rows) { workFlowStepEntity = BaseEntity.Create <BaseWorkFlowStepEntity>(dr); // workFlowStepEntity.ActivityId = workFlowActivityEntity.Id; // workFlowStepEntity.ActivityType = workFlowActivityEntity.ActivityType; workFlowStepEntity.CategoryCode = categoryCode; workFlowStepEntity.ObjectId = objectId; workFlowStepEntity.Id = null; workFlowStepManager.Add(workFlowStepEntity); } workFlowStepEntity = BaseEntity.Create <BaseWorkFlowStepEntity>(dtWorkFlowActivity.Rows[0]); // 3. 启动审核流程 currentId = this.GetCurrentId(categoryCode, objectId); BaseWorkFlowCurrentEntity workFlowCurrentEntity = null; if (currentId.Length > 0) { // 获取当前处于什么状态 string auditstatus = this.GetProperty(currentId, BaseWorkFlowCurrentEntity.FieldAuditStatus); // 如果还是开始审批状态的话,允许他再次提交把原来的覆盖掉 if (auditstatus == AuditStatus.StartAudit.ToString() || auditstatus == AuditStatus.AuditReject.ToString()) { this.UpdataAuditStatr(currentId, categoryCode, categoryFullName, objectId, objectFullName, auditIdea, workFlowStepEntity); if (workFlowManager != null) { workFlowManager.AfterAutoStatr(workFlowAuditInfo); } } // 不是的话则返回 else { // 该单据已进入审核状态不能在次提交 this.StatusCode = Status.ErrorChanged.ToString(); // 返回为空可以判断 currentId = null; } } else { if (workFlowManager != null) { workFlowManager.BeforeAutoStatr(workFlowAuditInfo); } currentId = this.StepAuditStatr(categoryCode, categoryFullName, objectId, objectFullName, auditIdea, workFlowStepEntity); workFlowCurrentEntity = this.GetObject(currentId); // 发送提醒信息,若发给指定的某个人了,就不发给部门的提示信息了 if (workFlowManager != null) { if (!string.IsNullOrEmpty(workFlowStepEntity.AuditUserId)) { workFlowStepEntity.AuditDepartmentId = null; workFlowStepEntity.AuditRoleId = null; } workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.StartAudit, new string[] { workFlowCurrentEntity.CreateUserId, workFlowStepEntity.AuditUserId }, workFlowStepEntity.AuditDepartmentId, workFlowStepEntity.AuditRoleId); } // 成功工作流后的处理 if (!string.IsNullOrEmpty(objectId) && workFlowManager != null) { workFlowManager.AfterAutoStatr(workFlowAuditInfo); } // 运行成功 this.StatusCode = Status.OK.ToString(); this.StatusMessage = this.GetStateMessage(this.StatusCode); } } return(currentId); }
/// <summary> /// 获取 /// </summary> /// <param name="systemCode"></param> /// <param name="roleId"></param> /// <param name="containChild"></param> /// <param name="permissionCode">权限编码</param> /// <returns></returns> public PermissionOrganizationScope GetRoleOrganizationScope(string systemCode, string roleId, out bool containChild, string permissionCode = "Resource.AccessPermission") { containChild = false; var permissionScope = PermissionOrganizationScope.OnlyOwnData; BaseOrganizationScopeEntity organizationScopeEntity = null; var permissionId = new BaseModuleManager().GetIdByCodeByCache(systemCode, permissionCode); if (!string.IsNullOrEmpty(permissionId)) { var tableName = BaseOrganizationScopeEntity.CurrentTableName; if (!string.IsNullOrEmpty(systemCode)) { tableName = systemCode + "OrganizationScope"; } var organizationScopeManager = new BaseOrganizationScopeManager(DbHelper, UserInfo, tableName); var tableRole = systemCode + "Role"; var parameters = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>(BaseOrganizationScopeEntity.FieldResourceCategory, tableRole), new KeyValuePair <string, object>(BaseOrganizationScopeEntity.FieldResourceId, roleId), new KeyValuePair <string, object>(BaseOrganizationScopeEntity.FieldPermissionId, permissionId) }; var dt = organizationScopeManager.GetDataTable(parameters); if (dt != null && dt.Rows.Count > 0) { organizationScopeEntity = BaseEntity.Create <BaseOrganizationScopeEntity>(dt); } } if (organizationScopeEntity != null) { if (organizationScopeEntity.ContainChild == 1) { containChild = true; } if (organizationScopeEntity.AllData == 1) { permissionScope = PermissionOrganizationScope.AllData; } if (organizationScopeEntity.ByDetails == 1) { permissionScope = PermissionOrganizationScope.ByDetails; } if (organizationScopeEntity.NotAllowed == 1) { permissionScope = PermissionOrganizationScope.NotAllowed; } if (organizationScopeEntity.OnlyOwnData == 1) { permissionScope = PermissionOrganizationScope.OnlyOwnData; } if (organizationScopeEntity.Province == 1) { permissionScope = PermissionOrganizationScope.Province; } if (organizationScopeEntity.City == 1) { permissionScope = PermissionOrganizationScope.City; } if (organizationScopeEntity.District == 1) { permissionScope = PermissionOrganizationScope.District; } if (organizationScopeEntity.Street == 1) { permissionScope = PermissionOrganizationScope.Street; } if (organizationScopeEntity.UserCompany == 1) { permissionScope = PermissionOrganizationScope.UserCompany; } if (organizationScopeEntity.UserSubCompany == 1) { permissionScope = PermissionOrganizationScope.UserSubCompany; } if (organizationScopeEntity.UserDepartment == 1) { permissionScope = PermissionOrganizationScope.UserDepartment; } if (organizationScopeEntity.UserSubDepartment == 1) { permissionScope = PermissionOrganizationScope.UserSubDepartment; } if (organizationScopeEntity.UserWorkgroup == 1) { permissionScope = PermissionOrganizationScope.UserWorkgroup; } } return(permissionScope); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public BaseUserExpressEntity GetObject(string id) { return(BaseEntity.Create <BaseUserExpressEntity>(this.ExecuteReader(new KeyValuePair <string, object>(this.PrimaryKey, id)))); // return BaseEntity.Create<BaseUserExpressEntity>(this.GetDataTable(new KeyValuePair<string, object>(this.PrimaryKey, id))); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public HRCheckInEntity GetObject(string id) { return(BaseEntity.Create <HRCheckInEntity>(this.ExecuteReader(new KeyValuePair <string, object>(HRCheckInEntity.FieldId, id)))); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public BaseUserRoleEntity GetObject(int id) { return(BaseEntity.Create <BaseUserRoleEntity>(this.ExecuteReader(new KeyValuePair <string, object>(BaseUserRoleEntity.FieldId, id)))); }
/// <summary> /// 添加编码 /// </summary> /// <param name="userInfo">用户</param> /// <param name="result">数据表</param> /// <param name="statusCode">返回状态码</param> /// <param name="statusMessage">返回状态信息</param> /// <returns>数据表</returns> public string Add(BaseUserInfo userInfo, DataTable dt, out string statusCode, out string statusMessage) { BaseSequenceEntity sequenceEntity = BaseEntity.Create <BaseSequenceEntity>(dt); return(this.Add(userInfo, sequenceEntity, out statusCode, out statusMessage)); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public BaseOrganizeLogOnEntity GetObject(string id) { return(BaseEntity.Create <BaseOrganizeLogOnEntity>(this.ExecuteReader(new KeyValuePair <string, object>(BaseOrganizeLogOnEntity.FieldId, id)))); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public BaseContactDetailsEntity GetObject(string id) { return(BaseEntity.Create <BaseContactDetailsEntity>(this.GetDataTableById(id))); }
public BaseWorkFlowHistoryEntity GetObject(int id) { return(BaseEntity.Create <BaseWorkFlowHistoryEntity>(this.ExecuteReader(new KeyValuePair <string, object>(BaseWorkFlowHistoryEntity.FieldId, id)))); // return BaseEntity.Create<BaseWorkFlowHistoryEntity>(this.GetDataTable(new KeyValuePair<string, object>(BaseWorkFlowHistoryEntity.FieldId, id))); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public TAB_USERPOPEDOMEntity GetObject(string id) { return(BaseEntity.Create <TAB_USERPOPEDOMEntity>(this.ExecuteReader(new KeyValuePair <string, object>(this.PrimaryKey, id)))); // return BaseEntity.Create<TAB_USERPOPEDOMEntity>(this.GetDataTable(new KeyValuePair<string, object>(this.PrimaryKey, id))); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public BaseStaff_ExpressEntity GetObject(string id) { return(BaseEntity.Create <BaseStaff_ExpressEntity>(this.GetDataTable(new KeyValuePair <string, object>(this.PrimaryKey, id)))); }
/// <summary> /// 获取实体 /// </summary> /// <param name="parameters">参数</param> public BaseDictionaryItemEntity GetEntity(List <KeyValuePair <string, object> > parameters) { return(BaseEntity.Create <BaseDictionaryItemEntity>(GetDataTable(parameters))); }
/// <summary> /// 获取实体 /// </summary> /// <param name="parameters">参数</param> public BaseChangeLogEntity GetEntity(List <KeyValuePair <string, object> > parameters) { return(BaseEntity.Create <BaseChangeLogEntity>(GetDataTable(parameters))); }
/// <summary> /// 审核退回详细步骤 /// </summary> /// <param name="currentId">当前主键</param> /// <param name="auditIdea">批示</param> /// <param name="toUserId">发送给</param> /// <param name="activityId">退回到指定步骤</param> /// <returns>影响行数</returns> private BaseWorkFlowCurrentEntity StepAuditReject(string currentId, string auditIdea, string toUserId = null, string activityId = null) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetObject(currentId); // 1.记录审核时间、审核人 workFlowCurrentEntity.AuditUserId = this.UserInfo.Id; workFlowCurrentEntity.AuditUserCode = this.UserInfo.Code; workFlowCurrentEntity.AuditUserRealName = this.UserInfo.RealName; workFlowCurrentEntity.AuditStatus = AuditStatus.AuditReject.ToString(); workFlowCurrentEntity.AuditStatusName = AuditStatus.AuditReject.ToDescription(); workFlowCurrentEntity.AuditDate = DateTime.Now; workFlowCurrentEntity.AuditIdea = auditIdea; // 2.记录日志 this.AddHistory(workFlowCurrentEntity); // 3.更新待审核情况,流程已经结束了 workFlowCurrentEntity.ActivityId = null; if (!string.IsNullOrEmpty(activityId)) { workFlowCurrentEntity.ActivityId = int.Parse(activityId); // 1:先看流程审核步骤里是否有这个记录 BaseWorkFlowStepManager workFlowStepManager = new BaseWorkFlowStepManager(this.DbHelper, this.UserInfo); BaseWorkFlowStepEntity workFlowStepEntity = BaseEntity.Create <BaseWorkFlowStepEntity>( workFlowStepManager.GetDataTable( new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldActivityId, activityId) , new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldObjectId, workFlowCurrentEntity.ObjectId))); if (workFlowStepEntity != null && workFlowStepEntity.Id != null) { workFlowCurrentEntity.SortCode = workFlowStepEntity.SortCode; workFlowCurrentEntity.ToUserId = workFlowStepEntity.AuditUserId; workFlowCurrentEntity.ToUserRealName = workFlowStepEntity.AuditUserRealName; workFlowCurrentEntity.ToDepartmentId = workFlowStepEntity.AuditDepartmentId; workFlowCurrentEntity.ToDepartmentName = workFlowStepEntity.AuditDepartmentName; workFlowCurrentEntity.ToRoleId = workFlowStepEntity.AuditRoleId; workFlowCurrentEntity.ToRoleRealName = workFlowStepEntity.AuditRoleRealName; workFlowCurrentEntity.Description = string.Format("从{0}退回到{1}", workFlowCurrentEntity.ActivityFullName, workFlowStepEntity.FullName); workFlowCurrentEntity.ActivityCode = workFlowStepEntity.Code; workFlowCurrentEntity.ActivityFullName = workFlowStepEntity.FullName; } else { // 2:若没在流程审核步骤里那就从定义里找 BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(this.DbHelper, this.UserInfo); BaseWorkFlowActivityEntity workFlowActivityEntity = workFlowActivityManager.GetObject(activityId); workFlowCurrentEntity.SortCode = workFlowActivityEntity.SortCode; workFlowCurrentEntity.ToUserId = workFlowActivityEntity.AuditUserId; workFlowCurrentEntity.ToUserRealName = workFlowActivityEntity.AuditUserRealName; workFlowCurrentEntity.ToDepartmentId = workFlowActivityEntity.AuditDepartmentId; workFlowCurrentEntity.ToDepartmentName = workFlowActivityEntity.AuditDepartmentName; workFlowCurrentEntity.ToRoleId = workFlowActivityEntity.AuditRoleId; workFlowCurrentEntity.ToRoleRealName = workFlowActivityEntity.AuditRoleRealName; } } else { if (!string.IsNullOrEmpty(toUserId)) { BaseUserManager userManager = new BaseUserManager(UserInfo); BaseUserEntity userEntity = userManager.GetObject(toUserId); workFlowCurrentEntity.ToUserId = userEntity.Id; workFlowCurrentEntity.ToUserRealName = userEntity.RealName; workFlowCurrentEntity.ToDepartmentId = userEntity.DepartmentId; workFlowCurrentEntity.ToDepartmentName = userEntity.DepartmentName; workFlowCurrentEntity.ToRoleId = null; workFlowCurrentEntity.ToRoleRealName = null; } //workFlowCurrentEntity.SortCode = null; } workFlowCurrentEntity.SendDate = DateTime.Now; workFlowCurrentEntity.Enabled = 0; // 4.生成审核结束的记录 this.UpdateObject(workFlowCurrentEntity); return(workFlowCurrentEntity); }
/// <summary> /// 获取实体 /// </summary> /// <param name="id">主键</param> public BaseUserLogOnEntity GetObject(string id) { return(BaseEntity.Create <BaseUserLogOnEntity>(this.ExecuteReader(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldId, id)))); // return BaseEntity.Create<BaseUserLogOnEntity>(this.GetDataTable(new KeyValuePair<string, object>(BaseUserLogOnEntity.FieldId, id))); }
/// <summary> /// 添加编码 /// </summary> /// <param name="userInfo">用户</param> /// <param name="dt">数据表</param> /// <param name="status">状态</param> /// <param name="statusMessage">返回状态信息</param> /// <returns>数据表</returns> public string Add(BaseUserInfo userInfo, DataTable dt, out Status status, out string statusMessage) { var sequenceEntity = BaseEntity.Create <BaseSequenceEntity>(dt); return(Add(userInfo, sequenceEntity, out status, out statusMessage)); }