/// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="parameterEntity">实体对象</param>
 /// <returns>主键</returns>
 public string AddEntity(BaseParameterEntity parameterEntity)
 {
     if (string.IsNullOrEmpty(parameterEntity.Id))
     {
         parameterEntity.Id = Guid.NewGuid().ToString();
     }
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     sqlBuilder.BeginInsert(this.CurrentTableName);
     sqlBuilder.SetValue(BaseParameterEntity.FieldId, parameterEntity.Id);
     sqlBuilder.SetValue(BaseParameterEntity.FieldCategoryId, parameterEntity.CategoryId);
     sqlBuilder.SetValue(BaseParameterEntity.FieldParameterId, parameterEntity.ParameterId);
     sqlBuilder.SetValue(BaseParameterEntity.FieldParameterCode, parameterEntity.ParameterCode);
     sqlBuilder.SetValue(BaseParameterEntity.FieldWorked, parameterEntity.Worked ? 1 : 0);
     sqlBuilder.SetValue(BaseParameterEntity.FieldParameterContent, parameterEntity.ParameterContent);
     sqlBuilder.SetValue(BaseParameterEntity.FieldEnabled, parameterEntity.Enabled ? 1 : 0);
     sqlBuilder.SetValue(BaseParameterEntity.FieldDeletionStateCode, parameterEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseParameterEntity.FieldDescription, parameterEntity.Description);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseParameterEntity.FieldCreateUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseParameterEntity.FieldCreateBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseParameterEntity.FieldCreateOn);
     return sqlBuilder.EndInsert() > 0 ? parameterEntity.Id : string.Empty;
 }
 /// <summary>
 /// 设置属性
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="tableName">目标表名</param>
 /// <param name="whereParameters">条件字段,条件值</param>
 /// <param name="parameters">更新字段,更新值</param>
 /// <returns>影响行数</returns>
 public static int SetProperty(IDbHelper dbHelper, string tableName, List<KeyValuePair<string, object>> whereParameters, List<KeyValuePair<string, object>> parameters)
 {
     SQLBuilder sqlBuilder = new SQLBuilder(dbHelper);
     sqlBuilder.BeginUpdate(tableName);
     foreach (var parameter in parameters)
     {
         sqlBuilder.SetValue(parameter.Key, parameter.Value);
     }
     sqlBuilder.SetWhere(whereParameters);
     // sqlBuilder.SetDBNow(FieldModifiedOn);
     return sqlBuilder.EndUpdate();
 }
 /// <summary>
 /// 流程完成时
 /// 结束审核时,需要回调写入到表里,调用相应的事件
 /// 若成功可以执行完成的处理
 /// </summary>
 /// <param name="workFlowCurrentEntity">当前审批流程</param>
 /// <returns>成功失败</returns>
 public override bool OnAuditComplete(BaseWorkFlowCurrentEntity workFlowCurrentEntity)
 {
     // 审核通过后,需要把有效状态修改过来
     BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(this.UserInfo);
     //string objectId = workFlowCurrentManager.GetEntity(workFlowCurrentEntity.Id).ObjectId;
     string objectId = workFlowCurrentEntity.ObjectId;
     if (!string.IsNullOrEmpty(objectId))
     {
         // 这里写自己的方法(审核 过程中的回调),完成审核时
         IDbHelper dbHelper = new SqlHelper(BaseSystemInfo.BusinessDbConnection);
         dbHelper.Open();
         SQLBuilder sqlBuilder = new SQLBuilder(dbHelper);
         switch (workFlowCurrentEntity.CategoryCode)
         {
             case "PuTongCaiGouDan":
             case "GuoNeiCaiGouHeTong":
             case "PutongCaiGouDanDGM":
             case "PutongCaiGouDanManager":
                 sqlBuilder.BeginUpdate("WL物品申购");
                 sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString());
                 sqlBuilder.SetValue("审核", 1);
                 sqlBuilder.SetDBNow("审核日期");
                 sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code);
                 sqlBuilder.SetWhere("申请单号", objectId);
                 sqlBuilder.EndUpdate();
                 break;
             case "YuanFuCaiLiaoShenQingDan":
                 sqlBuilder.BeginUpdate("WL部门物品申购");
                 sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString());
                 sqlBuilder.SetValue("审核", 1);
                 sqlBuilder.SetValue("总审核", 1);
                 sqlBuilder.SetDBNow("审核日期");
                 sqlBuilder.SetDBNow("总审核日期");
                 sqlBuilder.SetValue("审核员", BaseSystemInfo.UserInfo.Code);
                 sqlBuilder.SetWhere("申购单号", objectId);
                 sqlBuilder.EndUpdate();
                 break;
             case "MoJuCaiGouHeTongP":
             case "MoJuCaiGouHeTongGM":
                 sqlBuilder.BeginUpdate("GCMJ模具申请");
                 sqlBuilder.SetValue("AuditStatus", AuditStatus.AuditComplete.ToString());
                 sqlBuilder.SetValue("审核", 1);
                 sqlBuilder.SetWhere("申请单号", objectId);
                 sqlBuilder.EndUpdate();
                 break;
         }
         dbHelper.Close();
     }
     // 若还需要有其他处理,就这后面继续处理
     return true;
 }
 /// <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(BaseWorkFlowStepEntity.FieldAuditUserId, newUserEntity.Id);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditUserCode, newUserEntity.Code);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditUserRealName, newUserEntity.RealName);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditDepartmentId, newUserEntity.DepartmentId);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditDepartmentName, newUserEntity.DepartmentName);
     sqlBuilder.SetWhere(BaseWorkFlowStepEntity.FieldAuditUserId, oldUserId, "OldUserId");
     return sqlBuilder.EndUpdate();
 }
 /// <summary>
 /// 添加一条记录
 /// </summary>
 /// <param name="noteEntity">实体对象</param>
 /// <returns>主键</returns>
 public string AddEntity(BaseNoteEntity noteEntity)
 {
     string id = Guid.NewGuid().ToString();
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     sqlBuilder.BeginInsert(this.CurrentTableName);
     sqlBuilder.SetValue(BaseNoteEntity.FieldId, id);
     this.SetEntity(sqlBuilder, noteEntity);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseNoteEntity.FieldCreateUserId, UserInfo.Id);
         sqlBuilder.SetDBNow(BaseNoteEntity.FieldCreateOn);
     }
     sqlBuilder.SetDBNow(BaseNoteEntity.FieldModifiedOn);
     return sqlBuilder.EndInsert() > 0 ? id : string.Empty;
 }
示例#6
0
 /// <summary>
 /// 添加员工
 /// </summary>
 /// <param name="DepartmentId">部门主键</param>
 /// <param name="userName">用户名</param>
 /// <param name="code">编号</param>
 /// <param name="fullName">名称</param>
 /// <param name="canVisit">允许登录</param>
 /// <param name="isVirtual">虚拟用户</param>
 /// <param name="isDimission">离职</param>
 /// <param name="enabled">有效</param>
 /// <param name="description">描述</param>
 /// <returns>主键</returns>
 public string Add(string departmentId, string userName, string code, string fullName, bool isVirtual, bool isDimission, bool enabled, string description)
 {
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper);
     string sequence = sequenceManager.GetSequence(this.CurrentTableName);
     sqlBuilder.BeginInsert(this.CurrentTableName);
     sqlBuilder.SetValue(BaseStaffEntity.FieldId, sequence);
     sqlBuilder.SetValue(BaseStaffEntity.FieldCode, code);
     sqlBuilder.SetValue(BaseStaffEntity.FieldUserName, userName);
     sqlBuilder.SetValue(BaseStaffEntity.FieldRealName, fullName);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDepartmentId, departmentId);
     sqlBuilder.SetValue(BaseStaffEntity.FieldSortCode, sequence);
     sqlBuilder.SetValue(BaseStaffEntity.FieldEnabled, enabled ? 1 : 0);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseStaffEntity.FieldCreateUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseStaffEntity.FieldCreateOn, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseStaffEntity.FieldCreateOn);
     string returnValue = sqlBuilder.EndInsert() > 0 ? sequence : string.Empty;
     return returnValue;
 }
示例#7
0
 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();
 }
        // 这个是声明扩展方法
partial         void SetEntityExpand(SQLBuilder sqlBuilder, BaseMessageEntity baseMessageEntity);
 /// <summary>
 /// 记录异常情况
 /// </summary>
 /// <param name="Exception">异常类</param>
 /// <returns>主键</returns>
 public string AddEntity(Exception ex)
 {
     // string sequence = BaseSequenceManager.Instance.GetSequence(DbHelper, BaseExceptionEntity.TableName);
     string sequence = BaseBusinessLogic.NewGuid();
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     sqlBuilder.BeginInsert(this.CurrentTableName);
     sqlBuilder.SetValue(BaseExceptionEntity.FieldId, sequence);
     // sqlBuilder.SetValue(BaseExceptionEntity.FieldTitle, UserInfo.ProcessName);
     // sqlBuilder.SetValue(BaseExceptionEntity.FieldProcessId, UserInfo.ProcessId);
     // sqlBuilder.SetValue(BaseExceptionEntity.FieldProcessName, UserInfo.ProcessName);
     sqlBuilder.SetValue(BaseExceptionEntity.FieldMessage, ex.Message);
     sqlBuilder.SetValue(BaseExceptionEntity.FieldThreadName, ex.Source);
     sqlBuilder.SetValue(BaseExceptionEntity.FieldFormattedMessage, ex.StackTrace);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseExceptionEntity.FieldIPAddress, UserInfo.IPAddress);
         sqlBuilder.SetValue(BaseExceptionEntity.FieldCreateUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseExceptionEntity.FieldCreateBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseExceptionEntity.FieldCreateOn);
     return sqlBuilder.EndInsert() > 0 ? sequence : string.Empty;
 }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="baseWorkFlowHistoryEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity)
 {
     SetEntityExpand(sqlBuilder, baseWorkFlowHistoryEntity);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldCurrentFlowId, baseWorkFlowHistoryEntity.CurrentFlowId);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldWorkFlowId, baseWorkFlowHistoryEntity.WorkFlowId);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldActivityId, baseWorkFlowHistoryEntity.ActivityId);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldActivityFullName, baseWorkFlowHistoryEntity.ActivityFullName);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToDepartmentId, baseWorkFlowHistoryEntity.ToDepartmentId);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToDepartmentName, baseWorkFlowHistoryEntity.ToDepartmentName);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToUserId, baseWorkFlowHistoryEntity.ToUserId);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToUserRealName, baseWorkFlowHistoryEntity.ToUserRealName);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToRoleId, baseWorkFlowHistoryEntity.ToRoleId);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToRoleRealName, baseWorkFlowHistoryEntity.ToRoleRealName);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditUserId, baseWorkFlowHistoryEntity.AuditUserId);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditUserCode, baseWorkFlowHistoryEntity.AuditUserCode);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditUserRealName, baseWorkFlowHistoryEntity.AuditUserRealName);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldSendDate, baseWorkFlowHistoryEntity.SendDate);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditDate, baseWorkFlowHistoryEntity.AuditDate);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditIdea, baseWorkFlowHistoryEntity.AuditIdea);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditStatus, baseWorkFlowHistoryEntity.AuditStatus);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditStatusName, baseWorkFlowHistoryEntity.AuditStatusName);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldSortCode, baseWorkFlowHistoryEntity.SortCode);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldEnabled, baseWorkFlowHistoryEntity.Enabled);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldDeletionStateCode, baseWorkFlowHistoryEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldDescription, baseWorkFlowHistoryEntity.Description);
 }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="baseMessageEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseMessageEntity baseMessageEntity)
 {
     SetEntityExpand(sqlBuilder, baseMessageEntity);
     sqlBuilder.SetValue(BaseMessageEntity.FieldParentId, baseMessageEntity.ParentId);
     sqlBuilder.SetValue(BaseMessageEntity.FieldReceiverDepartmentId, baseMessageEntity.ReceiverDepartmentId);
     sqlBuilder.SetValue(BaseMessageEntity.FieldReceiverDepartmentName, baseMessageEntity.ReceiverDepartmentName);
     sqlBuilder.SetValue(BaseMessageEntity.FieldReceiverId, baseMessageEntity.ReceiverId);
     sqlBuilder.SetValue(BaseMessageEntity.FieldReceiverRealName, baseMessageEntity.ReceiverRealName);
     sqlBuilder.SetValue(BaseMessageEntity.FieldFunctionCode, baseMessageEntity.FunctionCode);
     sqlBuilder.SetValue(BaseMessageEntity.FieldCategoryCode, baseMessageEntity.CategoryCode);
     sqlBuilder.SetValue(BaseMessageEntity.FieldObjectId, baseMessageEntity.ObjectId);
     sqlBuilder.SetValue(BaseMessageEntity.FieldTitle, baseMessageEntity.Title);
     sqlBuilder.SetValue(BaseMessageEntity.FieldContents, baseMessageEntity.Contents);
     sqlBuilder.SetValue(BaseMessageEntity.FieldIsNew, baseMessageEntity.IsNew);
     sqlBuilder.SetValue(BaseMessageEntity.FieldReadCount, baseMessageEntity.ReadCount);
     sqlBuilder.SetValue(BaseMessageEntity.FieldReadDate, baseMessageEntity.ReadDate);
     sqlBuilder.SetValue(BaseMessageEntity.FieldTargetURL, baseMessageEntity.TargetURL);
     sqlBuilder.SetValue(BaseMessageEntity.FieldIPAddress, baseMessageEntity.IPAddress);
     sqlBuilder.SetValue(BaseMessageEntity.FieldCreateDepartmentId, baseMessageEntity.CreateDepartmentId);
     sqlBuilder.SetValue(BaseMessageEntity.FieldCreateDepartmentName, baseMessageEntity.CreateDepartmentName);
     sqlBuilder.SetValue(BaseMessageEntity.FieldDeletionStateCode, baseMessageEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseMessageEntity.FieldEnabled, baseMessageEntity.Enabled);
     sqlBuilder.SetValue(BaseMessageEntity.FieldDescription, baseMessageEntity.Description);
     sqlBuilder.SetValue(BaseMessageEntity.FieldSortCode, baseMessageEntity.SortCode);
 }
 /// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="workFlowActivityEntity">实体</param>
 public string AddEntity(BaseWorkFlowStepEntity workFlowActivityEntity)
 {
     string sequence = string.Empty;
     if (workFlowActivityEntity.SortCode == null || workFlowActivityEntity.SortCode == 0)
     {
         BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
         sequence = sequenceManager.GetSequence(this.CurrentTableName);
         workFlowActivityEntity.SortCode = int.Parse(sequence);
     }
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper, this.Identity, this.ReturnId);
     sqlBuilder.BeginInsert(this.CurrentTableName, BaseWorkFlowStepEntity.FieldId);
     if (!this.Identity)
     {
         sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldId, workFlowActivityEntity.Id);
     }
     else
     {
         if (!this.ReturnId && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2))
         {
             if (DbHelper.CurrentDbType == DbTypes.Oracle)
             {
                 sqlBuilder.SetFormula(BaseWorkFlowStepEntity.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
             }
             if (DbHelper.CurrentDbType == DbTypes.DB2)
             {
                 sqlBuilder.SetFormula(BaseWorkFlowStepEntity.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
             }
         }
         else
         {
             if (this.Identity && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2))
             {
                 if (workFlowActivityEntity.Id == null)
                 {
                     if (string.IsNullOrEmpty(sequence))
                     {
                         BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
                         sequence = sequenceManager.GetSequence(this.CurrentTableName);
                     }
                     workFlowActivityEntity.Id = int.Parse(sequence);
                 }
                 sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldId, workFlowActivityEntity.Id);
             }
         }
     }
     this.SetEntity(sqlBuilder, workFlowActivityEntity);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldCreateUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldCreateBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseWorkFlowStepEntity.FieldCreateOn);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldModifiedUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldModifiedBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseWorkFlowStepEntity.FieldModifiedOn);
     if (DbHelper.CurrentDbType == DbTypes.SqlServer && this.Identity)
     {
         sequence = sqlBuilder.EndInsert().ToString();
     }
     else
     {
         sqlBuilder.EndInsert();
     }
     return sequence;
 }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="BaseWorkFlowStepEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseWorkFlowStepEntity BaseWorkFlowStepEntity)
 {
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldCategoryCode, BaseWorkFlowStepEntity.CategoryCode);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldObjectId, BaseWorkFlowStepEntity.ObjectId);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldWorkFlowId, BaseWorkFlowStepEntity.WorkFlowId);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldActivityId, BaseWorkFlowStepEntity.ActivityId);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldCode, BaseWorkFlowStepEntity.Code);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldFullName, BaseWorkFlowStepEntity.FullName);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditDepartmentId, BaseWorkFlowStepEntity.AuditDepartmentId);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditDepartmentName, BaseWorkFlowStepEntity.AuditDepartmentName);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditUserId, BaseWorkFlowStepEntity.AuditUserId);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditUserCode, BaseWorkFlowStepEntity.AuditUserCode);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditUserRealName, BaseWorkFlowStepEntity.AuditUserRealName);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditRoleId, BaseWorkFlowStepEntity.AuditRoleId);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAuditRoleRealName, BaseWorkFlowStepEntity.AuditRoleRealName);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldActivityType, BaseWorkFlowStepEntity.ActivityType);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAllowPrint, BaseWorkFlowStepEntity.AllowPrint);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldAllowEditDocuments, BaseWorkFlowStepEntity.AllowEditDocuments);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldSortCode, BaseWorkFlowStepEntity.SortCode);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldEnabled, BaseWorkFlowStepEntity.Enabled);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldDeletionStateCode, BaseWorkFlowStepEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldDescription, BaseWorkFlowStepEntity.Description);
 }
        // 这个是声明扩展方法
partial         void SetEntityExpand(SQLBuilder sqlBuilder, BaseStaffEntity baseStaffEntity);
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="permissionScopeEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BasePermissionScopeEntity permissionScopeEntity)
 {
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldResourceCategory, permissionScopeEntity.ResourceCategory);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldResourceId, permissionScopeEntity.ResourceId);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldTargetCategory, permissionScopeEntity.TargetCategory);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldTargetId, permissionScopeEntity.TargetId);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldPermissionItemId, permissionScopeEntity.PermissionId);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldPermissionConstraint, permissionScopeEntity.PermissionConstraint);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldStartDate, permissionScopeEntity.StartDate);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldEndDate, permissionScopeEntity.EndDate);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldEnabled, permissionScopeEntity.Enabled);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldDeletionStateCode, permissionScopeEntity.DeletionStateCode);
     sqlBuilder.SetValue(BasePermissionScopeEntity.FieldDescription, permissionScopeEntity.Description);
     SetEntityExpand(sqlBuilder, permissionScopeEntity);
 }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder">SQL生成器</param>
 /// <param name="workReportEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseWorkReportEntity workReportEntity)
 {
     sqlBuilder.SetValue(BaseWorkReportTable.FieldWorkDate, workReportEntity.WorkDate);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldCategoryId, workReportEntity.CategoryId);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldContent, workReportEntity.Content);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldManHour, workReportEntity.ManHour);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldProjectId, workReportEntity.ProjectId);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldStaffId, workReportEntity.StaffId);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldEnabled, workReportEntity.Enabled);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldAuditStaffId, workReportEntity.AuditStaffId);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldScore, workReportEntity.Score);
     sqlBuilder.SetValue(BaseWorkReportTable.FieldDescription, workReportEntity.Description);
 }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="baseStaffEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseStaffEntity baseStaffEntity)
 {
     SetEntityExpand(sqlBuilder, baseStaffEntity);
     sqlBuilder.SetValue(BaseStaffEntity.FieldUserId, baseStaffEntity.UserId);
     sqlBuilder.SetValue(BaseStaffEntity.FieldUserName, baseStaffEntity.UserName);
     sqlBuilder.SetValue(BaseStaffEntity.FieldRealName, baseStaffEntity.RealName);
     sqlBuilder.SetValue(BaseStaffEntity.FieldCode, baseStaffEntity.Code);
     sqlBuilder.SetValue(BaseStaffEntity.FieldGender, baseStaffEntity.Gender);
     sqlBuilder.SetValue(BaseStaffEntity.FieldSubCompanyId, baseStaffEntity.SubCompanyId);
     sqlBuilder.SetValue(BaseStaffEntity.FieldCompanyId, baseStaffEntity.CompanyId);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDepartmentId, baseStaffEntity.DepartmentId);
     sqlBuilder.SetValue(BaseStaffEntity.FieldWorkgroupId, baseStaffEntity.WorkgroupId);
     sqlBuilder.SetValue(BaseStaffEntity.FieldQuickQuery, baseStaffEntity.QuickQuery);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDutyId, baseStaffEntity.DutyId);
     sqlBuilder.SetValue(BaseStaffEntity.FieldIdentificationCode, baseStaffEntity.IdentificationCode);
     sqlBuilder.SetValue(BaseStaffEntity.FieldIDCard, baseStaffEntity.IDCard);
     sqlBuilder.SetValue(BaseStaffEntity.FieldBankCode, baseStaffEntity.BankCode);
     sqlBuilder.SetValue(BaseStaffEntity.FieldEmail, baseStaffEntity.Email);
     sqlBuilder.SetValue(BaseStaffEntity.FieldMobile, baseStaffEntity.Mobile);
     sqlBuilder.SetValue(BaseStaffEntity.FieldShortNumber, baseStaffEntity.ShortNumber);
     sqlBuilder.SetValue(BaseStaffEntity.FieldTelephone, baseStaffEntity.Telephone);
     sqlBuilder.SetValue(BaseStaffEntity.FieldOICQ, baseStaffEntity.OICQ);
     sqlBuilder.SetValue(BaseStaffEntity.FieldOfficePhone, baseStaffEntity.OfficePhone);
     sqlBuilder.SetValue(BaseStaffEntity.FieldOfficeZipCode, baseStaffEntity.OfficeZipCode);
     sqlBuilder.SetValue(BaseStaffEntity.FieldOfficeAddress, baseStaffEntity.OfficeAddress);
     sqlBuilder.SetValue(BaseStaffEntity.FieldOfficeFax, baseStaffEntity.OfficeFax);
     sqlBuilder.SetValue(BaseStaffEntity.FieldAge, baseStaffEntity.Age);
     sqlBuilder.SetValue(BaseStaffEntity.FieldBirthday, baseStaffEntity.Birthday);
     sqlBuilder.SetValue(BaseStaffEntity.FieldEducation, baseStaffEntity.Education);
     sqlBuilder.SetValue(BaseStaffEntity.FieldSchool, baseStaffEntity.School);
     sqlBuilder.SetValue(BaseStaffEntity.FieldGraduationDate, baseStaffEntity.GraduationDate);
     sqlBuilder.SetValue(BaseStaffEntity.FieldMajor, baseStaffEntity.Major);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDegree, baseStaffEntity.Degree);
     sqlBuilder.SetValue(BaseStaffEntity.FieldTitleId, baseStaffEntity.TitleId);
     sqlBuilder.SetValue(BaseStaffEntity.FieldTitleDate, baseStaffEntity.TitleDate);
     sqlBuilder.SetValue(BaseStaffEntity.FieldTitleLevel, baseStaffEntity.TitleLevel);
     sqlBuilder.SetValue(BaseStaffEntity.FieldWorkingDate, baseStaffEntity.WorkingDate);
     sqlBuilder.SetValue(BaseStaffEntity.FieldJoinInDate, baseStaffEntity.JoinInDate);
     sqlBuilder.SetValue(BaseStaffEntity.FieldHomeZipCode, baseStaffEntity.HomeZipCode);
     sqlBuilder.SetValue(BaseStaffEntity.FieldHomeAddress, baseStaffEntity.HomeAddress);
     sqlBuilder.SetValue(BaseStaffEntity.FieldHomePhone, baseStaffEntity.HomePhone);
     sqlBuilder.SetValue(BaseStaffEntity.FieldHomeFax, baseStaffEntity.HomeFax);
     sqlBuilder.SetValue(BaseStaffEntity.FieldProvince, baseStaffEntity.Province);
     sqlBuilder.SetValue(BaseStaffEntity.FieldCarCode, baseStaffEntity.CarCode);
     sqlBuilder.SetValue(BaseStaffEntity.FieldCity, baseStaffEntity.City);
     sqlBuilder.SetValue(BaseStaffEntity.FieldArea, baseStaffEntity.Area);
     sqlBuilder.SetValue(BaseStaffEntity.FieldNativePlace, baseStaffEntity.NativePlace);
     sqlBuilder.SetValue(BaseStaffEntity.FieldParty, baseStaffEntity.Party);
     sqlBuilder.SetValue(BaseStaffEntity.FieldNation, baseStaffEntity.Nation);
     sqlBuilder.SetValue(BaseStaffEntity.FieldNationality, baseStaffEntity.Nationality);
     sqlBuilder.SetValue(BaseStaffEntity.FieldWorkingProperty, baseStaffEntity.WorkingProperty);
     sqlBuilder.SetValue(BaseStaffEntity.FieldCompetency, baseStaffEntity.Competency);
     sqlBuilder.SetValue(BaseStaffEntity.FieldEmergencyContact, baseStaffEntity.EmergencyContact);
     sqlBuilder.SetValue(BaseStaffEntity.FieldIsDimission, baseStaffEntity.IsDimission);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDimissionDate, baseStaffEntity.DimissionDate);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDimissionCause, baseStaffEntity.DimissionCause);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDimissionWhither, baseStaffEntity.DimissionWhither);
     sqlBuilder.SetValue(BaseStaffEntity.FieldEnabled, baseStaffEntity.Enabled);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDeletionStateCode, baseStaffEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseStaffEntity.FieldSortCode, baseStaffEntity.SortCode);
     sqlBuilder.SetValue(BaseStaffEntity.FieldDescription, baseStaffEntity.Description);
 }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="workReportEntity">实体</param>
        /// <returns>主键</returns>
        private string AddEntity(BaseWorkReportEntity workReportEntity)
        {
            string returnValue = string.Empty;
            BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper);
            string sequence = sequenceManager.GetSequence(BaseWorkReportTable.TableName);
            workReportEntity.SortCode = sequence;

            //获取职员的部门主键和公司主键
            BaseStaffManager staffManager = new BaseStaffManager(DbHelper, UserInfo);
            string CompanyId = staffManager.GetProperty(workReportEntity.StaffId, BaseStaffTable.FieldCompanyId);
            string DepartmentId = staffManager.GetProperty(workReportEntity.StaffId, BaseStaffTable.FieldDepartmentId);

            SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
            sqlBuilder.BeginInsert(BaseWorkReportTable.TableName);
            sqlBuilder.SetValue(BaseWorkReportTable.FieldId, sequence);
            sqlBuilder.SetValue(BaseWorkReportTable.FieldCompanyId, CompanyId);
            sqlBuilder.SetValue(BaseWorkReportTable.FieldDepartmentId, DepartmentId);
            this.SetEntity(sqlBuilder, workReportEntity);
            sqlBuilder.SetValue(BaseWorkReportTable.FieldCreateUserId, UserInfo.Id);
            sqlBuilder.SetDBNow(BaseWorkReportTable.FieldCreateOn);
            returnValue = sqlBuilder.EndInsert() > 0 ? sequence : string.Empty;
            return returnValue;
        }
 /// <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();
 }
        // 这个是声明扩展方法
partial         void SetEntityExpand(SQLBuilder sqlBuilder, BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity);
 /// <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="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();
 }
示例#23
0
 public int Update(string id, string folderId, string fileName, string description, bool enabled, out string statusCode)
 {
     statusCode = string.Empty;
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     sqlBuilder.BeginUpdate(this.CurrentTableName);
     sqlBuilder.SetValue(BaseFileEntity.FieldFolderId, folderId);
     sqlBuilder.SetValue(BaseFileEntity.FieldFileName, fileName);
     sqlBuilder.SetValue(BaseFileEntity.FieldEnabled, enabled);
     sqlBuilder.SetValue(BaseFileEntity.FieldDescription, description);
     sqlBuilder.SetValue(BaseFileEntity.FieldModifiedUserId, UserInfo.Id);
     sqlBuilder.SetValue(BaseFileEntity.FieldModifiedBy, UserInfo.RealName);
     sqlBuilder.SetDBNow(BaseFileEntity.FieldModifiedOn);
     sqlBuilder.SetWhere(BaseFileEntity.FieldId, id);
     int returnValue = sqlBuilder.EndUpdate();
     if (returnValue > 0)
     {
         statusCode = StatusCode.OKUpdate.ToString();
     }
     else
     {
         statusCode = StatusCode.ErrorDeleted.ToString();
     }
     return returnValue;
 }
        // 这个是声明扩展方法
partial         void SetEntityExpand(SQLBuilder sqlBuilder, BaseWorkFlowCurrentEntity baseWorkFlowCurrentEntity);
 /// <summary>
 /// 更新实体
 /// </summary>
 /// <param name="BaseWorkFlowStepEntity">实体</param>
 public int UpdateEntity(BaseWorkFlowStepEntity BaseWorkFlowStepEntity)
 {
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     sqlBuilder.BeginUpdate(this.CurrentTableName);
     this.SetEntity(sqlBuilder, BaseWorkFlowStepEntity);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldModifiedUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseWorkFlowStepEntity.FieldModifiedBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseWorkFlowStepEntity.FieldModifiedOn);
     sqlBuilder.SetWhere(BaseWorkFlowStepEntity.FieldId, BaseWorkFlowStepEntity.Id);
     return sqlBuilder.EndUpdate();
 }
 /// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="baseMessageEntity">实体</param>
 public string AddEntity(BaseMessageEntity baseMessageEntity)
 {
     string sequence = string.Empty;
     this.Identity = false;
     if (baseMessageEntity.SortCode == null || baseMessageEntity.SortCode == 0)
     {
         BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
         sequence = sequenceManager.GetSequence(this.CurrentTableName);
         baseMessageEntity.SortCode = int.Parse(sequence);
     }
     if (baseMessageEntity.Id != null)
     {
         sequence = baseMessageEntity.Id.ToString();
     }
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper, this.Identity, this.ReturnId);
     sqlBuilder.BeginInsert(this.CurrentTableName, BaseMessageEntity.FieldId);
     if (!this.Identity)
     {
         if (string.IsNullOrEmpty(baseMessageEntity.Id))
         {
             sequence = BaseBusinessLogic.NewGuid();
             baseMessageEntity.Id = sequence ;
         }
         sqlBuilder.SetValue(BaseMessageEntity.FieldId, baseMessageEntity.Id);
     }
     else
     {
         if (!this.ReturnId && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2))
         {
             if (DbHelper.CurrentDbType == DbTypes.Oracle)
             {
                 sqlBuilder.SetFormula(BaseMessageEntity.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
             }
             if (DbHelper.CurrentDbType == DbTypes.DB2)
             {
                 sqlBuilder.SetFormula(BaseMessageEntity.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
             }
         }
         else
         {
             if (this.Identity && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2))
             {
                 if (string.IsNullOrEmpty(baseMessageEntity.Id))
                 {
                     if (string.IsNullOrEmpty(sequence))
                     {
                         BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
                         sequence = sequenceManager.GetSequence(this.CurrentTableName);
                     }
                     baseMessageEntity.Id = sequence;
                 }
                 sqlBuilder.SetValue(BaseMessageEntity.FieldId, baseMessageEntity.Id);
             }
         }
     }
     this.SetEntity(sqlBuilder, baseMessageEntity);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseMessageEntity.FieldCreateUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseMessageEntity.FieldCreateBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseMessageEntity.FieldCreateOn);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseMessageEntity.FieldModifiedUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseMessageEntity.FieldModifiedBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseMessageEntity.FieldModifiedOn);
     if (this.Identity && (DbHelper.CurrentDbType == DbTypes.SqlServer || DbHelper.CurrentDbType == DbTypes.Access))
     {
         sequence = sqlBuilder.EndInsert().ToString();
     }
     else
     {
         sqlBuilder.EndInsert();
     }
     return sequence;
 }
        /// <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;
        }
示例#28
0
 private int UpdateReadCount(string id)
 {
     // 阅读次数要加一
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     sqlBuilder.BeginUpdate(this.CurrentTableName);
     sqlBuilder.SetFormula(BaseFileEntity.FieldReadCount, BaseFileEntity.FieldReadCount + " + 1 ");
     sqlBuilder.SetWhere(BaseFileEntity.FieldId, id);
     return sqlBuilder.EndUpdate();
 }
partial         void SetEntityExpand(SQLBuilder sqlBuilder, BasePermissionScopeEntity permissionScopeEntity);
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="baseWorkFlowProcessEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseWorkFlowProcessEntity baseWorkFlowProcessEntity)
 {
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldUserId, baseWorkFlowProcessEntity.UserId);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldOrganizeId, baseWorkFlowProcessEntity.OrganizeId);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldBillTemplateId, baseWorkFlowProcessEntity.BillTemplateId);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldAuditCategoryCode, baseWorkFlowProcessEntity.AuditCategoryCode);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldCallBackClass, baseWorkFlowProcessEntity.CallBackClass);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldCallBackTable, baseWorkFlowProcessEntity.CallBackTable);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldCategoryCode, baseWorkFlowProcessEntity.CategoryCode);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldCode, baseWorkFlowProcessEntity.Code);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldFullName, baseWorkFlowProcessEntity.FullName);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldContents, baseWorkFlowProcessEntity.Contents);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldSortCode, baseWorkFlowProcessEntity.SortCode);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldEnabled, baseWorkFlowProcessEntity.Enabled);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldDeletionStateCode, baseWorkFlowProcessEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseWorkFlowProcessEntity.FieldDescription, baseWorkFlowProcessEntity.Description);
 }