Ejemplo n.º 1
0
        static public void LoadMailDbCfg()
        {
            XmlDocument xml     = new XmlDocument();
            string      appPath = AppDomain.CurrentDomain.BaseDirectory;

            //xml.Load(appPath + "\\ServerConfig.xml");   //XML地址
            xml.Load("cfg/DbConfig.xml");
            XmlNodeList serverNodeList = xml.SelectNodes("/DbCfg/mail");

            if (null != serverNodeList)
            {
                foreach (XmlNode serverNode in serverNodeList)
                {
                    //string csip = serverNode.SelectSingleNode("csname").InnerText;
                    string ip   = serverNode.SelectSingleNode("csdb").InnerText;
                    string user = serverNode.SelectSingleNode("user").InnerText;
                    string pwd  = serverNode.SelectSingleNode("pwd").InnerText;
                    string db   = serverNode.SelectSingleNode("dbname").InnerText;

                    MailInfoCfg dbcfg = new MailInfoCfg();
                    dbcfg.InitDbCfg(ip, user, pwd, db);
                    dbSfgList.Add(dbcfg);
                }
            }

            LoadChannelCfg();
        }
Ejemplo n.º 2
0
        //获取当前选择的cs-->db
        static public MailInfoCfg GetCurtCSDBInfo(String choseCS)
        {
            MailInfoCfg tcfg = new MailInfoCfg();

            foreach (MailInfoCfg cfg in Program.dbSfgList)
            {
                tcfg = cfg;
                break;
            }
            return(tcfg);
        }
Ejemplo n.º 3
0
        static public bool GetUseridAndQuery(int type, String str, MailInfoCfg cfg)
        {
            ReleaseList();

            bool bFlag = DbFunc.IfConnDb(cfg);

            if (bFlag)
            {
                SplitUserStr(type, str);

                CheckUserSql(cfg);
            }
            return(bFlag);
        }
Ejemplo n.º 4
0
        static public void CheckUserSql(MailInfoCfg cfg)
        {
            foreach (UserInfo user in userList)
            {
                String strSql = "select id from account_user where ";

                try
                {
                    switch (user.eType)
                    {
                    case EUserType.eUser_Id:
                    {
                        strSql += "id=" + Convert.ToInt64(user.obj) + ";";
                    } break;

                    case EUserType.eUser_Name:
                    {
                        strSql += "user_name='" + Convert.ToString(user.obj) + "';";;
                    } break;

                    case EUserType.eUser_Account:
                    {
                        strSql += "cdkey='" + Convert.ToString(user.obj) + "';";
                    } break;

                    default: break;
                    }
                }
                catch (System.Exception ex)
                {
                    errorStr.Add(user.obj.ToString());
                    continue;
                }

                UInt64 objIdx = DbFunc.CheckAndGetUserIdx(strSql);

                if (objIdx > 0)
                {
                    if (!userIdList.Contains(objIdx))
                    {
                        userIdList.Add(objIdx);
                        existUserList.Add(user);
                    }
                }
                else
                {
                    errorStr.Add(user.obj.ToString());
                }
            }
        }
Ejemplo n.º 5
0
 static public bool IfConnDb(MailInfoCfg cfg)
 {
     if (conn != null)
     {
         return(true);
     }
     try
     {
         String mysqlStr = "Database=" + cfg.mDbname + ";Data Source=" + cfg.mIpAddr + ";User Id=" + cfg.mUser + ";Password="******";pooling=false;CharSet=utf8;port=3306";
         conn = new MySqlConnection(mysqlStr);
         if (conn != null)
         {
             return(true);
         }
         return(false);
     }
     catch (System.Exception ex)
     {
         err = ex.Message;
         return(false);
     }
     return(false);
 }
Ejemplo n.º 6
0
 public bool ifConnectDb(MailInfoCfg cfg)
 {
     return(true);
 }