Ejemplo n.º 1
0
 public CNew(CToken tok, CToken classname, CParameters @params)
     : base(tok, classname)
 {
     this.classname = classname;
     this.@params = @params;
     [email protected] = this;
 }
Ejemplo n.º 2
0
//        private static bool m_debugContextInitalized = false;

        public GameBoy()
        {
            m_parameters = new CParameters();
            LoadParameters();
            m_DebugThread = new System.Threading.Thread(DebuggerThread);
            m_DebugThread.Start();
//          m_debugContextInitalized = false;

            m_timer = new GameBoyTest.MicroTimer.MicroTimer();

            m_BGScreen     = new GBScreenForm(GameBoy.Ram);
            m_memory       = new MappedMemory();
            m_cartridge    = new Cartridge();
            m_sbDebug      = new SB_Debug();
            m_inputsMgr    = new InputsMgr();
            m_video        = new GBVideo(m_BGScreen);
            m_soundManager = new SoundManager();
            m_cpu          = new Z80Cpu(m_timer);

            m_bDebuggerEnabled = false;

            m_cpu.Init();
            m_video.Init();
            m_sbDebug.Init();
            //sDebugReady = false;

            //m_cpu.Start();
            m_video.Start();
            Application.Run();
            System.Windows.Forms.Application.Exit();
        }
Ejemplo n.º 3
0
        private bool UpdateConfigValueByName(string name, string value)
        {
            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras    = new CParameters();
                SqlParameter paraName = new SqlParameter("@Name", name);
                paras.Add(paraName);
                SqlParameter paraValue = new SqlParameter("@Value", value);
                paras.Add(paraValue);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.prc_ModifyCommon", out ds, out strError))
                    {
                        Log4netHelper.Error("prc_ModifyCommon 执行错误,Error:" + strError);
                        bResult = false;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 1:
                                bResult = true;
                                break;

                            default:
                                bResult = false;
                                break;
                            }
                        }
                        else
                        {
                            bResult = false;
                            break;
                        }
                    }
                    else
                    {
                        bResult = false;
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                Log4netHelper.Error(string.Format("UpdateConfigValueByName 异常:{0}", ex.ToString()));
                bResult = false;
            }
            return(bResult);
        }
Ejemplo n.º 4
0
 public CAttribute(CToken name, CParameters parameters, CTypeRef ctr)
     : base(name)
 {
     this.name = name.Value;
     nameToken = name;
     this.parameters = parameters ?? new CParameters();
     LoadType(new CTypeRef(this, ctr));
 }
Ejemplo n.º 5
0
        public bool GetMailDataBaseBydistinguishedName(Guid transactionid, string distinguishedName, out List <MailDataBaseInfo> list, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            list  = new List <MailDataBaseInfo>();
            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras = new CParameters();
                SqlParameter paraDistinguishedName = new SqlParameter("@distinguishedName", distinguishedName);
                paras.Add(paraDistinguishedName);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_GetMailboxDBBydistinguishedName]", out ds, out strError))
                    {
                        strError   = "prc_GetMailboxDBBydistinguishedName数据库执行失败,Error:" + strError;
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }

                    if (ds != null && ds.Tables.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            DataRow          sdr  = ds.Tables[0].Rows[i];
                            MailDataBaseInfo info = new MailDataBaseInfo();
                            info.ID     = Guid.Parse(Convert.ToString(sdr["ID"]));
                            info.OuID   = Guid.Parse(Convert.ToString(sdr["OuID"]));
                            info.OuName = Convert.ToString(sdr["OuName"]);
                            info.OUdistinguishedName = Convert.ToString(sdr["OUdistinguishedName"]);
                            info.MailboxDBID         = Guid.Parse(Convert.ToString(sdr["MailboxDBID"]));
                            info.MailboxDB           = Convert.ToString(sdr["MailboxDB"]);
                            info.MailboxServer       = Convert.ToString(sdr["MailboxServer"]);
                            info.CreateTime          = Convert.ToDateTime(sdr["CreateTime"]);
                            list.Add(info);
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("数据库执行prc_GetMailboxDBBydistinguishedName失败", string.Empty, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("MailDataBaseDBProvider调用prc_GetMailboxDBBydistinguishedName异常", string.Empty, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 6
0
 public CDefaultAccess(CToken tok, CAccess item, CParameters parameters)
     : base(tok, tok)
 {
     m_targetAccess = item;
     m_targetAccess.Parent = this;
     this.parameters = parameters;
     this.parameters.Parent = this;
     item.IsCallExplicit = true;
     IsRootAccess = false;
 }
Ejemplo n.º 7
0
 public CVariable(CToken name, bool shared, CTypeRef tref, CParameters arrayDimsinit, CExpression init, CDim parent)
     : base(name, shared)
 {
     this.dim = parent;
     this.name = name;
     base.LoadType(tref);
     this.init = init;
     if (init != null)
         init.Parent = this;
     member = false;
     this.arrayDimsinit = arrayDimsinit;
 }
Ejemplo n.º 8
0
        private void SyncSystemMailCount(DateTime startTime, DateTime endTime)
        {
            ExchangeWebservice.ManagerWebService service = new ExchangeWebservice.ManagerWebService();
            service.Timeout = -1;
            //DateTime startTime = new DateTime(DateTime.Now.AddDays(-1).Year, DateTime.Now.AddDays(-1).Month, DateTime.Now.AddDays(-1).Day, 0, 0, 1);
            //DateTime endTime = new DateTime(DateTime.Now.AddDays(-1).Year, DateTime.Now.AddDays(-1).Month, DateTime.Now.AddDays(-1).Day, 23, 23, 59);
            int    iSendMailCount    = 0;
            int    iReceiveMailCount = 0;
            string strError          = string.Empty;

            try
            {
                if (!service.GetServerMailCount(startTime, endTime, out iSendMailCount, out iReceiveMailCount, out strError))
                {
                    Log4netHelper.Error("获取系统邮件个数, error:" + strError);
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.Error("获取系统邮件个数, Exception:" + ex.ToString());
            }


            try
            {
                CParameters  parameters   = new CParameters();
                SqlParameter paraDateTime = new SqlParameter("@TotalDate", startTime);
                parameters.Add(paraDateTime);
                SqlParameter paraSendCount = new SqlParameter("@SendMailCount", iSendMailCount);
                parameters.Add(paraSendCount);
                SqlParameter paraReceiveCount = new SqlParameter("@ReceiveMailCount", iReceiveMailCount);
                parameters.Add(paraReceiveCount);

                int iResult = 1;

                if (!m_db.ExcuteByTransaction(parameters, "dbo.prc_InsertADSystemMailCount", out iResult, out strError))
                {
                    Log4netHelper.Error("系统邮件个数存入数据库, error:" + strError);
                }

                if (iResult == -1)
                {
                    Log4netHelper.Error("系统邮件个数存入数据库, error: 调用存储过程 spInsertADSystemMailCount 返回值-1");
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.Error("系统邮件个数存入数据库, Exception:" + ex.ToString());
            }
        }
Ejemplo n.º 9
0
        private bool GetDC(ref string dcName)
        {
            string strError = string.Empty;
            bool   bResult  = true;

            if (!GetAvailabilityDC(dcName))
            {
                #region 参数变量
                CParameters  paras       = new CParameters();
                SqlParameter paraSpareDC = new SqlParameter("@Name", "SpareDC");
                paras.Add(paraSpareDC);
                #endregion

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                DataSet ds  = null;
                if (!_db.ExcuteByTransaction(paras, "[prc_GetCommonDataByName]", out ds, out strError))
                {
                    strError = "执行存储过程GetConfigValueByNameByProc异常";
                    bResult  = false;
                }
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string dc = Convert.ToString(ds.Tables[0].Rows[0]["Comm_Value"]);
                        if (GetAvailabilityDC(dc))
                        {
                            UpdateConfigValueByName("AD_DC", dc);
                            dcName = dc;
                            break;
                        }
                    }

                    bResult = true;
                }
                else
                {
                    strError = "执行存储过程GetConfigValueByNameByProc,输出的DataSet为空或无效";
                    bResult  = false;
                }

                return(bResult);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 10
0
        private bool GetConfigValueByNameByProc(string name, out string value, out string strError)
        {
            bool bResult = true;

            strError = string.Empty;
            value    = string.Empty;
            try
            {
                #region 参数变量
                CParameters  paras       = new CParameters();
                SqlParameter paraAccount = new SqlParameter("@Name", name);
                paras.Add(paraAccount);
                #endregion

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                DataSet ds  = null;
                if (!_db.ExcuteByTransaction(paras, "[prc_GetCommonDataByName]", out ds, out strError))
                {
                    strError = "执行存储过程GetConfigValueByNameByProc异常";
                    bResult  = false;
                }
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    value = Convert.ToString(ds.Tables[0].Rows[0]["Comm_Value"]);
                    if (name == "AD_DC")
                    {
                        lock (o)
                        {
                            //判断DC有效性
                            GetDC(ref value);
                        }
                    }
                    bResult = true;
                }
                else
                {
                    strError = "执行存储过程GetConfigValueByNameByProc,输出的DataSet为空或无效";
                    bResult  = false;
                }
            }
            catch (Exception ex)
            {
                strError = "接口方法GetConfigValueByNameByProc异常,error:" + ex.ToString();
                bResult  = false;
            }
            return(bResult);
        }
Ejemplo n.º 11
0
        private static bool GetConfigValueByNameByProc(string name, out List <string> list, out string strError)
        {
            bool bResult = true;

            strError = string.Empty;
            list     = new List <string>();
            try
            {
                #region 参数变量
                CParameters  paras       = new CParameters();
                SqlParameter paraAccount = new SqlParameter("@Name", name);
                paras.Add(paraAccount);
                #endregion

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                DataSet ds  = null;
                if (!_db.ExcuteByTransaction(paras, "[prc_GetCommonDataByName]", out ds, out strError))
                {
                    strError = "执行存储过程GetConfigValueByNameByProc异常";
                    bResult  = false;
                }
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string value = Convert.ToString(dr["Comm_Value"]);
                        list.Add(value);
                    }
                    bResult = true;
                }
                else
                {
                    strError = "执行存储过程GetConfigValueByNameByProc,输出的DataSet为空或无效";
                    bResult  = false;
                }
            }
            catch (Exception ex)
            {
                strError = "接口方法GetConfigValueByNameByProc异常,error:" + ex.ToString();
                bResult  = false;
            }
            return(bResult);
        }
Ejemplo n.º 12
0
        public bool Load(out string strError)
        {
            strError = string.Empty;
            bool bResult = true;
            int  count   = 10;

            do
            {
                count--;
                if (!m_db.ExcuteBySql(" truncate table dbo.[T_Base_Temp_ADUser]", out strError))
                {
                    Log4netHelper.Error(" *********************清空User信息失败, error:" + strError);
                    return(false);
                }

                bResult = run();
            } while (!bResult && count != 0);

            if (count == 0 && !bResult)
            {
                strError = "*********************获取AD数据失败**********";
                Log4netHelper.Error(strError);
                return(false);
            }

            CParameters parametersUser = new CParameters();

            if (!m_db.ExcuteByTransaction(parametersUser, "prc_TranscationUserData", out strError))
            {
                Log4netHelper.Error(" *********************导入User信息失败, error:" + strError);
                return(false);
            }

            SyncUserMailSize();

            SyncSystemMailCount();

            SyncUserMailCount();

            return(true);
        }
Ejemplo n.º 13
0
        public bool GetMailAuditList(Guid transactionid, AdminInfo admin, int curpage, int pagesize, string searchstr, out BaseListInfo lists, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            lists = new BaseListInfo();
            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras       = new CParameters();
                SqlParameter paraAdminID = new SqlParameter("@AdminID", admin.UserID);
                paras.Add(paraAdminID);
                SqlParameter paraPageIndex = new SqlParameter("@PageIndex", curpage);
                paras.Add(paraPageIndex);
                SqlParameter paraPageSize = new SqlParameter("@PageSize", pagesize);
                paras.Add(paraPageSize);
                SqlParameter paraSearchstr = new SqlParameter("@Searchstr", $"%{searchstr}%");
                paras.Add(paraSearchstr);
                SqlParameter paraRecordCount = new SqlParameter("@RecordCount", SqlDbType.Int);
                paraRecordCount.Direction = ParameterDirection.Output;
                paras.Add(paraRecordCount);
                SqlParameter paraPageCount = new SqlParameter("@PageCount", SqlDbType.Int);
                paraPageCount.Direction = ParameterDirection.Output;
                paras.Add(paraPageCount);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_GetMailAuditList]", out ds, out strError))
                    {
                        strError   = "prc_GetMailAuditList数据库执行失败,Error:" + strError;
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }

                    lists.RecordCount = (int)paraRecordCount.Value;
                    lists.PageCount   = (int)paraPageCount.Value;

                    if (ds != null && ds.Tables.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            DataRow       sdr  = ds.Tables[0].Rows[i];
                            MailAuditInfo info = new MailAuditInfo();
                            info.ID                = Guid.Parse(Convert.ToString(sdr["ID"]));
                            info.Group.GroupID     = Guid.Parse(Convert.ToString(sdr["GroupID"]));
                            info.Group.DisplayName = Convert.ToString(sdr["GroupName"]);
                            info.Group.Account     = Convert.ToString(sdr["GroupAccount"]);
                            info.CreateTime        = Convert.ToDateTime(sdr["CreateTime"]);
                            info.UpdateTime        = Convert.ToDateTime(sdr["UpdateTime"]);
                            info.CreateUserID      = Guid.Parse(Convert.ToString(sdr["CreateUserID"]));
                            info.RoleID            = Guid.Parse(Convert.ToString(sdr["RoleID"]));

                            DataRow[] drArr = ds.Tables[1].Select("MailAuditID='" + info.ID + "'");

                            foreach (DataRow dr in drArr)
                            {
                                UserInfo user = new UserInfo();
                                user.UserID      = Guid.Parse(Convert.ToString(dr["UserID"]));
                                user.DisplayName = Convert.ToString(dr["DisplayName"]);
                                user.UserAccount = Convert.ToString(dr["Account"]);
                                info.Audits.Add(user);
                                info.AuditUsers += user.DisplayName + "(" + user.UserAccount + "),";
                            }

                            info.AuditUsers = string.IsNullOrEmpty(info.AuditUsers) ? string.Empty : info.AuditUsers.Remove(info.AuditUsers.LastIndexOf(','), 1);
                            lists.Lists.Add(info);
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("数据库执行prc_GetMailAuditList失败", string.Empty, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("MailAuditDBProvider调用prc_GetMailAuditList异常", string.Empty, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 14
0
        public bool AddMailAudit(Guid transactionid, AdminInfo admin, ref MailAuditInfo mailAuditInfo, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            string paramstr = string.Empty;

            paramstr += $"AdminID:{admin.UserID}";
            paramstr += $"||AdminAccount:{admin.UserAccount}";
            paramstr += $"||GroupID:{mailAuditInfo.Group.GroupID}";

            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras       = new CParameters();
                SqlParameter paraGroupID = new SqlParameter("@GroupID", mailAuditInfo.Group.GroupID);
                paras.Add(paraGroupID);
                SqlParameter paraGroupName = new SqlParameter("@GroupName", mailAuditInfo.Group.DisplayName);
                paras.Add(paraGroupName);
                SqlParameter paraGroupAccount = new SqlParameter("@GroupAccount", mailAuditInfo.Group.Account);
                paras.Add(paraGroupAccount);
                SqlParameter paraRoleID = new SqlParameter("@RoleID", admin.RoleID);
                paras.Add(paraRoleID);
                SqlParameter paraUserID = new SqlParameter("@CreateUserID", admin.UserID);
                paras.Add(paraUserID);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_AddMailAudit]", out ds, out strError))
                    {
                        strError = "AddMailAudit异常,Error:" + strError;
                        LoggerHelper.Error("MailAuditDBProvider调用AddMailAudit异常", paramstr, strError, transactionid);
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 1:
                                bResult = true;
                                if (ds.Tables.Count > 1)
                                {
                                    DataRow sdr = ds.Tables[1].Rows[0];
                                    mailAuditInfo.ID = Guid.Parse(Convert.ToString(sdr["ID"]));
                                }
                                break;

                            case -1:
                                bResult    = false;
                                error.Code = ErrorCode.HaveSameGroup;
                                break;

                            case -9999:
                                bResult    = false;
                                error.Code = ErrorCode.SQLException;
                                LoggerHelper.Error("MailAuditDBProvider调用AddMailAudit异常", paramstr, "-9999", transactionid);
                                break;

                            default:
                                bResult    = false;
                                error.Code = ErrorCode.Exception;
                                break;
                            }
                        }
                        else
                        {
                            bResult    = false;
                            error.Code = ErrorCode.Exception;
                            break;
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("MailAuditDBProvider调用AddMailAudit异常", paramstr, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("MailAuditDBProvider调用AddMailAudit异常", string.Empty, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 15
0
        public void VisitFile(CFile file)
        {
            if (!canGenerate(file))
            {
                return;
            }

            visitor.PreVisitFile(file);

            filenamesrc = file.Token;

            new CNewline(null).Accept(visitor);

            if (instrument)
            {
                COption cCodeCoverage =
                    new COption(new CToken(file.Filename, TokenTypes.keyword, "option"),
                                new CToken(file.Filename, TokenTypes.keyword, "include"),
                                new CToken(file.Filename, TokenTypes.str, "cCodeCoverage.asp"));
                cCodeCoverage.Accept(this);
            }

            visitor.VisitFile(file);

            if (file.Attributes.contains("GenerateProcessAjaxFunction"))
            {
                CFunction unicoderequest = CProgram.Global.FindFunction("unicoderequest");
                CFunction intrequest     = CProgram.Global.FindFunction("intrequest");
                CFunction boolrequest    = CProgram.Global.FindFunction("boolrequest");

                CToken    tok         = CreateTokenWithAdditionalInfo("ProcessAjax", "processajax", TokenTypes.identifier);
                CFunction processAjax =
                    new CFunction(tok, tok.RawValue, tok.Value, TokenTypes.visPublic, CFunction.vbSub, null,
                                  new CTypeRef(null, BuiltIns.Void));

                CAccess pivotitem = new CAccess(unicoderequest.Token, unicoderequest.Token);
                pivotitem.ReferenceTarget = unicoderequest;
                CParameters pivotparams = new CParameters();
                pivotparams.Unnamed.Add(
                    new CConstantExpression(CreateTokenWithAdditionalInfo("sFunction", TokenTypes.str)));
                CSelect select =
                    new CSelect(CreateTokenWithAdditionalInfo("select", TokenTypes.controlFlow),
                                new CDefaultAccess(pivotitem.Token, pivotitem, pivotparams));

                IEnumerator      it   = CProgram.Global.Functions.GetEnumerator();
                List <CVariable> vars = new List <CVariable>();
                while (it.MoveNext())
                {
                    CFunction func = (CFunction)it.Current;
                    if (!func.Attributes.contains("ExecuteOnServer"))
                    {
                        continue;
                    }

                    CStatementBlock block      = new CStatementBlock();
                    CParameters     funcParams = new CParameters();
                    for (int ixArg = 0; ixArg < func.Arguments.Count - 3; ixArg++)
                    {
                        CArgument arg = func.Arguments[ixArg];

                        tok =
                            CreateTokenWithAdditionalInfo("vParam" + (ixArg + 1), "vparam" + (ixArg + 1),
                                                          TokenTypes.identifier);
                        if (ixArg >= vars.Count)
                        {
                            vars.Add(new CVariable(tok, false, new CTypeRef(null, BuiltIns.Variant), null, null, null));
                        }

                        CAssignment assign = new CAssignment(tok);

                        CAccess left = new CAccess(tok, tok);
                        left.ReferenceTarget = vars[ixArg];
                        assign.Target        = left;
                        funcParams.Unnamed.Add(left);

                        CFunction rightfunc = intrequest;
                        if (arg.Type.RawName == "Boolean")
                        {
                            rightfunc = boolrequest;
                        }
                        else if (arg.Type.RawName == "String")
                        {
                            rightfunc = unicoderequest;
                        }

                        CParameters parameters = new CParameters();
                        parameters.Unnamed.Add(
                            new CConstantExpression(CreateTokenWithAdditionalInfo(tok.RawValue, TokenTypes.str)));

                        CAccess rightitem = new CAccess(rightfunc.Token, rightfunc.Token);
                        rightitem.ReferenceTarget = rightfunc;

                        assign.Source = new CDefaultAccess(rightfunc.Token, rightitem, parameters);
                        assign.Source.RhsAssignmentSource = true;

                        block.Add(assign);
                    }

                    CAccess        calledItem = new CAccess(func.Token, func.Token);
                    CDefaultAccess called     = new CDefaultAccess(func.Token, calledItem, funcParams);
                    calledItem.ReferenceTarget = calledItem.ReferenceTarget = func;

                    if (func.Attributes.contains("picture") || func.FunctionType == CFunction.vbFunction)
                    {
                        CAccess returnItem = new CAccess(processAjax.Token, processAjax.Token);
                        returnItem.ReferenceTarget = processAjax;

                        CAssignment assign = new CAssignment(processAjax.Token);
                        assign.Target = returnItem;

                        if (func.FunctionType == CFunction.vbFunction)
                        {
                            assign.Source = called;
                        }
                        else
                        {
                            assign.Source = new CPictureOfExpression(tok, called);
                        }

                        block.Add(assign);
                    }
                    else
                    {
                        block.Add(new CExpressionStatement(called));
                    }

                    tok = CreateTokenWithAdditionalInfo("case", TokenTypes.controlFlow);
                    CExpression exp =
                        new CConstantExpression(CreateTokenWithAdditionalInfo(func.RawName, TokenTypes.str));
                    select.Cases.Add(new CCase(tok, exp, block));
                }

                CDim dim = new CDim(CreateTokenWithAdditionalInfo("Dim", TokenTypes.declaration));
                dim.Variables.AddRange(vars);
                processAjax.Statements.Add(dim);
                processAjax.Statements.Add(select);

                CNewline nl = new CNewline(CreateTokenWithAdditionalInfo("\n", TokenTypes.newline));
                nl.Accept(this);
                processAjax.Accept(this);
                nl.Accept(this);
            }
        }
Ejemplo n.º 16
0
 public void VisitParameters(CParameters parameters)
 {
     visitor.VisitParameters(parameters);
 }
Ejemplo n.º 17
0
        public static bool AddSysLog(
            string UserAccount,
            String OperationName,
            String ParamInfo,
            String DetailInfo,
            String Result,
            Guid TransactionID
            )
        {
            bool   bResult  = true;
            string strError = string.Empty;

            try
            {
                CParameters  paras             = new CParameters();
                SqlParameter paraUserAccount   = new SqlParameter("@UserAccount", UserAccount);
                SqlParameter paraOperationName = new SqlParameter("@OperationName", OperationName);
                SqlParameter paraParamInfo     = new SqlParameter("@ParamInfo", ParamInfo);
                SqlParameter paraDetailInfo    = new SqlParameter("@DetailInfo", DetailInfo);
                SqlParameter paraResult        = new SqlParameter("@Result", Result);
                SqlParameter paraTransactionID = new SqlParameter("@TransactionID", TransactionID);

                paras.Add(paraUserAccount);
                paras.Add(paraOperationName);
                paras.Add(paraParamInfo);
                paras.Add(paraDetailInfo);
                paras.Add(paraResult);
                paras.Add(paraTransactionID);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    int     iResult = 0;
                    DataSet ds      = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_AddSysLog]", out iResult, out strError))
                    {
                        strError = "prc_AddSysLog数据库执行失败,Error:" + strError;
                        Log4netHelper.Error(strError);
                        bResult = false;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            switch (iResult)
                            {
                            case 0:
                                bResult = true;
                                break;

                            case -9999:
                                bResult = false;
                                break;

                            default:
                                bResult = false;
                                break;
                            }
                        }
                        else
                        {
                            bResult = false;
                            break;
                        }
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                Log4netHelper.Error(ex.ToString());
                bResult = false;
            }
            return(bResult);
        }
Ejemplo n.º 18
0
        public bool GetLogList(Guid transactionid, AdminInfo admin, int curpage, int pagesize, string account, DateTime startTime, DateTime endTime, string searchstr, out BaseListInfo lists, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            lists = new BaseListInfo();
            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras       = new CParameters();
                SqlParameter paraAdminID = new SqlParameter("@AdminID", admin.UserID);
                paras.Add(paraAdminID);
                SqlParameter paraPageIndex = new SqlParameter("@PageIndex", curpage);
                paras.Add(paraPageIndex);
                SqlParameter paraPageSize = new SqlParameter("@PageSize", pagesize);
                paras.Add(paraPageSize);
                SqlParameter paraAccount = new SqlParameter("@account", $"%{account}%");
                paras.Add(paraAccount);
                SqlParameter paraStartTime = new SqlParameter("@StartTime", startTime);
                paras.Add(paraStartTime);
                SqlParameter paraEndTime = new SqlParameter("@EndTime", endTime);
                paras.Add(paraEndTime);
                SqlParameter paraSearchstr = new SqlParameter("@Searchstr", $"%{searchstr}%");
                paras.Add(paraSearchstr);
                SqlParameter paraRecordCount = new SqlParameter("@RecordCount", SqlDbType.Int);
                paraRecordCount.Direction = ParameterDirection.Output;
                paras.Add(paraRecordCount);
                SqlParameter paraPageCount = new SqlParameter("@PageCount", SqlDbType.Int);
                paraPageCount.Direction = ParameterDirection.Output;
                paras.Add(paraPageCount);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_GetLogList]", out ds, out strError))
                    {
                        strError   = "prc_GetLogList数据库执行失败,Error:" + strError;
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }

                    lists.RecordCount = (int)paraRecordCount.Value;
                    lists.PageCount   = (int)paraPageCount.Value;

                    if (ds != null && ds.Tables.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            DataRow sdr  = ds.Tables[0].Rows[i];
                            LogInfo info = new LogInfo();
                            info.ID            = Guid.Parse(Convert.ToString(sdr["ID"]));
                            info.LogNum        = Convert.ToString(sdr["LogNum"]);
                            info.AdminID       = Guid.Parse(Convert.ToString(sdr["AdminID"]));
                            info.AdminAccount  = Convert.ToString(sdr["AdminAccount"]);
                            info.ClientIP      = Convert.ToString(sdr["ClientIP"]);
                            info.OperateLog    = Convert.ToString(sdr["OperateLog"]);
                            info.OperateResult = Convert.ToBoolean(sdr["OperateResult"]);
                            info.OperateTime   = Convert.ToDateTime(sdr["OperateTime"]);
                            info.OperateType   = Convert.ToString(sdr["OperateType"]);
                            info.RoleID        = Guid.Parse(Convert.ToString(sdr["RoleID"]));
                            lists.Lists.Add(info);
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("数据库执行prc_GetLogList失败", string.Empty, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("LogDBProvider调用prc_GetLogList异常", string.Empty, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 19
0
        private void EnsureDiminsionInitializerIsValid()
        {
            CDictionaryType dict = Type.ActualType as CDictionaryType;
            if (dict != null)
                return;

            CArrayType array = Type.ActualType as CArrayType;
            if (array == null || arrayDimsinit != null)
                return;

            int count = array.Dimensions;
            CParameters @params = new CParameters();
            for (int i = 0; i < count; i++)
                @params.Unnamed.Add(null);

            arrayDimsinit = @params;
        }
Ejemplo n.º 20
0
        public bool GetMailDataBaseInfo(Guid transactionid, AdminInfo admin, ref MailDataBaseInfo maildb, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            string paramstr = string.Empty;

            paramstr += $"ID:{maildb.ID}";
            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras      = new CParameters();
                SqlParameter paraUserID = new SqlParameter("@UserID", admin.UserID);
                paras.Add(paraUserID);
                SqlParameter paraID = new SqlParameter("@ID", maildb.ID);
                paras.Add(paraID);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_GetMailDataBaseInfo]", out ds, out strError))
                    {
                        strError = "GetMailDataBaseInfo异常,Error:" + strError;
                        LoggerHelper.Error("MailDataBaseDBProvider调用GetMailDataBaseInfo异常", paramstr, strError, transactionid);
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 1:
                                bResult = true;
                                if (ds.Tables.Count > 1)
                                {
                                    DataRow sdr = ds.Tables[1].Rows[0];
                                    maildb.MailboxDBID         = Guid.Parse(Convert.ToString(sdr["MailboxDBID"]));
                                    maildb.MailboxDB           = Convert.ToString(sdr["MailboxDB"]);
                                    maildb.MailboxServer       = Convert.ToString(sdr["MailboxServer"]);
                                    maildb.OuID                = Guid.Parse(Convert.ToString(sdr["OuID"]));
                                    maildb.OuName              = Convert.ToString(sdr["OuName"]);
                                    maildb.OUdistinguishedName = Convert.ToString(sdr["OUdistinguishedName"]);
                                    maildb.Status              = (State)Convert.ToInt32(sdr["Status"]);
                                    maildb.CreateTime          = Convert.ToDateTime(sdr["CreateTime"]);
                                    maildb.ID = Guid.Parse(Convert.ToString(sdr["ID"]));
                                }
                                break;

                            case -1:
                                bResult    = false;
                                error.Code = ErrorCode.IdEmpty;
                                break;

                            case -9999:
                                bResult    = false;
                                error.Code = ErrorCode.SQLException;
                                LoggerHelper.Error("MailDataBaseDBProvider调用GetMailDataBaseInfo异常", paramstr, "-9999", transactionid);
                                break;

                            default:
                                bResult    = false;
                                error.Code = ErrorCode.Exception;
                                break;
                            }
                        }
                        else
                        {
                            bResult    = false;
                            error.Code = ErrorCode.Exception;
                            break;
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("MailDataBaseDBProvider调用GetMailDataBaseInfo异常", paramstr, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("MailDataBaseDBProvider调用GetMailDataBaseInfo异常", string.Empty, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 21
0
        public bool ModifyUser(Guid transactionid, AdminInfo admin, UserInfo user, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            string paramstr = string.Empty;

            paramstr += $"AdminID:{admin.UserID}";
            paramstr += $"||AdminAccount:{admin.UserAccount}";
            paramstr += $"||UserID:{user.UserID}";
            paramstr += $"||UserAccount:{user.UserAccount}";
            paramstr += $"||UserDisplayName:{user.DisplayName}";
            paramstr += $"||UserFirstName:{user.FirstName}";
            paramstr += $"||UserLastName:{user.LastName}";
            paramstr += $"||DistinguishedName:{user.DistinguishedName}";

            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras      = new CParameters();
                SqlParameter paraUserID = new SqlParameter("@UserID", user.UserID);
                paras.Add(paraUserID);
                SqlParameter paraUserAccount = new SqlParameter("@UserAccount", user.UserAccount);
                paras.Add(paraUserAccount);
                SqlParameter paraDisplayName = new SqlParameter("@DisplayName", user.DisplayName);
                paras.Add(paraDisplayName);
                SqlParameter paraFirstName = new SqlParameter("@FirstName", user.FirstName);
                paras.Add(paraFirstName);
                SqlParameter paraLastName = new SqlParameter("@LastName", user.LastName);
                paras.Add(paraLastName);
                SqlParameter paraDistinguishedName = new SqlParameter("@DistinguishedName", user.DistinguishedName);
                paras.Add(paraDistinguishedName);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_ModifyUser]", out ds, out strError))
                    {
                        strError = "ModifyUser异常,Error:" + strError;
                        LoggerHelper.Error("UserDBProvider调用ModifyUser异常", paramstr, strError, transactionid);
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 1:
                                bResult = true;
                                break;

                            case -9999:
                                bResult    = false;
                                error.Code = ErrorCode.SQLException;
                                LoggerHelper.Error("UserDBProvider调用ModifyUser异常", paramstr, "-9999", transactionid);
                                break;

                            default:
                                bResult    = false;
                                error.Code = ErrorCode.Exception;
                                break;
                            }
                        }
                        else
                        {
                            bResult    = false;
                            error.Code = ErrorCode.Exception;
                            break;
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("UserDBProvider调用ModifyUser异常", paramstr, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("UserDBProvider调用ModifyUser异常", string.Empty, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 22
0
        public bool SendFUserMobileCode(Guid transactionid, Guid userid, string mobile, string code, out ErrorCodeInfo error)
        {
            bool bResult = true;

            error = new ErrorCodeInfo();
            string paramstr = string.Empty;

            paramstr += $"userid:{userid}";
            paramstr += $"||mobile:{mobile}";
            paramstr += $"||code:{code}";
            string strError = string.Empty;

            try
            {
                CParameters  paras      = new CParameters();
                SqlParameter paraUserID = new SqlParameter("@UserID", userid);
                SqlParameter paraMobile = new SqlParameter("@Mobile", mobile);
                SqlParameter paraCode   = new SqlParameter("@Code", code);
                paras.Add(paraUserID);
                paras.Add(paraMobile);
                paras.Add(paraCode);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_SendFUserMobileCode]", out ds, out strError))
                    {
                        strError = "prc_SendFUserMobileCode数据库执行失败,Error:" + strError;
                        LoggerHelper.Error("UserDBProvider调用SendFUserMobileCode异常", paramstr, strError, transactionid);
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }
                    else
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 0:
                                bResult = true;
                                break;

                            case -9999:
                                bResult    = false;
                                error.Code = ErrorCode.SQLException;
                                LoggerHelper.Error("UserDBProvider调用SendFUserMobileCode异常", paramstr, "-9999", transactionid);
                                break;

                            default:
                                bResult    = false;
                                error.Code = ErrorCode.Exception;
                                break;
                            }
                        }
                        else
                        {
                            bResult    = false;
                            error.Code = ErrorCode.Exception;
                            break;
                        }
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult = false;
                LoggerHelper.Error("UserDBProvider调用SendFUserMobileCode异常", paramstr, ex.ToString(), transactionid);
                error.Code = ErrorCode.Exception;
            }
            return(bResult);
        }
Ejemplo n.º 23
0
        public bool CheckFUserSmsByCodeID(Guid transactionid, Guid codeid, out Guid userid, out ErrorCodeInfo error)
        {
            bool bResult = true;

            error = new ErrorCodeInfo();
            string paramstr = string.Empty;

            paramstr += $"codeid:{codeid}";
            string strError = string.Empty;

            userid = Guid.Empty;
            try
            {
                CParameters  paras      = new CParameters();
                SqlParameter paraCodeID = new SqlParameter("@CodeID", codeid);
                paras.Add(paraCodeID);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_CheckFUserSmsByCodeID]", out ds, out strError))
                    {
                        strError = "prc_CheckFUserSmsByCodeID数据库执行失败,Error:" + strError;
                        LoggerHelper.Error("UserDBProvider调用CheckFUserSmsByCodeID异常", paramstr, strError, transactionid);
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }
                    else
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 0:
                                bResult = true;
                                break;

                            case -3:
                                bResult    = false;
                                error.Code = ErrorCode.SmsCodeWrong;
                                break;

                            case -4:
                                bResult    = false;
                                error.Code = ErrorCode.SmsCodeExpired;
                                break;

                            case -9999:
                                bResult    = false;
                                error.Code = ErrorCode.SQLException;
                                LoggerHelper.Error("UserDBProvider调用CheckFUserSmsByCodeID异常", paramstr, "-9999", transactionid);
                                break;

                            default:
                                bResult    = false;
                                error.Code = ErrorCode.Exception;
                                break;
                            }
                        }
                        else
                        {
                            bResult    = false;
                            error.Code = ErrorCode.Exception;
                            break;
                        }
                        if (ds.Tables.Count > 1)
                        {
                            for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
                            {
                                DataRow sdr = ds.Tables[1].Rows[i];
                                userid = Guid.Parse(Convert.ToString(sdr["UserID"]));
                            }
                        }
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult = false;
                LoggerHelper.Error("UserDBProvider调用CheckFUserSmsByCodeID异常", paramstr, ex.ToString(), transactionid);
                error.Code = ErrorCode.Exception;
            }
            return(bResult);
        }
Ejemplo n.º 24
0
        private void SyncUserMailSize()
        {
            ExchangeWebservice.ManagerWebService service = new ExchangeWebservice.ManagerWebService();
            service.Timeout = -1;
            string  strError = string.Empty;
            DataSet ds       = new DataSet();

            try
            {
                do
                {
                    //读取ad user
                    string strsql = "select sAMAccountName,UserPrincipalName from dbo.T_Base_ADUser";

                    if (!m_db.ExcuteByDataAdapter(strsql, out ds, out strError))
                    {
                        Log4netHelper.Error("获取User信息失败, Error:" + strError);
                        break;
                    }

                    //循环调用接口同步用户邮件个数
                    if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            //GB
                            long   mailSize     = 0;
                            long   usedMailSize = 0;
                            string databaseName = string.Empty;
                            string sizename     = string.Empty;
                            string usedsizename = string.Empty;

                            if (!service.GetUserMailSize(Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]), out sizename, out mailSize, out usedsizename, out usedMailSize, out databaseName, out strError))
                            {
                                Log4netHelper.Error(string.Format("获取用户邮箱空间, sAMAccountName:{0} UserPrincipalName:{1} error:{2}", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]), Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]), strError));
                                continue;
                            }
                            //添加到数据库
                            CParameters  parameters         = new CParameters();
                            SqlParameter parasAMAccountName = new SqlParameter("@sAMAccountName", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]));
                            parameters.Add(parasAMAccountName);
                            SqlParameter paraSizeName = new SqlParameter("@sizename", sizename);
                            parameters.Add(paraSizeName);
                            SqlParameter paraMailSize = new SqlParameter("@mailSize", mailSize);
                            parameters.Add(paraMailSize);
                            SqlParameter paraUsedSizeName = new SqlParameter("@usedsizename", usedsizename);
                            parameters.Add(paraUsedSizeName);
                            SqlParameter paraUsedMailSize = new SqlParameter("@usedMailSize", usedMailSize);
                            parameters.Add(paraUsedMailSize);
                            SqlParameter paraDatabaseName = new SqlParameter("@databaseName", databaseName);
                            parameters.Add(paraDatabaseName);

                            int iResult = 1;
                            if (!m_db.ExcuteByTransaction(parameters, "dbo.prc_UpdateADUserMailSize", out iResult, out strError))
                            {
                                Log4netHelper.Error(string.Format("用户已用空间存入数据库, sAMAccountName:{0} UserPrincipalName:{1} error:{2}", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]), Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]), strError));
                                continue;
                            }
                        }
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                Log4netHelper.Error($"同步用户已用空间异常, Exception:{ex.ToString()}");
            }
        }
Ejemplo n.º 25
0
        public bool GetMailAuditInfo(Guid transactionid, AdminInfo admin, ref MailAuditInfo mailAuditInfo, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            string paramstr = string.Empty;

            paramstr += $"AdminID:{admin.UserID}";
            paramstr += $"||ID:{mailAuditInfo.ID}";
            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras       = new CParameters();
                SqlParameter paraAdminID = new SqlParameter("@AdminID", admin.UserID);
                paras.Add(paraAdminID);
                SqlParameter paraID = new SqlParameter("@ID", mailAuditInfo.ID);
                paras.Add(paraID);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_GetMailAuditInfo]", out ds, out strError))
                    {
                        strError = "GetMailAuditInfo异常,Error:" + strError;
                        LoggerHelper.Error("MailAuditDBProvider调用GetMailAuditInfo异常", paramstr, strError, transactionid);
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 1:
                                bResult = true;
                                if (ds.Tables.Count > 1)
                                {
                                    DataRow sdr = ds.Tables[1].Rows[0];
                                    mailAuditInfo.ID                = Guid.Parse(Convert.ToString(sdr["ID"]));
                                    mailAuditInfo.Group.GroupID     = Guid.Parse(Convert.ToString(sdr["GroupID"]));
                                    mailAuditInfo.Group.DisplayName = Convert.ToString(sdr["GroupName"]);
                                    mailAuditInfo.Group.Account     = Convert.ToString(sdr["GroupAccount"]);
                                    mailAuditInfo.CreateTime        = Convert.ToDateTime(sdr["CreateTime"]);
                                    mailAuditInfo.UpdateTime        = Convert.ToDateTime(sdr["UpdateTime"]);
                                    mailAuditInfo.CreateUserID      = Guid.Parse(Convert.ToString(sdr["CreateUserID"]));
                                    mailAuditInfo.RoleID            = Guid.Parse(Convert.ToString(sdr["RoleID"]));

                                    foreach (DataRow dr in ds.Tables[2].Rows)
                                    {
                                        UserInfo user = new UserInfo();
                                        user.UserID      = Guid.Parse(Convert.ToString(dr["UserID"]));
                                        user.DisplayName = Convert.ToString(dr["DisplayName"]);
                                        user.UserAccount = Convert.ToString(dr["Account"]);
                                        mailAuditInfo.Audits.Add(user);
                                        mailAuditInfo.AuditUsers += user.DisplayName + "(" + user.UserAccount + "),";
                                    }

                                    mailAuditInfo.AuditUsers = mailAuditInfo.AuditUsers.Remove(mailAuditInfo.AuditUsers.LastIndexOf(','), 1);
                                }
                                break;

                            case -1:
                                bResult    = false;
                                error.Code = ErrorCode.HaveSameOu;
                                break;

                            case -9999:
                                bResult    = false;
                                error.Code = ErrorCode.SQLException;
                                LoggerHelper.Error("MailAuditDBProvider调用GetMailAuditInfo异常", paramstr, "-9999", transactionid);
                                break;

                            default:
                                bResult    = false;
                                error.Code = ErrorCode.Exception;
                                break;
                            }
                        }
                        else
                        {
                            bResult    = false;
                            error.Code = ErrorCode.Exception;
                            break;
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("SensitiveMailDBProvider调用GetSensitiveMailInfo异常", paramstr, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("SensitiveMailDBProvider调用GetSensitiveMailInfo异常", paramstr, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 26
0
        private void SyncUserMailCount(DateTime startTime, DateTime endTime)
        {
            ExchangeWebservice.ManagerWebService service = new ExchangeWebservice.ManagerWebService();
            service.Timeout = -1;
            //DateTime startTime = new DateTime(DateTime.Now.AddDays(-1).Year, DateTime.Now.AddDays(-1).Month, DateTime.Now.AddDays(-1).Day, 0, 0, 1);
            //DateTime endTime = new DateTime(DateTime.Now.AddDays(-1).Year, DateTime.Now.AddDays(-1).Month, DateTime.Now.AddDays(-1).Day, 23, 23, 59);
            string  strError = string.Empty;
            DataSet ds       = new DataSet();

            try
            {
                //读取ad user
                string strsql = "select sAMAccountName,UserPrincipalName from dbo.T_Base_ADUser";

                if (!m_db.ExcuteByDataAdapter(strsql, out ds, out strError))
                {
                    Log4netHelper.Error("获取User信息失败, Error:" + strError);
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.Error("获取User信息失败, Exception:" + ex.ToString());
            }


            //循环调用接口同步用户邮件个数
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    int iSendMailCount    = 0;
                    int iReceiveMailCount = 0;
                    try
                    {
                        if (!service.GetUserMailCount(startTime, endTime, Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]), out iSendMailCount, out iReceiveMailCount, out strError))
                        {
                            Log4netHelper.Error(string.Format("获取用户邮件个数, sAMAccountName:{0} UserPrincipalName:{1} error:{2}", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]), Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]), strError));
                        }
                    }
                    catch (Exception ex)
                    {
                        Log4netHelper.Error(string.Format("获取用户邮件个数, sAMAccountName:{0} UserPrincipalName:{1} Exception:{2}", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]), Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]), ex.ToString()));
                    }

                    try
                    {
                        //添加到数据库
                        CParameters  parameters         = new CParameters();
                        SqlParameter parasAMAccountName = new SqlParameter("@sAMAccountName", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]));
                        parameters.Add(parasAMAccountName);
                        //SqlParameter paraUserPrincipalName = new SqlParameter("@UserPrincipalName", Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]));
                        //parameters.Add(paraUserPrincipalName);
                        SqlParameter paraStartTime = new SqlParameter("@TotalDate", startTime);
                        parameters.Add(paraStartTime);
                        SqlParameter paraSendCount = new SqlParameter("@SendMailCount", iSendMailCount);
                        parameters.Add(paraSendCount);
                        SqlParameter paraReceiveCount = new SqlParameter("@ReceiveMailCount", iReceiveMailCount);
                        parameters.Add(paraReceiveCount);

                        int iResult = 1;
                        if (!m_db.ExcuteByTransaction(parameters, "dbo.prc_InsertADUserMailCount", out iResult, out strError))
                        {
                            Log4netHelper.Error(string.Format("用户邮件个数存入数据库, sAMAccountName:{0} UserPrincipalName:{1} error:{2}", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]), Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]), strError));
                        }

                        if (iResult == -1)
                        {
                            Log4netHelper.Error(string.Format("用户邮件个数存入数据库, sAMAccountName:{0} UserPrincipalName:{1} 调用存储过程spInsertADUserMailCount返回值-1", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]), Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"])));
                        }
                    }
                    catch (Exception ex)
                    {
                        Log4netHelper.Error(string.Format("用户邮件个数存入数据库, sAMAccountName:{0} UserPrincipalName:{1} Exception:{2}", Convert.ToString(ds.Tables[0].Rows[i]["sAMAccountName"]), Convert.ToString(ds.Tables[0].Rows[i]["UserPrincipalName"]), ex.ToString()));
                    }
                }
            }
        }
Ejemplo n.º 27
0
        public bool DeleteMailAudit(Guid transactionid, AdminInfo admin, MailAuditInfo mailAuditInfo, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            string paramstr = string.Empty;

            paramstr += $"AdminID:{admin.UserID}";
            paramstr += $"||ID:{mailAuditInfo.ID}";
            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras       = new CParameters();
                SqlParameter paraAdminID = new SqlParameter("@AdminID", admin.UserID);
                paras.Add(paraAdminID);
                SqlParameter paraID = new SqlParameter("@ID", mailAuditInfo.ID);
                paras.Add(paraID);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_DeleteMailAudit]", out ds, out strError))
                    {
                        strError = "DeleteMailAudit异常,Error:" + strError;
                        LoggerHelper.Error("MailAuditDBProvider调用DeleteMailAudit异常", paramstr, strError, transactionid);
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 1:
                                bResult = true;
                                break;

                            case -1:
                                bResult    = false;
                                error.Code = ErrorCode.HaveSameGroup;
                                break;

                            case -9999:
                                bResult    = false;
                                error.Code = ErrorCode.SQLException;
                                LoggerHelper.Error("MailAuditDBProvider调用DeleteMailAudit异常", paramstr, "-9999", transactionid);
                                break;

                            default:
                                bResult    = false;
                                error.Code = ErrorCode.Exception;
                                break;
                            }
                        }
                        else
                        {
                            bResult    = false;
                            error.Code = ErrorCode.Exception;
                            break;
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("MailAuditDBProvider调用DeleteMailAudit异常", paramstr, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("MailAuditDBProvider调用DeleteMailAudit异常", string.Empty, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 28
0
        public void VisitFile(CFile file)
        {
            if (!canGenerate(file))
                return;

            visitor.PreVisitFile(file);

            filenamesrc = file.Token;

            new CNewline(null).Accept(visitor);

            if (instrument)
            {
                COption cCodeCoverage =
                    new COption(new CToken(file.Filename, TokenTypes.keyword, "option"),
                                new CToken(file.Filename, TokenTypes.keyword, "include"),
                                new CToken(file.Filename, TokenTypes.str, "cCodeCoverage.asp"));
                cCodeCoverage.Accept(this);
            }

            visitor.VisitFile(file);

            if (file.Attributes.contains("GenerateProcessAjaxFunction"))
            {
                CFunction unicoderequest = CProgram.Global.FindFunction("unicoderequest");
                CFunction intrequest = CProgram.Global.FindFunction("intrequest");
                CFunction boolrequest = CProgram.Global.FindFunction("boolrequest");

                CToken tok = CreateTokenWithAdditionalInfo("ProcessAjax", "processajax", TokenTypes.identifier);
                CFunction processAjax =
                    new CFunction(tok, tok.RawValue, tok.Value, TokenTypes.visPublic, CFunction.vbSub, null,
                                  new CTypeRef(null, BuiltIns.Void));

                CAccess pivotitem = new CAccess(unicoderequest.Token, unicoderequest.Token);
                pivotitem.ReferenceTarget = unicoderequest;
                CParameters pivotparams = new CParameters();
                pivotparams.Unnamed.Add(
                    new CConstantExpression(CreateTokenWithAdditionalInfo("sFunction", TokenTypes.str)));
                CSelect select =
                    new CSelect(CreateTokenWithAdditionalInfo("select", TokenTypes.controlFlow),
                                new CDefaultAccess(pivotitem.Token, pivotitem, pivotparams));

                IEnumerator it = CProgram.Global.Functions.GetEnumerator();
                List<CVariable> vars = new List<CVariable>();
                while (it.MoveNext())
                {
                    CFunction func = (CFunction)it.Current;
                    if (!func.Attributes.contains("ExecuteOnServer"))
                        continue;

                    CStatementBlock block = new CStatementBlock();
                    CParameters funcParams = new CParameters();
                    for (int ixArg = 0; ixArg < func.Arguments.Count - 3; ixArg++)
                    {
                        CArgument arg = func.Arguments[ixArg];

                        tok =
                            CreateTokenWithAdditionalInfo("vParam" + (ixArg + 1), "vparam" + (ixArg + 1),
                                                          TokenTypes.identifier);
                        if (ixArg >= vars.Count)
                            vars.Add(new CVariable(tok, false, new CTypeRef(null, BuiltIns.Variant), null, null, null));

                        CAssignment assign = new CAssignment(tok);

                        CAccess left = new CAccess(tok, tok);
                        left.ReferenceTarget = vars[ixArg];
                        assign.Target = left;
                        funcParams.Unnamed.Add(left);

                        CFunction rightfunc = intrequest;
                        if (arg.Type.RawName == "Boolean")
                            rightfunc = boolrequest;
                        else if (arg.Type.RawName == "String")
                            rightfunc = unicoderequest;

                        CParameters parameters = new CParameters();
                        parameters.Unnamed.Add(
                            new CConstantExpression(CreateTokenWithAdditionalInfo(tok.RawValue, TokenTypes.str)));

                        CAccess rightitem = new CAccess(rightfunc.Token, rightfunc.Token);
                        rightitem.ReferenceTarget = rightfunc;

                        assign.Source = new CDefaultAccess(rightfunc.Token, rightitem, parameters);
                        assign.Source.RhsAssignmentSource = true;

                        block.Add(assign);
                    }

                    CAccess calledItem = new CAccess(func.Token, func.Token);
                    CDefaultAccess called = new CDefaultAccess(func.Token, calledItem, funcParams);
                    calledItem.ReferenceTarget = calledItem.ReferenceTarget = func;

                    if (func.Attributes.contains("picture") || func.FunctionType == CFunction.vbFunction)
                    {
                        CAccess returnItem = new CAccess(processAjax.Token, processAjax.Token);
                        returnItem.ReferenceTarget = processAjax;

                        CAssignment assign = new CAssignment(processAjax.Token);
                        assign.Target = returnItem;

                        if (func.FunctionType == CFunction.vbFunction)
                            assign.Source = called;
                        else
                            assign.Source = new CPictureOfExpression(tok, called);

                        block.Add(assign);
                    }
                    else
                        block.Add(new CExpressionStatement(called));

                    tok = CreateTokenWithAdditionalInfo("case", TokenTypes.controlFlow);
                    CExpression exp =
                        new CConstantExpression(CreateTokenWithAdditionalInfo(func.RawName, TokenTypes.str));
                    select.Cases.Add(new CCase(tok, exp, block));
                }

                CDim dim = new CDim(CreateTokenWithAdditionalInfo("Dim", TokenTypes.declaration));
                dim.Variables.AddRange(vars);
                processAjax.Statements.Add(dim);
                processAjax.Statements.Add(select);

                CNewline nl = new CNewline(CreateTokenWithAdditionalInfo("\n", TokenTypes.newline));
                nl.Accept(this);
                processAjax.Accept(this);
                nl.Accept(this);
            }
        }
Ejemplo n.º 29
0
        public bool GetMailDataBaseList(Guid transactionid, AdminInfo admin, int curpage, int pagesize, string searchstr, out BaseListInfo lists, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            lists = new BaseListInfo();
            string strError = string.Empty;
            bool   bResult  = true;

            try
            {
                CParameters  paras      = new CParameters();
                SqlParameter paraUserID = new SqlParameter("@UserID", admin.UserID);
                paras.Add(paraUserID);
                SqlParameter paraPageIndex = new SqlParameter("@PageIndex", curpage);
                paras.Add(paraPageIndex);
                SqlParameter paraPageSize = new SqlParameter("@PageSize", pagesize);
                paras.Add(paraPageSize);
                SqlParameter paraSearchstr = new SqlParameter("@Searchstr", $"%{searchstr}%");
                paras.Add(paraSearchstr);
                SqlParameter paraRecordCount = new SqlParameter("@RecordCount", SqlDbType.Int);
                paraRecordCount.Direction = ParameterDirection.Output;
                paras.Add(paraRecordCount);
                SqlParameter paraPageCount = new SqlParameter("@PageCount", SqlDbType.Int);
                paraPageCount.Direction = ParameterDirection.Output;
                paras.Add(paraPageCount);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_GetMailDataBaseList]", out ds, out strError))
                    {
                        strError   = "prc_GetMailDataBaseList数据库执行失败,Error:" + strError;
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }

                    lists.RecordCount = (int)paraRecordCount.Value;
                    lists.PageCount   = (int)paraPageCount.Value;

                    if (ds != null && ds.Tables.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            DataRow          sdr  = ds.Tables[0].Rows[i];
                            MailDataBaseInfo info = new MailDataBaseInfo();
                            info.ID     = Guid.Parse(Convert.ToString(sdr["ID"]));
                            info.OuID   = Guid.Parse(Convert.ToString(sdr["OuID"]));
                            info.OuName = Convert.ToString(sdr["OuName"]);
                            info.OUdistinguishedName = Convert.ToString(sdr["OUdistinguishedName"]);
                            info.MailboxDBID         = Guid.Parse(Convert.ToString(sdr["MailboxDBID"]));
                            info.MailboxDB           = Convert.ToString(sdr["MailboxDB"]);
                            info.MailboxServer       = Convert.ToString(sdr["MailboxServer"]);
                            info.CreateTime          = Convert.ToDateTime(sdr["CreateTime"]);
                            lists.Lists.Add(info);
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("数据库执行prc_GetMailDataBaseList失败", string.Empty, "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("MailDataBaseDBProvider调用prc_GetMailDataBaseList异常", string.Empty, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 30
0
 public void VisitParameters(CParameters parameters)
 {
     visitor.VisitParameters(parameters);
 }
Ejemplo n.º 31
0
        public bool AddOperateLog(Guid transactionid, LogInfo log, out ErrorCodeInfo error)
        {
            error = new ErrorCodeInfo();
            string strError = string.Empty;
            bool   bResult  = true;
            string paramstr = string.Empty;

            paramstr += $"AdminID:{log.AdminID}";
            paramstr += $"||AdminAccount:{log.AdminAccount}";
            paramstr += $"||RoleID:{log.RoleID}";
            paramstr += $"||OperateType:{log.OperateType}";
            paramstr += $"||OperateTimeName:{log.OperateTimeName}";
            paramstr += $"||OperateTime:{log.OperateTime}";
            paramstr += $"||OperateResult:{log.OperateResult}";
            paramstr += $"||OperateLog:{log.OperateLog}";

            try
            {
                CParameters  paras       = new CParameters();
                SqlParameter paraAdminID = new SqlParameter("@AdminID", log.AdminID);
                paras.Add(paraAdminID);
                SqlParameter paraAdminAccount = new SqlParameter("@AdminAccount", log.AdminAccount);
                paras.Add(paraAdminAccount);
                SqlParameter paraRoleID = new SqlParameter("@RoleID", log.RoleID);
                paras.Add(paraRoleID);
                SqlParameter paraOperateType = new SqlParameter("@OperateType", log.OperateType);
                paras.Add(paraOperateType);
                SqlParameter paraOperateLog = new SqlParameter("@OperateLog", log.OperateLog);
                paras.Add(paraOperateLog);
                SqlParameter paraOperateResult = new SqlParameter("@OperateResult", log.OperateResult);
                paras.Add(paraOperateResult);
                SqlParameter paraClientIP = new SqlParameter("@ClientIP", log.ClientIP);
                paras.Add(paraClientIP);


                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    DataSet ds = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_AddOperateLog]", out ds, out strError))
                    {
                        strError   = "prc_AddOperateLog数据库执行失败,Error:" + strError;
                        bResult    = false;
                        error.Code = ErrorCode.SQLException;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int iResult = 0;
                            iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 1:
                                bResult = true;
                                break;

                            case -1:
                                bResult    = false;
                                error.Code = ErrorCode.HaveSameOu;
                                break;

                            case -9999:
                                bResult    = false;
                                error.Code = ErrorCode.SQLException;
                                LoggerHelper.Error("LogDBProvider调用AddOperateLog异常", "", "-9999", transactionid);
                                break;

                            default:
                                bResult    = false;
                                error.Code = ErrorCode.Exception;
                                break;
                            }
                        }
                        else
                        {
                            bResult    = false;
                            error.Code = ErrorCode.Exception;
                            break;
                        }
                    }
                    else
                    {
                        bResult    = false;
                        error.Code = ErrorCode.Exception;
                        LoggerHelper.Error("LogDBProvider调用AddOperateLog异常", "", "ds = null 或者 ds.Tables.Count <= 0", transactionid);
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult    = false;
                error.Code = ErrorCode.Exception;
                LoggerHelper.Error("LogDBProvider调用AddOperateLog异常", paramstr, ex.ToString(), transactionid);
            }
            return(bResult);
        }
Ejemplo n.º 32
0
        public static bool AddErrorLog(
            String OperationType,
            String ParamInfo,
            String ErrorInfo,
            Guid TransactionID
            )
        {
            bool   bResult  = true;
            string strError = string.Empty;

            try
            {
                CParameters  paras             = new CParameters();
                SqlParameter paraOperationType = new SqlParameter("@OperationType", OperationType);
                SqlParameter paraParamInfo     = new SqlParameter("@ParamInfo", ParamInfo);
                SqlParameter paraErrorInfo     = new SqlParameter("@ErrorInfo", ErrorInfo);
                SqlParameter paraTransactionID = new SqlParameter("@TransactionID", TransactionID);


                paras.Add(paraOperationType);
                paras.Add(paraParamInfo);
                paras.Add(paraErrorInfo);
                paras.Add(paraTransactionID);

                CBaseDB _db = new CBaseDB(Conntection.strConnection);
                do
                {
                    int     iResult = 0;
                    DataSet ds      = new DataSet();
                    if (!_db.ExcuteByTransaction(paras, "dbo.[prc_AddErrorLog]", out iResult, out strError))
                    {
                        strError = "prc_AddErrorLog数据库执行失败,Error:" + strError;
                        bResult  = false;
                        break;
                    }
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            //iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                            switch (iResult)
                            {
                            case 0:
                                bResult = true;
                                break;

                            case -9999:
                                bResult = false;
                                break;

                            default:
                                bResult = false;
                                break;
                            }
                        }
                        else
                        {
                            bResult = false;
                            break;
                        }
                    }
                } while (false);
            }
            catch (Exception ex)
            {
                bResult = false;
            }
            return(bResult);
        }