예제 #1
0
파일: Audit.cs 프로젝트: radtek/ClearView
        public string GetErrorBody(int _requestid, int _serviceid, int _number)
        {
            DataSet       ds        = GetError(_requestid, _serviceid, _number);
            Users         oUser     = new Users(0, dsn);
            Requests      oRequest  = new Requests(0, dsn);
            Servers       oServer   = new Servers(0, dsn);
            StringBuilder sbDetails = new StringBuilder();

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr       = ds.Tables[0].Rows[0];
                int     intUser  = oRequest.GetUser(_requestid);
                int     intAudit = Int32.Parse(ds.Tables[0].Rows[0]["auditid"].ToString());
                DataSet dsAudit  = GetServer(intAudit);
                if (dsAudit.Tables[0].Rows.Count > 0)
                {
                    int intServer = Int32.Parse(dsAudit.Tables[0].Rows[0]["serverid"].ToString());
                    sbDetails.Append("<tr><td colspan=\"5\"><b>SERVER: &nbsp;" + oServer.GetName(intServer, true) + "</b></td></tr>");
                    sbDetails.Append("<tr><td colspan=\"5\"><b>SCRIPT: &nbsp;" + dsAudit.Tables[0].Rows[0]["name"].ToString() + "</b></td></tr>");
                    sbDetails.Append("<tr>");
                    sbDetails.Append("<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>");
                    sbDetails.Append("<td><b>Status</b></td>");
                    sbDetails.Append("<td><b>Code</b></td>");
                    sbDetails.Append("<td><b>Result</b></td>");
                    sbDetails.Append("<td><b>Date</b></td>");
                    sbDetails.Append("</tr>");
                    try
                    {
                        DataSet dsAuditResult = GetServerDetailsRemote(intAudit);
                        foreach (DataRow drAuditResult in dsAuditResult.Tables[0].Rows)
                        {
                            sbDetails.Append("<tr>");
                            sbDetails.Append("<td></td>");
                            try
                            {
                                int         intAuditStatus = Int32.Parse(drAuditResult["status"].ToString());
                                AuditStatus oAuditStatus   = (AuditStatus)intAuditStatus;
                                sbDetails.Append("<td valign=\"top\" nowrap>" + oAuditStatus.ToString() + "</td>");
                            }
                            catch
                            {
                                sbDetails.Append("<td valign=\"top\" nowrap>Unknown Status (" + drAuditResult["status"].ToString() + ")</td>");
                            }
                            sbDetails.Append("<td valign=\"top\" nowrap>" + drAuditResult["code"].ToString() + "</td>");
                            sbDetails.Append("<td valign=\"top\" width=\"100%\">" + drAuditResult["result"].ToString() + "</td>");
                            sbDetails.Append("<td valign=\"top\" nowrap>" + drAuditResult["created"].ToString() + "</td>");
                            sbDetails.Append("</tr>");
                        }
                    }
                    catch { }
                }
            }
            return(sbDetails.ToString());
        }
예제 #2
0
        /// <summary>
        /// 设置用户审核状态
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <param name="auditStates">审核状态</param>
        /// <returns>影响行数</returns>
        public int SetUserAuditStates(BaseUserInfo userInfo, string[] ids, AuditStatus auditStates)
        {
            // 写入调试信息
            #if (DEBUG)
                int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
                LogOnService.UserIsLogOn(userInfo);
            #endif

            int returnValue = 0;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo);
                    returnValue = userManager.SetProperty(ids, new KeyValuePair<string, object>(BaseUserEntity.FieldAuditStatus, auditStates.ToString()));
                    // 被审核通过
                    if (auditStates == AuditStatus.AuditPass)
                    {
                        returnValue = userManager.SetProperty(ids, new KeyValuePair<string, object>(BaseUserEntity.FieldEnabled, 1));
                        // returnValue = userManager.SetProperty(ids, BaseUserEntity.FieldAuditStatus, StatusCode.UserIsActivate.ToString());
                    }
                    // 被退回
                    if (auditStates == AuditStatus.AuditReject)
                    {
                        returnValue = userManager.SetProperty(ids, new KeyValuePair<string, object>(BaseUserEntity.FieldEnabled, 0));
                        returnValue = userManager.SetProperty(ids, new KeyValuePair<string, object>(BaseUserEntity.FieldAuditStatus, StatusCode.UserLocked.ToString()));
                    }
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.UserService_SetUserAuditStates, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
                BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return returnValue;
        }
예제 #3
0
        /// <summary>
        /// 设置用户审核状态
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <param name="auditStates">审核状态</param>
        /// <returns>影响行数</returns>
        public int SetUserAuditStates(BaseUserInfo userInfo, string[] ids, AuditStatus auditStates)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            int returnValue = 0;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo);
                    returnValue = userManager.SetProperty(ids, new KeyValuePair <string, object>(BaseUserEntity.FieldAuditStatus, auditStates.ToString()));
                    // 被审核通过
                    if (auditStates == AuditStatus.AuditPass)
                    {
                        returnValue = userManager.SetProperty(ids, new KeyValuePair <string, object>(BaseUserEntity.FieldEnabled, 1));
                        // returnValue = userManager.SetProperty(ids, BaseUserEntity.FieldAuditStatus, StatusCode.UserIsActivate.ToString());
                    }
                    // 被退回
                    if (auditStates == AuditStatus.AuditReject)
                    {
                        returnValue = userManager.SetProperty(ids, new KeyValuePair <string, object>(BaseUserEntity.FieldEnabled, 0));
                        returnValue = userManager.SetProperty(ids, new KeyValuePair <string, object>(BaseUserEntity.FieldAuditStatus, StatusCode.UserLocked.ToString()));
                    }
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.UserService_SetUserAuditStates, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(returnValue);
        }
예제 #4
0
 /// <summary>
 /// 获取审核状态
 /// </summary>
 /// <param name="auditStatus"></param>
 /// <returns></returns>
 public static string GetAuditStatus(AuditStatus auditStatus)
 {
     return(GetAuditStatus(auditStatus.ToString()));
 }
예제 #5
0
        /// <summary>
        /// 设置用户主管的审核状态
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <param name="auditStates">审核状态</param>
        /// <returns>影响行数</returns>
        public int SetUserManagerAuditStates(BaseUserInfo userInfo, string[] ids, AuditStatus auditStates)
        {
            int result = 0;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                var userManager = new BaseUserManager(dbHelper, userInfo);
                // 被审核通过
                if (auditStates == AuditStatus.AuditPass)
                {
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldManagerAuditStatus, auditStates.ToString()));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldManagerAuditDate, DateTime.Now));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldEnabled, 1));
                    result = userManager.SetProperty(ids, parameters);

                    // 锁定时间需要去掉
                    // 密码错误次数需要修改掉
                    var userLogOnManager = new BaseUserLogOnManager(dbHelper, userInfo);
                    parameters           = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldLockStartDate, null));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldLockEndDate, null));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldUserOnLine, 0));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldPasswordErrorCount, 0));
                    result = userLogOnManager.SetProperty(ids, parameters);

                    // var staffManager = new BaseStaffManager(dbHelper, result);
                    // string[] staffIds = staffManager.GetIds(BaseStaffEntity.FieldUserId, ids);
                    // staffManager.SetProperty(staffIds, new KeyValuePair<string, object>(BaseStaffEntity.FieldEnabled, 1));
                }
                // 被退回
                if (auditStates == AuditStatus.AuditReject)
                {
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldManagerAuditStatus, auditStates.ToString()));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldManagerAuditDate, DateTime.Now));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldEnabled, 0));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldAuditStatus, auditStates.ToString()));
                    result = userManager.SetProperty(ids, parameters);
                }
            });

            return(result);
        }
예제 #6
0
        /// <summary>
        /// 设置用户审核状态
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <param name="auditStates">审核状态</param>
        /// <returns>影响行数</returns>
        public int SetUserAuditStates(UserInfo userInfo, string[] ids, AuditStatus auditStates)
        {
            int returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.UserService_SetUserAuditStates);

            ServiceUtil.ProcessRDIWriteDbWithTran(userInfo, parameter, dbProvider =>
            {
                var userManager = new PiUserManager(dbProvider, userInfo);
                returnValue     = userManager.SetProperty(ids, PiUserTable.FieldAuditStatus, auditStates.ToString());
                // 被审核通过
                if (auditStates == AuditStatus.AuditPass)
                {
                    returnValue = userManager.SetProperty(ids, PiUserTable.FieldEnabled, 1);
                    // returnValue = userManager.SetProperty(ids, BaseUserEntity.FieldAuditStatus, StatusCode.UserIsActivate.ToString());
                }
                // 被退回
                if (auditStates == AuditStatus.AuditReject)
                {
                    returnValue = userManager.SetProperty(ids, PiUserTable.FieldEnabled, 0);
                    returnValue = userManager.SetProperty(ids, PiUserTable.FieldAuditStatus, StatusCode.UserLocked.ToString());
                }
            });
            return(returnValue);
        }
예제 #7
0
 public static string GetAuditStatus(AuditStatus auditStatus)
 {
     return GetAuditStatus(auditStatus.ToString());
 }