/// <summary> /// 更新实体 /// </summary> /// <param name="noteEntity">实体对象</param> /// <returns>影响行数</returns> public int UpdateEntity(BaseNoteEntity noteEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, noteEntity); sqlBuilder.SetValue(BaseNoteEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetDBNow(BaseNoteEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseNoteEntity.FieldId, noteEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="addressBookEntity">实体对象</param> /// <returns>影响行数</returns> public int UpdateEntity(BaseAdviceEntity myAdviceEntity) { SQLBuilder sqlBuilder = new SQLBuilder(this.DbHelper); sqlBuilder.BeginUpdate(BaseAdviceTable.TableName); this.SetEntity(sqlBuilder, myAdviceEntity); sqlBuilder.SetValue(BaseAdviceTable.FieldModifyUserID, this.UserInfo.ID); sqlBuilder.SetDBNow(BaseAdviceTable.FieldModifyDate); sqlBuilder.SetWhere(BaseAdviceTable.FieldID, myAdviceEntity.ID); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="workReportEntity">实体</param> /// <returns>影响行数</returns> public int UpdateEntity(BaseWorkReportEntity workReportEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(BaseWorkReportTable.TableName); this.SetEntity(sqlBuilder, workReportEntity); sqlBuilder.SetValue(BaseWorkReportTable.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetDBNow(BaseWorkReportTable.FieldModifiedOn); sqlBuilder.SetWhere(BaseWorkReportTable.FieldId, workReportEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 重置访问情况 /// </summary> /// <param name="id">主键</param> /// <returns>影响行数</returns> private int ResetVisitInfo(string id) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetNull(BaseUserEntity.FieldFirstVisit); sqlBuilder.SetNull(BaseUserEntity.FieldPreviousVisit); sqlBuilder.SetNull(BaseUserEntity.FieldLastVisit); sqlBuilder.SetValue(BaseUserEntity.FieldLogOnCount, 0); sqlBuilder.SetWhere(BaseUserEntity.FieldId, id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="businessCardEntity">实体</param> public int UpdateEntity(BaseBusinessCardEntity businessCardEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, businessCardEntity); sqlBuilder.SetValue(BaseBusinessCardTable.FieldModifiedBy, UserInfo.RealName); sqlBuilder.SetValue(BaseBusinessCardTable.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetDBNow(BaseBusinessCardTable.FieldModifiedOn); sqlBuilder.SetWhere(BaseBusinessCardTable.FieldId, businessCardEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 用户角色关系是否有模块权限 /// </summary> /// <param name="roleId">角色主键</param> /// <param name="permissionItemCode">权限编号</param> /// <returns>有角色权限</returns> public bool CheckPermissionByRole(string roleId, string permissionItemCode) { BasePermissionItemManager permissionItemManager = new BasePermissionItemManager(DbHelper, UserInfo); string permissionItemId = permissionItemManager.GetProperty(new KeyValuePair <string, object>(BasePermissionItemEntity.FieldCode, permissionItemCode), BasePermissionItemEntity.FieldId); // 判断当前判断的权限是否存在,否则很容易出现前台设置了权限,后台没此项权限 // 需要自动的能把前台判断过的权限,都记录到后台来 #if (DEBUG) if (String.IsNullOrEmpty(permissionItemId)) { BasePermissionItemEntity permissionItemEntity = new BasePermissionItemEntity(); permissionItemEntity.Code = permissionItemCode; permissionItemEntity.FullName = permissionItemCode; permissionItemEntity.ParentId = string.Empty; permissionItemEntity.IsScope = 0; permissionItemEntity.AllowDelete = 1; permissionItemEntity.AllowEdit = 1; permissionItemEntity.DeletionStateCode = 0; permissionItemEntity.Enabled = 1; // 这里是防止主键重复? // permissionEntity.ID = BaseBusinessLogic.NewGuid(); permissionItemManager.AddEntity(permissionItemEntity); } else { // 更新最后一次访问日期,设置为当前服务器日期 SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetDBNow(BasePermissionItemEntity.FieldLastCall); sqlBuilder.SetWhere(BasePermissionItemEntity.FieldId, permissionItemId); sqlBuilder.EndUpdate(); } #endif if (string.IsNullOrEmpty(permissionItemId)) { return(false); } string sqlQuery = " SELECT COUNT(*) " + " FROM " + this.CurrentTableName + " WHERE " + "(" + BasePermissionEntity.FieldResourceCategory + " = '" + BaseRoleEntity.TableName + "') " + " AND (" + BasePermissionEntity.FieldEnabled + " = 1) " + " AND (" + BasePermissionEntity.FieldResourceId + " = '" + roleId + "' ) " + " AND (" + BasePermissionEntity.FieldPermissionItemId + " = '" + permissionItemId + "') "; int rowCount = 0; object returnObject = DbHelper.ExecuteScalar(sqlQuery); if (returnObject != null) { rowCount = int.Parse(returnObject.ToString()); } return(rowCount > 0); }
/// <summary> /// 重置访问情况 /// </summary> /// <returns>影响行数</returns> private int ResetVisitInfo() { int returnValue = 0; SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetNull(BaseUserEntity.FieldFirstVisit); sqlBuilder.SetNull(BaseUserEntity.FieldPreviousVisit); sqlBuilder.SetNull(BaseUserEntity.FieldLastVisit); sqlBuilder.SetValue(BaseUserEntity.FieldLogOnCount, 0); returnValue = sqlBuilder.EndUpdate(); return(returnValue); }
public int UpdateFile(string id, string fileName, string contents) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseNewsEntity.FieldTitle, fileName); sqlBuilder.SetValue(BaseNewsEntity.FieldContents, contents); sqlBuilder.SetValue(BaseNewsEntity.FieldFileSize, contents.Length); sqlBuilder.SetValue(BaseNewsEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseNewsEntity.FieldModifiedBy, UserInfo.RealName); sqlBuilder.SetDBNow(BaseNewsEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseNewsEntity.FieldId, id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="userOrganizeEntity">实体</param> public int UpdateEntity(BaseUserOrganizeEntity userOrganizeEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, userOrganizeEntity); if (UserInfo != null) { sqlBuilder.SetValue(BaseUserOrganizeEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseUserOrganizeEntity.FieldModifiedBy, UserInfo.RealName); } sqlBuilder.SetDBNow(BaseUserOrganizeEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseUserOrganizeEntity.FieldId, userOrganizeEntity.Id); return sqlBuilder.EndUpdate(); }
/// <summary> /// 替换当前步骤中的人员 /// </summary> /// <param name="oldUserId">原来的工号</param> /// <param name="newUserId">新的工号</param> /// <returns>影响行数</returns> public int ReplaceUser(string oldUserId, string newUserId) { BaseUserManager userManager = new BaseUserManager(this.UserInfo); BaseUserEntity newUserEntity = userManager.GetEntity(newUserId); SQLBuilder sqlBuilder = new SQLBuilder(this.DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToUserId, newUserEntity.Id); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToUserRealName, newUserEntity.RealName); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToDepartmentId, newUserEntity.DepartmentId); sqlBuilder.SetValue(BaseWorkFlowCurrentEntity.FieldToDepartmentName, newUserEntity.DepartmentName); sqlBuilder.SetWhere(BaseWorkFlowCurrentEntity.FieldToUserId, oldUserId, "OldUserId"); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="baseContactEntity">实体</param> public int UpdateEntity(BaseContactEntity baseContactEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(BaseContactEntity.TableName); this.SetEntity(sqlBuilder, baseContactEntity); if (UserInfo != null) { sqlBuilder.SetValue(BaseContactEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseContactEntity.FieldModifiedBy, UserInfo.RealName); } sqlBuilder.SetDBNow(BaseContactEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseContactEntity.FieldId, baseContactEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="incomingCallEntity">实体</param> public int UpdateEntity(IncomingCallEntity incomingCallEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DBProvider); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, incomingCallEntity); if (UserInfo != null) { sqlBuilder.SetValue(IncomingCallTable.FieldModifiedBy, UserInfo.RealName); sqlBuilder.SetValue(IncomingCallTable.FieldModifiedUserId, UserInfo.Id); } sqlBuilder.SetDBNow(IncomingCallTable.FieldModifiedOn); sqlBuilder.SetWhere(IncomingCallTable.FieldId, incomingCallEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="productInfoEntity">实体</param> public int UpdateEntity(ProductInfoEntity productInfoEntity) { var sqlBuilder = new SQLBuilder(DBProvider); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, productInfoEntity); if (UserInfo != null) { sqlBuilder.SetValue(ProductInfoTable.FieldModifiedBy, UserInfo.RealName); sqlBuilder.SetValue(ProductInfoTable.FieldModifiedUserId, UserInfo.Id); } sqlBuilder.SetDBNow(ProductInfoTable.FieldModifiedOn); sqlBuilder.SetWhere(ProductInfoTable.FieldId, productInfoEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="customerEntity">实体</param> public int UpdateEntity(CustomerEntity customerEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DBProvider); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, customerEntity); if (UserInfo != null) { sqlBuilder.SetValue(CustomerTable.FieldModifiedBy, UserInfo.RealName); sqlBuilder.SetValue(LinkManTable.FieldModifiedUserId, UserInfo.Id); } sqlBuilder.SetDBNow(CustomerTable.FieldModifiedOn); sqlBuilder.SetWhere(CustomerTable.FieldId, customerEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// (点通过时)当审核通过时 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流</param> /// <returns>成功失败</returns> public virtual bool OnAutoAuditPass(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { if (!string.IsNullOrEmpty(workFlowCurrentEntity.ObjectId)) { SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseBusinessLogic.FieldAuditStatus, AuditStatus.AuditPass.ToString()); sqlBuilder.SetDBNow(BaseBusinessLogic.FieldModifiedOn); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedUserId, this.UserInfo.Id); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedBy, this.UserInfo.RealName); sqlBuilder.SetWhere(BaseBusinessLogic.FieldId, workFlowCurrentEntity.ObjectId); sqlBuilder.EndUpdate(); } return(true); }
/// <summary> /// 更新实体 /// </summary> /// <param name="cASE_PRODUCTIN_DETAILEntity">实体</param> public int UpdateEntity(CASE_PRODUCTIN_DETAILEntity cASE_PRODUCTIN_DETAILEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DBProvider); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, cASE_PRODUCTIN_DETAILEntity); if (UserInfo != null) { sqlBuilder.SetValue(CASE_PRODUCTIN_DETAILTable.FieldMODIFIEDUSERID, UserInfo.Id); sqlBuilder.SetValue(CASE_PRODUCTIN_DETAILTable.FieldMODIFIEDBY, UserInfo.RealName); } sqlBuilder.SetDBNow(CASE_PRODUCTIN_DETAILTable.FieldMODIFIEDON); sqlBuilder.SetWhere(CASE_PRODUCTIN_DETAILTable.FieldID, cASE_PRODUCTIN_DETAILEntity.ID); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 更新实体 /// </summary> /// <param name="userEntity">实体</param> public int UpdateEntity(BaseUserEntity userEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); userEntity.QuickQuery = StringUtil.GetPinyin(userEntity.RealName); this.SetEntity(sqlBuilder, userEntity); if (UserInfo != null) { sqlBuilder.SetValue(BaseUserEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseUserEntity.FieldModifiedBy, UserInfo.RealName); } sqlBuilder.SetDBNow(BaseUserEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseUserEntity.FieldId, userEntity.Id); return(sqlBuilder.EndUpdate()); }
public int UpdateFile(string id, string fileName, byte[] file) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseFileEntity.FieldFileName, fileName); if (file != null) { sqlBuilder.SetValue(BaseFileEntity.FieldContents, file); sqlBuilder.SetValue(BaseFileEntity.FieldFileSize, file.Length); } sqlBuilder.SetValue(BaseFileEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseFileEntity.FieldModifiedBy, UserInfo.RealName); sqlBuilder.SetDBNow(BaseFileEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseFileEntity.FieldId, id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 重置单据 /// (单据发生错误时)紧急情况下实用 /// </summary> /// <param name="currentId">审批流当前主键</param> /// <param name="categoryCode">单据分类</param> /// <param name="auditIdea">批示</param> /// <returns>影响行数</returns> public virtual bool OnReset(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { // 审核通过后,需要把有效状态修改过来 if (!string.IsNullOrEmpty(workFlowCurrentEntity.ObjectId)) { SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseBusinessLogic.FieldAuditStatus, AuditStatus.Draft.ToString()); sqlBuilder.SetValue(BaseBusinessLogic.FieldEnabled, 1); sqlBuilder.SetDBNow(BaseBusinessLogic.FieldModifiedOn); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedUserId, this.UserInfo.Id); sqlBuilder.SetValue(BaseBusinessLogic.FieldModifiedBy, this.UserInfo.RealName); sqlBuilder.SetWhere(BaseBusinessLogic.FieldId, workFlowCurrentEntity.ObjectId); sqlBuilder.EndUpdate(); } // 若还需要有其他处理,就这后面继续处理 return(true); }
/// <summary> /// 更新 /// </summary> /// <param name="parameterEntity">实体</param> /// <returns>影响行数</returns> protected int UpdateEntity(BaseParameterEntity parameterEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseParameterEntity.FieldCategoryId, parameterEntity.CategoryId); sqlBuilder.SetValue(BaseParameterEntity.FieldParameterCode, parameterEntity.ParameterCode); sqlBuilder.SetValue(BaseParameterEntity.FieldParameterId, parameterEntity.ParameterId); sqlBuilder.SetValue(BaseParameterEntity.FieldParameterContent, parameterEntity.ParameterContent); sqlBuilder.SetValue(BaseParameterEntity.FieldWorked, parameterEntity.Worked ? 1 : 0); sqlBuilder.SetValue(BaseParameterEntity.FieldEnabled, parameterEntity.Enabled ? 1 : 0); sqlBuilder.SetValue(BaseParameterEntity.FieldDeletionStateCode, parameterEntity.DeletionStateCode); sqlBuilder.SetValue(BaseParameterEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseParameterEntity.FieldModifiedBy, UserInfo.RealName); sqlBuilder.SetDBNow(BaseParameterEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseParameterEntity.FieldId, parameterEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 离开时的日志记录 /// </summary> /// <param name="userInfo">用户</param> /// <param name="logId">日志主键</param> public void WriteExit(BaseUserInfo userInfo, string logId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif if (!string.IsNullOrEmpty(logId)) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); sqlBuilder.BeginUpdate(BaseLogEntity.TableName); sqlBuilder.SetDBNow(BaseLogEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseLogEntity.FieldId, logId); sqlBuilder.EndUpdate(); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif }
/// <summary> /// (点通过时)当审核通过时 /// </summary> /// <param name="workFlowCurrentEntity">当前审批流</param> /// <returns>成功失败</returns> public override bool OnAutoAuditPass(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { string objectId = workFlowCurrentEntity.ObjectId; if (!string.IsNullOrEmpty(objectId)) { // 这里写自己的方法(审核 过程中的回调),通过审核时 IDbHelper dbHelper = new SqlHelper(BaseSystemInfo.BusinessDbConnection); dbHelper.Open(); SQLBuilder sqlBuilder = new SQLBuilder(dbHelper); sqlBuilder.BeginUpdate("WL物品申购"); sqlBuilder.SetDBNow("审核日期"); sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code); sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditPass.ToString()); sqlBuilder.SetWhere("申请单号", objectId); sqlBuilder.EndUpdate(); dbHelper.Close(); } return(true); }
/// <summary> /// 更新 /// </summary> /// <param name="addressBookEntity">实体</param> /// <returns>影响行数</returns> public int Update(BaseAddressBookEntity addressBookEntity) { int returnValue = 0; SQLBuilder mySQLBuilder = new SQLBuilder(this.DbHelper); mySQLBuilder.BeginUpdate(BaseAddressBookTable.TableName); mySQLBuilder.SetValue(BaseAddressBookTable.FieldFullName, addressBookEntity.FullName); mySQLBuilder.SetValue(BaseAddressBookTable.FieldCompanyName, addressBookEntity.CompanyName); mySQLBuilder.SetValue(BaseAddressBookTable.FieldAdress, addressBookEntity.Adress); mySQLBuilder.SetValue(BaseAddressBookTable.FieldDuty, addressBookEntity.Duty); mySQLBuilder.SetValue(BaseAddressBookTable.FieldTelephone, addressBookEntity.Telephone); mySQLBuilder.SetValue(BaseAddressBookTable.FieldMobile, addressBookEntity.Mobile); mySQLBuilder.SetValue(BaseAddressBookTable.FieldMail, addressBookEntity.Mail); mySQLBuilder.SetValue(BaseAddressBookTable.FieldRelation, addressBookEntity.Relation); mySQLBuilder.SetValue(BaseAddressBookTable.FieldEnabled, addressBookEntity.Enabled); mySQLBuilder.SetValue(BaseAddressBookTable.FieldDescription, addressBookEntity.Description); mySQLBuilder.SetValue(BaseAddressBookTable.FieldModifyUserID, this.UserInfo.ID); mySQLBuilder.SetDBNow(BaseAddressBookTable.FieldModifyDate); mySQLBuilder.SetWhere(BaseAddressBookTable.FieldID, addressBookEntity.ID); returnValue = mySQLBuilder.EndUpdate(); return(returnValue); }
/// <summary> /// 阅读短信后设置状态值和阅读次数 /// </summary> /// <param name="messageEntity">实体</param> /// <param name="id">短信主键</param> /// <returns>影响的条数</returns> private int OnRead(BaseMessageEntity messageEntity, string id) { int returnValue = 0; // 针对“已发送”的情况 if (messageEntity.ReceiverId == UserInfo.Id) { // 针对“删除的信息”的情况 if (messageEntity.IsNew == (int)MessageStateCode.New) { SQLBuilder sqlBuilder = new SQLBuilder(this.DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetValue(BaseMessageEntity.FieldIsNew, ((int)MessageStateCode.Old).ToString()); sqlBuilder.SetDBNow(BaseMessageEntity.FieldReadDate); sqlBuilder.SetWhere(BaseMessageEntity.FieldId, id); sqlBuilder.EndUpdate(); } } // 增加阅读次数 messageEntity.ReadCount++; this.SetProperty(id, new KeyValuePair <string, object>(BaseMessageEntity.FieldReadCount, messageEntity.ReadCount.ToString())); returnValue++; return(returnValue); }
/// <summary> /// 获取一个操作权限的主键 /// 若不存在就自动增加一个 /// </summary> /// <param name="permissionItemCode">操作权限编号</param> /// <param name="permissionItemName">操作权限名称</param> /// <returns>主键</returns> public string GetIdByAdd(string permissionItemCode, string permissionItemName = null) { // 判断当前判断的权限是否存在,否则很容易出现前台设置了权限,后台没此项权限 // 需要自动的能把前台判断过的权限,都记录到后台来 List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BasePermissionItemEntity.FieldCode, permissionItemCode)); parameters.Add(new KeyValuePair <string, object>(BasePermissionItemEntity.FieldEnabled, 1)); parameters.Add(new KeyValuePair <string, object>(BasePermissionItemEntity.FieldDeletionStateCode, 0)); BasePermissionItemEntity permissionItemEntity = new BasePermissionItemEntity(); permissionItemEntity = new BasePermissionItemEntity(this.GetDataTable(parameters, BasePermissionItemEntity.FieldId)); string permissionItemId = string.Empty; if (permissionItemEntity != null) { permissionItemId = permissionItemEntity.Id.ToString(); } // 若是在调试阶段、有没在的权限被判断了,那就自动加入这个权限,不用人工加入权限了,工作效率会提高很多, // 哪些权限是否有被调用什么的,还可以进行一些诊断 #if (DEBUG) if (String.IsNullOrEmpty(permissionItemId)) { // 这里需要进行一次加锁,方式并发冲突发生 lock (PermissionItemLock) { permissionItemEntity.Code = permissionItemCode; if (string.IsNullOrEmpty(permissionItemName)) { permissionItemEntity.FullName = permissionItemCode; } else { permissionItemEntity.FullName = permissionItemName; } permissionItemEntity.ParentId = null; permissionItemEntity.IsScope = 0; permissionItemEntity.AllowDelete = 1; permissionItemEntity.AllowEdit = 1; permissionItemEntity.Enabled = 1; // 这里是防止主键重复? // permissionEntity.ID = BaseBusinessLogic.NewGuid(); permissionItemId = this.AddEntity(permissionItemEntity); } } else { // 更新最后一次访问日期,设置为当前服务器日期 SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); sqlBuilder.SetDBNow(BasePermissionItemEntity.FieldLastCall); sqlBuilder.SetWhere(BasePermissionItemEntity.FieldId, permissionItemId); sqlBuilder.EndUpdate(); } #endif return(permissionItemId); }
/// <summary> /// 更新实体 /// </summary> /// <param name="addressBookEntity">实体对象</param> /// <returns>影响行数</returns> public int UpdateEntity(BaseAdviceEntity myAdviceEntity) { SQLBuilder sqlBuilder = new SQLBuilder(this.DbHelper); sqlBuilder.BeginUpdate(BaseAdviceTable.TableName); this.SetEntity(sqlBuilder, myAdviceEntity); sqlBuilder.SetValue(BaseAdviceTable.FieldModifyUserID, this.UserInfo.ID); sqlBuilder.SetDBNow(BaseAdviceTable.FieldModifyDate); sqlBuilder.SetWhere(BaseAdviceTable.FieldID, myAdviceEntity.ID); return sqlBuilder.EndUpdate(); }