private void Button_Click(object sender, RoutedEventArgs e) { if (CanLoginCount > 0) { var client = new ServiceReference.DataWebServiceSoapClient(); client.InnerChannel.OperationTimeout = new TimeSpan(0, 0, 0, 3); var userName = Cryptor.MD5Encrypt(this.txtName.Text); var psw = Cryptor.MD5Encrypt(this.psw.Password); try { var isLoginSuccess = client.Login(userName, psw); if (isLoginSuccess) { CommonUtils.UserName = userName; if (ckbSavePsw.IsChecked == true) { CommonUtils.SetConfig("user", userName); CommonUtils.SetConfig("password", psw); } else { CommonUtils.SetConfig("user", string.Empty); CommonUtils.SetConfig("password", string.Empty); } IsLogon = true; this.Close(); } else { CommonUtils.SetConfig("info", Cryptor.MD5Encrypt(DateTime.Today.ToString() + "|" + (CanLoginCount - 1))); MessageBox.Show("用户名或密码不正确!当前可用登录次数为:" + CanLoginCount); } } catch (Exception ex) { MessageBox.Show("登录异常,Message " + ex.Message); } } else { if (CanLogon) { MessageBox.Show("可用登录次数已耗尽,请联系管理员!"); } } }
public Logon() { InitializeComponent(); IsLogon = false; var userName = CommonUtils.GetConfig("user"); var password = CommonUtils.GetConfig("password"); if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password)) { try { this.txtName.Text = Cryptor.MD5Decrypt(userName); this.psw.Password = Cryptor.MD5Decrypt(password); this.ckbSavePsw.IsChecked = true; } catch { } } }
private void btnRepay_Click(object sender, RoutedEventArgs e) { if (this.cmbGroup.SelectedItem == null) { MessageBox.Show("请选择还款账户"); return; } else { if (GroupServiceHelper.ExistsGroup(this.cmbGroup.SelectedItem as string)) { var win = new winRepay(); var group = cmbGroup.SelectedItem as string; var o = Cryptor.MD5Decrypt(GroupDict[group]).FromJson <券商>(); win.Init(o); win.ShowDialog(); } else { MessageBox.Show("缺少组合号接口IP.txt"); } } }
private void Button_Search_Click(object sender, RoutedEventArgs e) { this.NotUseCount = 0; int tradeDataType = int.Parse((cbTodayType.SelectedItem as ComboBoxItem).DataContext.ToString()); bool isCheckPort = this.ckbIsCheckPort.IsChecked == true; var group = cmbGroup.SelectedItem as string; if (!string.IsNullOrEmpty(group) && GroupDict.ContainsKey(group)) { this.loading.Visibility = Visibility.Visible; var action = new Action(() => { try { var o = Cryptor.MD5Decrypt(GroupDict[group]).FromJson <券商>(); if (o != null) { DateTime dt1 = DateTime.Now; DataTable dt = DataAdapter.QueryTradeData(o, tradeDataType, isCheckPort); var span = DateTime.Now - dt1; var s = span.TotalSeconds; if (dt != null && dictDataColumn != null && dictDataColumn.ContainsKey(tradeDataType.ToString())) { CommonUtils.Log(string.Format("交易接口查询耗时记录, 交易类型 {0}, 耗时 {1}", tradeDataType, s)); var list = dictDataColumn[tradeDataType.ToString()]; //if ("FCAA14B3008F 005056C00001 005056C00008".IndexOf(CommonUtils.GetMac()) > -1 && CommonUtils.GetCpuID() == "BFEBFBFF000306C3") if (tradeDataType != 0 && tradeDataType != 6) { for (int i = dt.Columns.Count - 1; i > -1; i--) { if (!list.Contains(dt.Columns[i].ColumnName)) { dt.Columns.RemoveAt(i); } } } if (tradeDataType == 2 && dt.Columns.Contains("买卖标志") && dt.Rows.Count > 0 && Regex.IsMatch(dt.Rows[0]["买卖标志"] + "", "^[01]+$")) { foreach (DataRow row in dt.Rows) { row["买卖标志"] = GetBuySaleInfo(row["买卖标志"] + ""); } } if (tradeDataType == 1) { AddPosition(isCheckPort, o, dt); } } this.QueryData = dt; } } catch (Exception ex) { this.Dispatcher.ShowMsg(ex.Message); } }); var completeAction = new Action(() => { if (QueryData == null) { dgMain.ItemsSource = null; } else { //dgMain.AutoGenerateColumns = false; dgMain.ItemsSource = QueryData.DefaultView; } this.loading.Visibility = Visibility.Collapsed; }); this.Dispatcher.RunAsync(action, null, null, completeAction); } }