Esempio n. 1
0
        /// <summary>
        /// 当日志超过指定条数时,上传日志并清除本地日志
        /// </summary>
        static public void LogUpload(EagleString.LoginInfo li, int count)
        {
            string          ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\EagleLog.mdb;";
            OleDbConnection cn      = new OleDbConnection();

            try
            {
                cn.ConnectionString = ConnStr;
                cn.Open();
            }
            catch
            {
                //MessageBox.Show("LogUpload : 上传日志失败");
            }
            try
            {
                OleDbCommand     cmd     = new OleDbCommand("select * from LocalLog", cn);
                DataTable        dt      = new DataTable();
                OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
                if (dt != null)
                {
                    adapter.Fill(dt);
                }
                if (dt.Rows.Count <= count)
                {
                    return;                        //大于count条时上传日志
                }
                string sendstr = "";
                string recvstr = "";
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        sendstr += "\r\n[" + i.ToString("d3") + "]" + dt.Rows[i]["STRINGSEND"];
                        recvstr += "\r\n[" + i.ToString("d3") + "]" + dt.Rows[i]["STRINGRECV"];
                    }

                    if (sendstr != "" || recvstr != "")
                    {
                        sendstr = sendstr.Substring(2);
                        recvstr = recvstr.Substring(2);
                        EagleWebService.kernalFunc fc = new EagleWebService.kernalFunc(li.b2b.webservice);
                        bool bflag = false;
                        fc.WriteLogToServer(li.b2b.username, sendstr, "", ref bflag);
                        if (bflag)
                        {
                            cmd.CommandText = "delete * from LocalLog";
                            cmd.ExecuteNonQuery();
                            EagleString.EagleFileIO.LogWrite("上传日志完成!");
                        }
                    }
                }
                cn.Close();
            }
            catch
            {
            }
        }
Esempio n. 2
0
        byte[] m_buf99;//用于自动pn

        /// <summary>
        /// 初始化入参
        /// </summary>
        /// <param name="buf">从SOCKET收到的BUFFER</param>
        /// <param name="lr">登录结果</param>
        /// <param name="MsgNo">socket消息流水号</param>
        public void InitInputArgs(byte[] buf, EagleString.LoginInfo lr, uint MsgNo)
        {
            m_buf        = new byte[buf.Length];
            m_tempBuffer = new byte[buf.Length];
            buf.CopyTo(m_buf, 0);
            buf.CopyTo(m_tempBuffer, 0);

            m_in_username = lr.b2b.username;
            m_in_lr       = lr;
            m_in_MsgNo    = MsgNo;
        }
Esempio n. 3
0
        /// <summary>
        /// 配置共享登录
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="newipid">共享配置信息</param>
        /// <param name="loginInfo">引用输出登录信息</param>
        public static void login2server(
            string username,
            string password,
            string newipid,
            ref EagleString.LoginInfo loginInfo
            )
        {
            string b2buser     = username;
            string b2bpass     = password;
            string loginb2bxml = string.Empty;
            bool   flagLogin   = false;

            EagleString.LineProvider    lp    = new LineProvider();
            EagleString.ServerCenterB2B scb2b = new ServerCenterB2B();
            string b2bWebSite    = "";
            string b2bWebService = "";

            scb2b.ServerAddressB2B(EagleFileIO.Server, lp, 0, ref b2bWebService, ref b2bWebSite);

            EagleWebService.kernalFunc kf = new EagleWebService.kernalFunc(b2bWebService);
            kf.LogIn(b2buser, b2bpass, ref loginb2bxml, ref flagLogin);
            if (!flagLogin)
            {
                throw new Exception("登录B2B失败,请检查网络及用户名密码是否正确!");
            }
            ///把共享的配置加进去
            XmlDocument xmldoc = new XmlDocument();

            xmldoc.LoadXml(loginb2bxml);
            XmlNode xn = xmldoc.SelectSingleNode("//eg//IPS");

            xn.InnerXml += newipid;
            loginb2bxml  = xmldoc.InnerXml;
            ///共享配置加入完毕
            EagleString.LoginResult lr = new LoginResult(loginb2bxml);
            if (lr.EXPIRED)
            {
                throw new Exception("该B2B用户已失效!");
            }
            if (lr.AGENT_STAT != 0)
            {
                throw new Exception("该B2B用户所在代理商已失效!");
            }
            if (lr.USER_STAT != 0)
            {
                throw new Exception("该B2B用户状态已失效!");
            }
            loginInfo.b2b.username   = username;
            loginInfo.b2b.password   = password;
            loginInfo.b2b.webservice = b2bWebService;
            loginInfo.b2b.lr         = lr;
        }
Esempio n. 4
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="isB2c">是否B2C</param>
        /// <param name="b2cService">B2C服务地址</param>
        /// <param name="b2cManager">B2C后台地址</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="lp">网络线路,电信:0,网通:1</param>
        /// <param name="resB2c">B2C结果</param>
        /// <param name="loginInfo">返回结果</param>
        public static void login2server(
            bool isB2c,
            string b2cService,
            string b2cManager,
            string username,
            string password,
            EagleString.LineProvider lp,
            EagleString.LoginResultBtoc.LOGIN_INFO_BTOC resB2c,
            ref EagleString.LoginInfo loginInfo
            )
        {
            loginInfo.borc = (isB2c ? LoginInfo.BORC.b2c : LoginInfo.BORC.b2b);
            if (isB2c)
            {
                EagleExtension.LoginB2c(username, password, ref resB2c, b2cManager, b2cService);
                loginInfo.b2c.username   = username;
                loginInfo.b2c.password   = password;
                loginInfo.b2c.webservice = b2cService;
                loginInfo.b2c.website    = b2cManager;
                loginInfo.b2c.lr         = resB2c;
            }
            string loginb2bxml = "";

            //here todo: get b2b webservice address
            EagleString.ServerCenterB2B scb2b = new ServerCenterB2B();

            string b2bWebSite    = "";
            string b2bWebService = "";

            scb2b.ServerAddressB2B(EagleFileIO.Server, lp, 0, ref b2bWebService, ref b2bWebSite);
            EagleWebService.kernalFunc kf = new EagleWebService.kernalFunc(b2bWebService);
            bool   flagLogin = false;
            string b2buser   = username;
            string b2bpass   = password;

            if (isB2c)
            {
                b2buser = resB2c.mapuser;
                b2bpass = resB2c.mappass;
            }
            kf.LogIn(b2buser, b2bpass, ref loginb2bxml, ref flagLogin);
            if (!flagLogin)
            {
                throw new Exception("登录B2B失败,请检查网络及用户名密码是否正确!");
            }
            EagleString.LoginResult lr = new LoginResult(loginb2bxml);
            if (lr.EXPIRED)
            {
                throw new Exception("该B2B用户已失效!");
            }
            if (lr.AGENT_STAT != 0)
            {
                throw new Exception("该B2B用户所在代理商已失效!");
            }
            if (lr.USER_STAT != 0)
            {
                throw new Exception("该B2B用户状态已失效!");
            }

            loginInfo.b2b.username   = b2buser;
            loginInfo.b2b.password   = b2bpass;
            loginInfo.b2b.webservice = b2bWebService;
            loginInfo.b2b.webside    = b2bWebSite;
            loginInfo.b2b.lr         = lr;
        }
Esempio n. 5
0
 public static void login2server(string username, string password, ref EagleString.LoginInfo loginInfo)
 {
     EagleString.LoginResultBtoc.LOGIN_INFO_BTOC resB2c = new LoginResultBtoc.LOGIN_INFO_BTOC();
     login2server(false, "", "", username, password, LineProvider.DianXin, resB2c, ref loginInfo);
 }
Esempio n. 6
0
 public CommandPool(LoginInfo li)
 {
     m_li = li;
 }