/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void saveBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { /*用于删除数据库中原来子订单*/ String ChildCustTomTid = "child" + trade.CustomTid; /*流程专用*/ StringBuilder str = new StringBuilder(); for (int i = 0; i < curTradeList.Count; i++) { str.Append(curTradeList[i].tid); str.Append(";"); } if (View_TradeStockService.Update_TradeOrder(ChildCustTomTid, trade, parentTradeOrderList) == ReturnType.Success) { // 添加一条合并流程信息到交易流程 Alading.Utils.SystemHelper.CreateFlowMessage(trade.CustomTid, "合并交易", "合并交易id:" + str.ToString(), "合并交易"); XtraMessageBox.Show(Alading.Properties.Resources.SaveSuccess, Alading.Properties.Resources.Imformation); this.Close(); } }
/// <summary> /// 保存 /// </summary> private void save() { /*数据转换*/ if (_childOrderList.Count == 0) { return; } if (XtraMessageBox.Show("确定要保存?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel) { return; } ChildTradeList = viewTradeStockConvert(_childOrderList); ParentTradeList = viewTradeStockConvert(_parentOrderList); if (ReturnType.Success == View_TradeStockService.Update_TradeOrder(ParentTradeList, ChildTradeList, ParentTrade, ChildTrade)) { // 添加一条添加拆分流程信息到交易流程 Alading.Utils.SystemHelper.CreateFlowMessage(_customTid, "拆分交易", "拆分交易id:" + ParentTradeList.FirstOrDefault().tid, "拆分交易"); XtraMessageBox.Show(Alading.Properties.Resources.SaveSuccess, Alading.Properties.Resources.Imformation); } this.Dispose(); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnCombineSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (tradeOrderList.Count <= 0) { return; } //更新数据库 List <TradeOrder> orderList = new List <TradeOrder>(); foreach (TradeOrderStock tradeOrder in tradeOrderList) { //TradeOrderCode tradeOrder.order.TradeOrderCode = Guid.NewGuid().ToString(); //CustomTid tradeOrder.order.CustomTid = FatherTrade.CustomTid; orderList.Add(tradeOrder.order); } /*流程专用*/ StringBuilder tidStr = new StringBuilder(); for (int i = 0; i < curTradeList.Count; i++) { tidStr.Append(curTradeList[i].tid); tidStr.Append(";"); } /*提交成功*/ if (ReturnType.Success == View_TradeStockService.Update_TradeOrder(FatherTrade, orderList, tradeList)) { // 添加一条合并流程信息到交易流程 Alading.Utils.SystemHelper.CreateFlowMessage(FatherTrade.CustomTid, "合并交易", "合并交易id:" + tidStr.ToString(), "合并交易"); XtraMessageBox.Show(Alading.Properties.Resources.SummitSuccess, Alading.Properties.Resources.Imformation); this.Close(); } }
/// 拆分订单 private void btnSplit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { #region 数据声明 /*用于判断是否有交易勾选*/ int flag = 0; /*用于记录被选择拆分的交易*/ int rowRecord = 0; /*将界面上数据取下处理*/ DataRow row = null; #endregion #region /*一次只能拆分一笔交易*/ for (int rowHandle = 0; rowHandle < GetCurrentTradeGV().RowCount; rowHandle++) { row = GetCurrentTradeGV().GetDataRow(rowHandle); if (row == null) { return; } if (Convert.ToBoolean(row["IsSelected"].ToString()) == true) { flag++; } } if (flag >= 2) { DevExpress.XtraEditors.XtraMessageBox.Show("一次只能拆分1笔交易,您勾选的交易量大于1,请检查!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (flag == 0) { DevExpress.XtraEditors.XtraMessageBox.Show("没有勾选所要拆分的交易,请检查!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #endregion #region /*找到所要拆分的交易*/ for (int rowHandle = 0; rowHandle < GetCurrentTradeGV().RowCount; rowHandle++) { row = GetCurrentTradeGV().GetDataRow(rowHandle); if (row == null) { return; } if (Convert.ToBoolean(row["IsSelected"]) == true) { if (Convert.ToBoolean(row["IsSplited"].ToString())) { DevExpress.XtraEditors.XtraMessageBox.Show("您选的交易已拆,不能再拆分,请检查!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #region /*拆分处理*/ // 拆分的不是合并单 if (row != null && !Convert.ToBoolean(row["IsCombined"].ToString())) { TradeSplit tradeSplit = new TradeSplit(row["CustomTid"].ToString()); tradeSplit.ShowDialog(); //初始化界面 InitSelectTab(); } else if (row != null && Convert.ToBoolean(row["IsCombined"].ToString()))/*拆分合并单*/ { //找到子交易 if (View_TradeStockService.Update_TradeOrder(row["CustomTid"].ToString()) == ReturnType.Success) { InitSelectTab(); XtraMessageBox.Show("拆分成功!", "提示"); } } #endregion } } #endregion }