private void acc_Loaded(object sender, RoutedEventArgs e) { tc = this.DataContext as TradeConfigInfo; //if (tc != null) //{ // switch (tc.ObjCode) // { // case "CCFJSSJ"://0-23 // break; // case "GDYXQ"://-1 - // break; // case "YKGS"://最大50个字符 // break; // default: // break; // } // Binding b = new Binding() { Path = new PropertyPath("ObjValue"), Mode= BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }; // b.ValidationRules.Add(); // this.txtObjValue.SetBinding(TextBox.TextProperty, b); //} }
/// <summary> /// 删除交易设置信息 /// </summary> public void DelTradingSettingInfo(TradeConfigInfo selInfo) { MessageBoxResult result = MessageBox.Show("您确定删除当前数据吗?", "提示信息", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (result == MessageBoxResult.OK) { ErrType err = _businessService.DelTradeSet(selInfo.ObjCode, _loginID); if (err != GeneralErr.Success) MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning); else TradeConfigInfoList.Remove(selInfo); } }
/// <summary> /// 修改交易设置信息 /// </summary> public void ModifyTradingSettingInfo(TradeConfigInfo selInfo) { TradeSetWindow window = new TradeSetWindow() { DataContext = selInfo, Owner = Application.Current.MainWindow }; window.CodeEnable = false; if (window.ShowDialog() == true) { ErrType err = _businessService.ModifyTradeSet(_loginID, selInfo); if (err != GeneralErr.Success) MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning); } else { //GetTradingSettingInfo(); } }
/// <summary> /// 添加交易设置信息 /// </summary> public void AddTradingSettingInfo() { TradeConfigInfo selInfo = new TradeConfigInfo(); TradeSetWindow window = new TradeSetWindow() { DataContext = selInfo, Owner = Application.Current.MainWindow }; window.CodeEnable = true; if (window.ShowDialog() == true) { if (TradeConfigInfoList.Where(p => p.ObjCode == selInfo.ObjCode).Count() > 0) { MessageBox.Show("名称编码不能重复,请重新填写", "提示信息", MessageBoxButton.OK, MessageBoxImage.Information); AddTradingSettingInfo(); } else { ErrType err = _businessService.AddTradeSet(selInfo, _loginID); if (err != GeneralErr.Success) MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning); else TradeConfigInfoList.Add(selInfo); } } }
/// <summary> /// 修改交易设置信息 /// </summary> /// <param name="loginID">登陆标识</param> /// <param name="tradingSettingInfo">修改后的交易设置信息</param> /// <returns>ErrType</returns> public ErrType ModifyTradeSet(string loginID, TradeConfigInfo tradingSettingInfo) { try { TradeSet tradeSet = new TradeSet(); tradeSet.ObjName = tradingSettingInfo.ObjName; tradeSet.ObjCode = tradingSettingInfo.ObjCode; tradeSet.ObjValue = tradingSettingInfo.ObjValue; tradeSet.Remark = tradingSettingInfo.Remark; ResultDesc result = ManagerService.ModifyTradeSet(tradeSet, loginID); return result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc); } catch (TimeoutException te) { FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException); } catch (Exception ex) { FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message); return new ErrType(ERR.EXEPTION, ErrorText.OperationError); } }