public void ShowUndoneOrder() { var objLists = new TransactionManage().GetUndoneTransactionList(); if (objLists.Count == 0) { Close(); } else { dgvUndoneOrders.DataSource = objLists; dgvUndoneOrders.Show(); } }
/// <summary> /// 每次当服务启动时更新数据 /// </summary> public void StartUpdateService() { if (IsUpdateTime()) { CommonTable.CommodityCodeUpdate CommodityCodeUpdate = new CommodityCodeUpdate(); //把StockInfo表和HKStockInfo表中新增的代码添加到交易商品_撮合机_分配表中 LogHelper.WriteDebug("开始调用新增代码添加到撮合机的方法:XHCodeAutoRCTradeCommodityAssign()" + DateTime.Now); CommodityCodeUpdate.XHCodeAutoRCTradeCommodityAssign(); LogHelper.WriteDebug("结束调用新增代码添加到撮合机的方法:XHCodeAutoRCTradeCommodityAssign()" + DateTime.Now); //从StockInfo表中更新新增和修改的现货代码 LogHelper.WriteDebug("开始调用更新新增和修改的现货代码的方法:CodeUpdata()" + DateTime.Now); CommodityCodeUpdate.CodeUpdata(); LogHelper.WriteDebug("结束调用更新新增和修改的现货代码的方法:CodeUpdata()" + DateTime.Now); //从HKStockInfo表中更新新增和修改的港股交易商品代码更新 LogHelper.WriteDebug("开始调用更新新增和修改港股代码的方法:HKCodeUpdata()" + DateTime.Now); CommodityCodeUpdate.HKCodeUpdata(); LogHelper.WriteDebug("结束调用更新新增和修改港股代码的方法:HKCodeUpdata()" + DateTime.Now); //期货代码更新 LogHelper.WriteDebug("开始调用期货代码更新的方法:CheckCodeIsExpired()" + DateTime.Now); CommodityCodeUpdate.CheckCodeIsExpired(); LogHelper.WriteDebug("结束调用期货代码更新的方法:CheckCodeIsExpired()" + DateTime.Now); //自动解冻 LogHelper.WriteDebug("开始调用自动解冻的方法:AutoUnFreeze()" + DateTime.Now); ManagementCenter.BLL.UserManage.TransactionManage TransactionManage = new TransactionManage(); TransactionManage.AutoUnFreeze(); LogHelper.WriteDebug("结束调用自动解冻的方法:AutoUnFreeze()" + DateTime.Now); //删除标志状态为FrontTarnDelState=5的交易员 LogHelper.WriteDebug("开始调用删除标志状态为FrontTarnDelState=5的交易员的方法:DelTran()" + DateTime.Now); ManagementCenter.BLL.UserManage.Out_TransactionManage outTransactionManage = new Out_TransactionManage(); outTransactionManage.DelTran(); LogHelper.WriteDebug("结束调用删除标志状态为FrontTarnDelState=5的交易员的方法:DelTran()" + DateTime.Now); //更新非交易日期 int Currentyear = System.DateTime.Now.Year; int nyear = System.DateTime.Now.AddDays(1).Year; if (Currentyear != nyear) { LogHelper.WriteDebug("开始调用更新非交易日期的方法:InitNotTrandingDay()" + DateTime.Now); ManagementCenter.BLL.CommonTable.QHCodeInit.InitNotTrandingDay(nyear); LogHelper.WriteDebug("结束更新非交易日期的方法:InitNotTrandingDay()" + DateTime.Now); } } }
private void CompletedTransactionPage_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Enter: #region Update price if (lbError.Visible == false) { if (tbSellingPrice.Text.Length != 0) { objTransaction.SellingPrice = Convert.ToDouble(tbSellingPrice.Text.Trim()); } if (tbPurchasingPrice.Text.Length != 0) { objTransaction.PurchasePrice = Convert.ToDouble(tbPurchasingPrice.Text.Trim()); } objTransaction.Profit = objTransaction.SellingPrice - objTransaction.PurchasePrice; if (tbSellingPrice.Text.Length != 0 && tbPurchasingPrice.Text.Length != 0) { objTransaction.OrderStatus = Convert.ToByte(true); } var result = new TransactionManage().UpdateTransactionRecord(objTransaction); if (result > 0) { MessageBox.Show(zh?"更新成功!":"Updating Sucessfully!"); } } else { lbError.Text = zh?"在解决问题前,不能关闭订单":"You can't submit before solving the error!"; return; } #endregion Close(); break; case Keys.Escape: Close(); break; default: break; } }
/// <summary> /// view undone orders /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUndoneOrders_Click(object sender, EventArgs e) { // 添加检查是否存在未完成的订单 var objLists = new TransactionManage().GetUndoneTransactionList(); if (objLists.Count == 0) { MessageBox.Show(zh?"没有未完成的订单":"No undone orders!", zh?"提示":"Prompt", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DisplayMainFrm(false); _frmUndoneOrders = new UndoneOrdersPage(); EvtPassParentPanel += _frmUndoneOrders.Receiver; // 关联子窗体,传递订单号信息 EvtPassParentPanel(splitContainer.Panel1); OpenNewForm(_frmUndoneOrders); } }
private void ShowOrderDetail(string orderNo) { _objOrder = new OrderManage().GetOrderByOrderNo(orderNo); tbOrderNo.Text = _objOrder.OrderNo.ToString(); tbPurchaser.Text = _objOrder.Purchaser; tbPurchaser.Enabled = false; tbFrom.Text = @"Oscar"; tbFrom.Enabled = false; tbFromPhone.Text = @"0211376664"; tbFromPhone.Enabled = false; tbTo.Text = _objOrder.User.UserName; tbToPhone.Text = _objOrder.User.PhoneNumber; tbCardNo.Text = _objOrder.User.CardNo; tbAddress.Text = _objOrder.User.Address; var objTransaction = new TransactionManage().GetTransactionRecordByOrderNo(orderNo); tbPurchasePrice.Text = objTransaction.PurchasePrice.ToString(); tbSellingPrice.Text = objTransaction.SellingPrice.ToString(); tbProfit.Text = objTransaction.Profit.ToString(); _objItems = new ItemManage().GetItemListByOrderNo(orderNo); dgvItemList.DataSource = _objItems; dgvItemList.Show(); tbTotalPrice.Text = CalculateTotalPrice(_objItems).ToString(); //if (_status.Equals("Edit")) //{ // string itemNo = dgvItemList.Rows[0].Cells["ItemNo"].Value.ToString(); //get the information in the first row // Item objItem = new ItemManage().GetItemByItemNo(itemNo); // tbProductName.Text = objItem.ItemDescription; // tbQuantity.Text = objItem.Quantity.ToString(); // tbPrice.Text = objItem.UnitPrice.ToString(); //} }
private void btnModify_Click(object sender, EventArgs e) { #region Validation controls if (tbTo.Text.Trim().Length == 0) { ShowError(zh?"请添加收件人":"Please fill the receiver", tbTo, lbError); return; } HideError(tbTo, lbError); if (tbToPhone.Text.Trim().Length == 0) { ShowError(zh?"请添加收件人电话号码":"Please fill the receiver's phone", tbToPhone, lbError); return; } HideError(tbToPhone, lbError); if (tbAddress.Text.Trim().Length == 0) { ShowError(zh?"请添加收件人地址":"Please fill the receiver's address", tbAddress, lbError); return; } HideError(tbAddress, lbError); if (tbSellingPrice.Text.Trim().Length == 0) { ShowError(zh?"请添加产品售价":"Please fill the selling price", tbSellingPrice, lbError); return; } if (Regex.IsMatch(tbSellingPrice.Text, "[^0-9]")) //区分不是字母,而是数字 { if (!Regex.IsMatch(tbSellingPrice.Text, @"^(-?\d+)(\.\d+)?$")) { //不是小数 ShowError(zh?"只允许添加数字":"Please input only number", tbSellingPrice, lbError); return; } else { HideError(tbSellingPrice, lbError); } } else { HideError(tbSellingPrice, lbError); } if (tbPurchasePrice.Text.Trim().Length == 0) { ShowError(zh?"请添加进价":"Please fill the purchasing price", tbPurchasePrice, lbError); return; } if (Regex.IsMatch(tbPurchasePrice.Text, "[^0-9]")) //区分不是字母,而是数字 { if (!Regex.IsMatch(tbPurchasePrice.Text, @"^(-?\d+)(\.\d+)?$")) { //不是小数 ShowError(zh ? "只允许添加数字" : "Please input only number", tbPurchasePrice, lbError); return; } else { HideError(tbSellingPrice, lbError); } } else { HideError(tbPurchasePrice, lbError); } #endregion #region Database operation _objOrder = new OrderManage().GetOrderByOrderNo(tbOrderNo.Text.Trim()); _objOrder.Purchaser = tbPurchaser.Text.Trim(); _objOrder.User = new UserInfoManage().GetUserByOrderNo(tbOrderNo.Text.Trim()); _objOrder.User.UserName = tbTo.Text.Trim(); _objOrder.User.PhoneNumber = tbToPhone.Text.Trim(); _objOrder.User.Address = tbAddress.Text.Trim(); var objTransaction = new TransactionManage().GetTransactionRecordByOrderNo(tbOrderNo.Text.Trim()); objTransaction.SellingPrice = Convert.ToDouble(tbSellingPrice.Text.Trim()); objTransaction.PurchasePrice = Convert.ToDouble(tbPurchasePrice.Text.Trim()); objTransaction.Profit = objTransaction.SellingPrice - objTransaction.PurchasePrice; new TransactionManage().UpdateTransactionRecord(objTransaction); new UserInfoManage().UpdatetUser(_objOrder.User); foreach (var objItem in _objItems) { if (objItem.ItemNo == 0) { objItem.OrderNo = _objOrder.OrderNo; new ItemManage().InsertItem(objItem); } else { new ItemManage().UpdateItem(objItem); } } var result = new OrderManage().UpdateOrder(_objOrder); if (result > 0) { MessageBox.Show(zh?"成功修改订单":"Modifying Order Sucessfully!"); EvtSendMsg("open"); Close(); } #endregion }
private void btnOkay_Click(object sender, EventArgs e) { #region Validation for Transaction if (tbSellingPrice.Text.Trim().Length == 0) { ShowError(zh?"在关闭订单前,请输入售价":"Please fill the selling price before submitting", tbSellingPrice, lbError); return; } if (Regex.IsMatch(tbSellingPrice.Text, "[^0-9]")) //区分不是字母,而是数字 { if (!Regex.IsMatch(tbSellingPrice.Text, @"^(-?\d+)(\.\d+)?$")) { //不是小数 ShowError(zh?"只允许输入数字":"Please input only number", tbSellingPrice, lbError); return; } else { HideError(tbSellingPrice, lbError); lbError.Text = tbSellingPrice.Text.Trim(); } } else { HideError(tbSellingPrice, lbError); } if (tbPurchasingPrice.Text.Trim().Length == 0) { ShowError(zh?"在关闭订单前,请输入进价":"Please fill the purchasing price before submitting", tbPurchasingPrice, lbError); return; } if (Regex.IsMatch(tbPurchasingPrice.Text, "[^0-9]")) //区分不是字母,而是数字 { if (!Regex.IsMatch(tbPurchasingPrice.Text, @"^(-?\d+)(\.\d+)?$")) { //不是小数 ShowError(zh?"只允许输入数字":"Please input only number", tbPurchasingPrice, lbError); return; } else { HideError(tbPurchasingPrice, lbError); lbError.Text = tbPurchasingPrice.Text.Trim(); } } else { HideError(tbPurchasingPrice, lbError); } #endregion #region Update price tbProfit.Text = (Convert.ToDouble(tbSellingPrice.Text.Trim()) - Convert.ToDouble(tbPurchasingPrice.Text.Trim())) .ToString(); objTransaction.SellingPrice = Convert.ToDouble(tbSellingPrice.Text.Trim()); objTransaction.PurchasePrice = Convert.ToDouble(tbPurchasingPrice.Text.Trim()); objTransaction.Profit = Convert.ToDouble(tbProfit.Text); if (tbSellingPrice.Text.Length != 0 && tbPurchasingPrice.Text.Length != 0) { objTransaction.OrderStatus = Convert.ToByte(true); } var result = new TransactionManage().UpdateTransactionRecord(objTransaction); if (result > 0) { MessageBox.Show(zh?"更新成功!":"Updating Sucessfully!"); } #endregion Close(); }