/// <summary> /// 登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { string leixin = cmbSer.Text; if (leixin == "顺丰") { ServerFeiPan.login(serShunFeng, txtUserName.Text, txtUserPass.Text, "顺丰"); } else if (leixin == "永利") { ServerFeiPan.login(serYongLi, txtUserName.Text, txtUserPass.Text, "永利"); } if (cbIsTryCon.Checked && ServerFeiPan.IsLoginSuccess == false) { MessageBox.Show("登录失败"); } if (ServerFeiPan.IsLoginSuccess) { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "使用中"; } else { lblState.Text = "链接失败"; } //已登录 function.log("已经登录 【btnLogin】" + ServerFeiPan.ServerType); }
public void TryConnect() { if (ServerFeiPan.checkLogin() == true) { //已登录 function.log("已经登录 【TryConnect】"); return; } //加载服务器 DataTable dtServer = SQLiteHelper.ExecuteDataTable("select * from fuwuqi_" + (String.IsNullOrWhiteSpace(Seq) ? CacheData.Seq : Seq), null); if (dtServer.Rows.Count > 0) { foreach (DataRow row in dtServer.Rows) { string _serverType = row["类型"].ToString(); string _serverUrl = row["服务器地址"].ToString(); string _userName = row["用户名"].ToString(); string _userPass = row["密码"].ToString(); // System.Windows.Forms.ListViewItem.ListViewSubItem subItem = null; foreach (ListViewItem item in lvSerState.Items) { if (item.SubItems[2].Text.Equals(_serverUrl)) { subItem = item.SubItems[4]; } } subItem.Text = "链接中.."; if (subItem != null) { if (_serverType.Equals("顺丰")) { ServerFeiPan.login(_serverUrl, _userName, _userPass, _serverType); } else if (_serverType.Equals("永利")) { ServerFeiPan.login(_serverUrl, _userName, _userPass, _serverType); } // subItem.Text = ServerFeiPan.IsLoginSuccess ? "使用中" : "已停止"; if (ServerFeiPan.IsLoginSuccess) { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "使用中"; break; } else { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "已停止"; } } function.log("测试登录 【TryConnect】" + _serverType); } } // if (cbStart.Checked && ServerFeiPan.IsLoginSuccess == false) { playFaileSound(); frmMessageTimer frmMessage = new frmMessageTimer("盘口可能坏了,请检查是否可用?"); frmMessage.Show(); cbStart.Checked = false; } }
/// <summary> /// 下注 /// </summary> public feiPanJieGuo StartXiaZhu(xztj xztj, string qiHao) { feiPanJieGuo fpjgData = new feiPanJieGuo(); fpjgData.serverUrl = ""; fpjgData.yuE = "0"; lblYuE.Text = "0"; lblServer.Text = ""; lblName.Text = ""; lblState.Text = "链接中"; if (cbStart.Checked == true) { string useServer = ""; //尝试下注 if (ServerFeiPan.checkLogin() == false) { ServerFeiPan.loginAgain(); } if (ServerFeiPan.checkLogin() == true) { if (ServerFeiPan.ServerType.Equals("顺丰")) { fpjgData.isSuccess = true; fpjgData.serverUrl += ServerFeiPan.FeidanUrl + ";"; fpjgData = ServerFeiPan.xiaZhu_shunfen(xztj, qiHao, fpjgData); } else if (ServerFeiPan.ServerType.Equals("永利")) { fpjgData.isSuccess = true; fpjgData.serverUrl += ServerFeiPan.FeidanUrl + ";"; fpjgData = ServerFeiPan.xiaZhu_yongli(xztj, qiHao, fpjgData); } useServer = ServerFeiPan.ServerType + ServerFeiPan.LoginName; } foreach (ListViewItem item in lvSerState.Items) { item.SubItems[4].Text = "已停止"; } //重新遍历服务器列表 if (fpjgData.isSuccess == false) { //加载服务器 DataTable dtServer = SQLiteHelper.ExecuteDataTable("select * from fuwuqi_" + (String.IsNullOrWhiteSpace(Seq) ? CacheData.Seq : Seq), null); if (dtServer.Rows.Count > 0) { foreach (DataRow row in dtServer.Rows) { string _serverType = row["类型"].ToString(); string _serverUrl = row["服务器地址"].ToString(); string _userName = row["用户名"].ToString(); string _userPass = row["密码"].ToString(); if (_serverType.Equals(_serverType + _userName)) { function.log("提交失败:" + _serverType + _userName); continue; } if (_serverType.Equals("顺丰")) { ServerFeiPan.login(_serverUrl, _userName, _userPass, _serverType); if (ServerFeiPan.IsLoginSuccess == false && cbIsTryCon.Checked) { frmMessageTimer frmMessage = new frmMessageTimer("服务器" + _serverUrl + "不能使用"); frmMessage.Show(); Application.DoEvents(); } if (ServerFeiPan.IsLoginSuccess == true) { fpjgData = ServerFeiPan.xiaZhu_shunfen(xztj, qiHao, fpjgData); } } else if (_serverType.Equals("永利")) { ServerFeiPan.login(_serverUrl, _userName, _userPass, _serverType); if (ServerFeiPan.IsLoginSuccess == false && cbIsTryCon.Checked) { frmMessageTimer frmMessage = new frmMessageTimer("服务器" + _serverUrl + "不能使用"); frmMessage.Show(); Application.DoEvents(); } if (ServerFeiPan.IsLoginSuccess == true) { fpjgData = ServerFeiPan.xiaZhu_yongli(xztj, qiHao, fpjgData); } } // if (ServerFeiPan.IsLoginSuccess) { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "使用中"; } else { lblYuE.Text = ServerFeiPan.KeYongYuE.ToString(); lblServer.Text = ServerFeiPan.FeidanUrl; lblName.Text = ServerFeiPan.LoginName; lblState.Text = "已停止"; } foreach (ListViewItem item in lvSerState.Items) { if (item.SubItems[2].Text.Equals(_serverUrl)) { item.SubItems[4].Text = ServerFeiPan.IsLoginSuccess ? "使用中" : "已停止"; } } // if (fpjgData.isSuccess) { break; } } } } } else { fpjgData = ServerCommon.SetFeiPanJieGuo(fpjgData, true); fpjgData.errorMessage = "未开启"; //关闭直接返回 return(fpjgData); } if (fpjgData.isSuccess == false) { playFaileSound(); if (cbStart.Checked && ServerFeiPan.IsLoginSuccess == false) { frmMessageTimer frmMessage = new frmMessageTimer("盘口可能坏了,请检查是否可用?"); frmMessage.Show(); cbStart.Checked = false; } } //for (int i = 0; i < 4; i++)//总和组合 //{ // fpjgData.ZHZHDXDS[i] = true; //} // //lblYuE.Text = fpjgData.yuE; //插入 feiPanJieGuoInsert(xztj, fpjgData, qiHao); //查询最新 chaXunZuiXin(); return(fpjgData); // //string result = HttpHelps.Post("", _feidanUrl + "/user/cql_cqsc_lm.aspx?t=all", // _webCookie, Encoding.Default); }