private void btn_OK_Click(object sender, EventArgs e) { try { if (CheckInput()) { GetEntity(); var CounterBLL = new CT_CounterBLL(); if (EditType == 1) { CounterBLL.Add(m_counter); ShowMessageBox.ShowInformation("添加成功!"); DialogResult = DialogResult.OK; Close(); } else { CounterBLL.Update(m_counter); ShowMessageBox.ShowInformation("修改成功!"); DialogResult = DialogResult.OK; Close(); } } } catch (Exception ex) { ShowMessageBox.ShowInformation("编辑失败!"); string errCode = "GL-3032"; string errMsg = "编辑保存失败!"; var exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); } }
/// <summary> /// 获取柜台UComboItem集合 /// </summary> /// <returns></returns> public static List <UComboItem> GetAllCounterList() { UComboItem item; List <UComboItem> listUComboItem = new List <UComboItem>(); try { CT_CounterBLL CounterBLL = new CT_CounterBLL(); List <CT_Counter> l = CounterBLL.GetListArray(string.Empty); if (l == null) { return(null); } foreach (CT_Counter ct in l) { item = new UComboItem(ct.name, ct.CouterID); listUComboItem.Add(item); } } catch { return(null); } return(listUComboItem); }
/// <summary> /// 删除按纽事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Del_Click(object sender, EventArgs e) { try { string mess; if (this.ViewUser != null && this.ViewUser.FocusedRowHandle >= 0) { if (ShowMessageBox.ShowQuestion("确认删除吗?") == DialogResult.Yes) { CT_CounterBLL CounterBLL = new CT_CounterBLL(); if (!CounterBLL.TestCenterConnection()) { MessageBox.Show("柜台服务连接失败,请检查柜台服务是否开启!", "系统提示"); return; } m_cutRow = this.ViewUser.FocusedRowHandle; DataRow dw = ViewUser.GetDataRow(m_cutRow); int UserID = int.Parse(dw["UserID"].ToString()); ManagementCenter.BLL.UserManage.TransactionManage TransactionManage = new ManagementCenter.BLL.UserManage.TransactionManage(); if (TransactionManage.DelTransaction(UserID, out mess)) { ShowMessageBox.ShowInformation("删除成功!"); InitUserList(); } else { ShowMessageBox.ShowInformation(mess); } } } else { ShowMessageBox.ShowInformation("请选中记录行!"); } } catch (Exception ex) { string errCode = "GL-0325"; string errMsg = "删除交易员失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), ex); ShowMessageBox.ShowInformation(exception.ToString()); } }
/// <summary> /// 获取柜台列表 /// </summary> /// <returns></returns> public List <Entity.CT_Counter> GetAllCounter() { try { LogHelper.WriteDebug("Debug-8225获取柜台列表方法名称:GetAllCounter()" + DateTime.Now); CT_CounterBLL CounterBLL = new CT_CounterBLL(); return(CounterBLL.GetListArray(string.Empty)); } catch (Exception ex) { string errCode = "GL-8225"; string errMsg = "获取柜台列表失败"; VTException vte = new VTException(errCode, errMsg, ex); LogHelper.WriteError(vte.ToString(), vte.InnerException); return(null); } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CounterManger_Load(object sender, EventArgs e) { //CT_CounterBLL CounterBLL = new CT_CounterBLL(); //this.gridCounter.DataSource= CounterBLL.GetAllList().Tables[0]; try { CounterBLL = new CT_CounterBLL(); SetQueryCounter(); InitCounterList(); } catch (Exception ex) { //写日志 ShowMessageBox.ShowInformation("清算柜台管理页面加载失败!"); string errCode = "GL-3000"; string errMsg = "清算柜台管理页面加载失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); } }
/// <summary> /// 测试柜台服务和撮合服务连接状态 /// </summary> private static void TestConnState() { while (true) { int timegap = 0; try { ManagementCenter.BLL.CT_CounterBLL CounterBLL = new CT_CounterBLL(); CounterBLL.CenterTestConnection(); ManagementCenter.BLL.RC_MatchCenterBLL MatchCenterBLL = new RC_MatchCenterBLL(); MatchCenterBLL.CenterTestConnection(); if (!int.TryParse(System.Configuration.ConfigurationManager.AppSettings["TestConnGapTime"].ToString(), out timegap)) { timegap = 600000; } } catch (Exception ex) { LogHelper.WriteError("测试柜台和撮合服务是否连接的方法失败", ex.InnerException); } Thread.Sleep(timegap); } }
/// <summary> /// 确定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_OK_Click(object sender, EventArgs e) { string mess; try { CT_CounterBLL CounterBLL = new CT_CounterBLL(); if (!CounterBLL.TestCenterConnection()) { MessageBox.Show("柜台服务连接失败,请检查柜台服务是否开启!", "系统提示"); return; } if (this.m_EditType == 1) { if (CheckUserInfo()) { DataTable table = GetModifyNodes(this.m_EditType); ManagementCenter.BLL.UserManage.TransactionManage transactionManage = new ManagementCenter.BLL.UserManage.TransactionManage(); if (transactionManage.AddTransaction(table, CurrentUser, InitFund, out mess)) { ShowMessageBox.ShowInformation("添加成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation(mess); } } } else { if (this.m_currentUser.AddType == (int)ManagementCenter.Model.CommonClass.Types.AddTpyeEnum.FrontTaransaction) { ShowMessageBox.ShowInformation("此交易员为虚拟前台所开设用户,不允许修改!"); return; } if (CheckUserInfo()) { DataTable addtable = GetModifyNodes(1); DataTable deltable = GetModifyNodes(2); ManagementCenter.BLL.UserManage.TransactionManage transactionManage = new ManagementCenter.BLL.UserManage.TransactionManage(); if (transactionManage.UpdateTransaction(addtable, deltable, CurrentUser, this.che_UpdatePass.Checked, out mess)) { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation(mess); } } } } catch (Exception ex) { string errCode = "GL-0301"; string errMsg = "保存失败!"; VTException vte = new VTException(errCode, errMsg, ex); LogHelper.WriteError(vte.ToString(), vte.InnerException); ShowMessageBox.ShowInformation(vte.ToString()); } }
/// <summary> /// 自由转帐(同币种) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { CT_CounterBLL CounterBLL = new CT_CounterBLL(); if (!CounterBLL.TestCenterConnection()) { MessageBox.Show("柜台服务连接失败,请检查柜台服务是否开启!", "系统提示"); return; } if (this.ViewUserInfo != null && this.ViewUserInfo.FocusedRowHandle >= 0 && ViewUserInfo.RowCount > 0) { m_cutRow = this.ViewUserInfo.FocusedRowHandle; if (m_cutRow < 0) { return; } DataRow dw = ViewUserInfo.GetDataRow(m_cutRow); int userID = Convert.ToInt32(dw["UserID"].ToString()); //用户ID int counterID = int.Parse(dw["CouterID"].ToString()); //柜台ID int FromCapitalAccountType = ((UComboItem)cmbTransOut.SelectedItem).ValueIndex; int ToCapitalAccountType = ((UComboItem)cmbTransIn.SelectedItem).ValueIndex; decimal TransferAmount = AppGlobalVariable.INIT_DECIMAL; string _Money = string.Empty;//输入的金额 if (!string.IsNullOrEmpty(txtTransferMoney.Text)) { if (InputTest.DecimalTest(this.txtTransferMoney.Text)) { if (Convert.ToDecimal(txtTransferMoney.Text) <= 0) { ShowMessageBox.ShowInformation("转出金额需大于0!"); return; } _Money = this.txtTransferMoney.Text; string[] _lengthRMB = _Money.Split('.'); if (_lengthRMB[0].Length > 12) { ShowMessageBox.ShowInformation("超出存储的范围(整数部分不能大于12位)!"); return; } if (_lengthRMB.Length > 1) { if (_lengthRMB[1].Length > 3) { ShowMessageBox.ShowInformation("小数部分不能大于3位!"); return; } } if (this.txtTransferMoney.Text.Length > 16) { ShowMessageBox.ShowInformation("超出存储的范围(不能大于16位)!"); return; } TransferAmount = Convert.ToDecimal(txtTransferMoney.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("转出资金不能为空!"); return; } TransactionManageBLL = new ManagementCenter.BLL.UserManage.TransactionManage(); int currencyType = ((UComboItem)cmbCurrencyType.SelectedItem).ValueIndex; string outMessage = string.Empty; bool result = TransactionManageBLL.ConvertFreeTransferEntity(userID, FromCapitalAccountType, ToCapitalAccountType, TransferAmount, currencyType, counterID, out outMessage); if (result) { ShowMessageBox.ShowInformation("成功转出资金:" + TransferAmount + "元"); InitAccountListByUserID(userID.ToString(), counterID, m_cutRow); } else { if (!string.IsNullOrEmpty(outMessage)) { ShowMessageBox.ShowInformation(outMessage + "!");//在柜台返回的异常信息后加! } } } } catch (Exception ex) { string errCode = "GL-0374"; string errMsg = " 自由转帐(同币种)失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), ex); return; } }