private void DataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1) { return; } int digit = GlobalUtils.DecimalDigits; decimal goujinzonge = 0, goujinzhongliang = 0, xiaoshouzonge = 0, xiaoshouzhongliang = 0, yunfei = 0; for (int i = 0; i < dataGridView1.SelectedRows.Count; ++i) { var model = DgvDataSourceToList()[dataGridView1.SelectedRows[i].Index]; goujinzonge += DecimalHandler.Parse(model.TotalPurchase.ToString()); goujinzhongliang += DecimalHandler.Parse(model.PurchaseAmount.ToString()); xiaoshouzonge += DecimalHandler.Parse(model.TotalSale.ToString()); xiaoshouzhongliang += DecimalHandler.Parse(model.SaleAmount.ToString()); yunfei += DecimalHandler.Parse(model.TransportCost.ToString()); } lbTotalCount.Text = string.Format("选中{5}项 合计: 购进额 {0} 购进量 {1} 销售总额 {2} 销售量 {3} 运费 {4}", DecimalHandler.DecimalToString(goujinzonge, digit), DecimalHandler.DecimalToString(goujinzhongliang, digit), DecimalHandler.DecimalToString(xiaoshouzonge, digit), DecimalHandler.DecimalToString(xiaoshouzhongliang, digit), DecimalHandler.DecimalToString(yunfei, digit), dataGridView1.SelectedRows.Count); if (goujinzonge == 0) { //lbCount1.Text = string.Format("利润 {0} 利润率 {1}", //DecimalHandler.DecimalToString(xiaoshouzonge - goujinzonge), -1); } }
private void UpdateTotalSale(object sender, EventArgs e) { txtTotalSale.Text = DecimalHandler.DecimalToString( DecimalHandler.Parse(txtSalePrice.Text) * DecimalHandler.Parse(txtAmount.Text) ); }
private void UpdateJianChiLv(object sender, EventArgs e) { decimal amount = DecimalHandler.Parse(txtAmount.Text); decimal amountPurchase = _purchaseInfoModel.Amount ?? 0; txtJianChiLv.Text = DecimalHandler.DecimalToPercent(amount / amountPurchase); }
private void DataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1) { return; } int digit = GlobalUtils.DecimalDigits; decimal amountTotal = 0, duizhang = 0, invoicenum = 0, receiptnum = 0; for (int i = 0; i < dataGridView1.SelectedRows.Count; ++i) { var model = DgvDataSourceToList()[dataGridView1.SelectedRows[i].Index]; amountTotal += DecimalHandler.Parse(model.Amount.ToString()); duizhang += DecimalHandler.Parse(model.DuiZhang.ToString()); invoicenum += DecimalHandler.Parse(model.InvoiceNum.ToString()); receiptnum += DecimalHandler.Parse(model.ReceiptNum.ToString()); } lbTotalCount.Text = string.Format("选中{4}项 合计: 金额 {0} 对账 {1} 开票金额 {2} 收款金额 {3}", DecimalHandler.DecimalToString(amountTotal, digit), DecimalHandler.DecimalToString(duizhang, digit), DecimalHandler.DecimalToString(invoicenum, digit), DecimalHandler.DecimalToString(receiptnum, digit), dataGridView1.SelectedRows.Count ); }
private void UpdatePrice(object sender, EventArgs e) { decimal quote = DecimalHandler.Parse(txtQuote.Text); decimal fluctuation = DecimalHandler.Parse(txtFluctuation1.Text); decimal transportCost = DecimalHandler.Parse(txtTransportCost.Text); txtPrice.Text = DecimalHandler.DecimalToString(quote + fluctuation + transportCost); }
private void UpdateSalePrice(object sender, EventArgs e) { txtSalePrice.Text = DecimalHandler.DecimalToString( DecimalHandler.Parse(txtOnlinePrice.Text) + DecimalHandler.Parse(txtFluctuation1.Text) + DecimalHandler.Parse(txtFluctuation2.Text) ); }
private void UpdateMarginRate(object sender, EventArgs e) { try { txtMarginRate.Text = DecimalHandler.DecimalToPercent( (DecimalHandler.Parse(txtTotalSale.Text) / _purchaseInfoModel.TotalMoney ?? 0) - 1 ); } catch (Exception) { txtMarginRate.Text = "供应商总金额有误!"; } }
private void DataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1 || dataGridView1.Rows.Count < 1) { return; } int digit = GlobalUtils.DecimalDigits; decimal[] total = new decimal[10]; for (int i = 0; i < dataGridView1.SelectedRows.Count; ++i) { var model = DgvDataSourceToList()[dataGridView1.SelectedRows[i].Index]; if (model == null) { return; } total[0] += DecimalHandler.Parse(model.TotalSale.ToString()); total[1] += DecimalHandler.Parse(model.InvoiceNum.ToString()); total[2] += DecimalHandler.Parse(model.FaHuoWeiKaiPiao.ToString()); total[3] += DecimalHandler.Parse(model.ReceiptNum.ToString()); total[4] += DecimalHandler.Parse(model.ZhangMianQianKuan.ToString()); total[5] += DecimalHandler.Parse(model.JinChangWeiYanShou.ToString()); total[6] += DecimalHandler.Parse(model.ZongQianKuan.ToString()); total[7] += DecimalHandler.Parse(model.WeiDuiZhang.ToString()); total[8] += DecimalHandler.Parse(model.DuiZhangWeiKaiPiao.ToString()); total[9] += DecimalHandler.Parse(model.DuiZhangNum.ToString()); } lbTotalCount.Text = string.Format("选中{10}项 合计: 发货金额(销总金额) {0} 验收(发票) {1} 发货未开票 {2} " + "已付款 {3} 账面欠款 {4} 进场未验收 {5} 总欠款 {6} 未对账 {7} 对账未开票 {8} 已对账{9}", DecimalHandler.DecimalToString(total[0], digit), DecimalHandler.DecimalToString(total[1], digit), DecimalHandler.DecimalToString(total[2], digit), DecimalHandler.DecimalToString(total[3], digit), DecimalHandler.DecimalToString(total[4], digit), DecimalHandler.DecimalToString(total[5], digit), DecimalHandler.DecimalToString(total[6], digit), DecimalHandler.DecimalToString(total[7], digit), DecimalHandler.DecimalToString(total[8], digit), DecimalHandler.DecimalToString(total[9], digit), dataGridView1.SelectedRows.Count ); }
private void DataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1) { return; } int digit = GlobalUtils.DecimalDigits; decimal amountTotal = 0; for (int i = 0; i < dataGridView1.SelectedRows.Count; ++i) { var model = DgvDataSourceToList()[dataGridView1.SelectedRows[i].Index]; amountTotal += DecimalHandler.Parse(model.Amount.ToString()); } lbTotalCount.Text = string.Format("选中{1}项 合计: 金额 {0}", DecimalHandler.DecimalToString(amountTotal, digit), dataGridView1.SelectedRows.Count ); }
private void DataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1) { return; } int digit = GlobalUtils.DecimalDigits; decimal songhuoliang = 0, zongjine = 0; for (int i = 0; i < dataGridView1.SelectedRows.Count; ++i) { var model = DgvDataSourceToList()[dataGridView1.SelectedRows[i].Index]; songhuoliang += DecimalHandler.Parse(model.Amount.ToString()); zongjine += DecimalHandler.Parse(model.TotalSale.ToString()); } lbTotalCount.Text = string.Format("选中{2}项 合计: 送货量 {0}(t) 销总金额 {1}", DecimalHandler.DecimalToString(songhuoliang, digit), DecimalHandler.DecimalToString(zongjine, digit), dataGridView1.SelectedRows.Count); }
private void DataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1) { return; } int digit = GlobalUtils.DecimalDigits; decimal songhuoliang = 0, zongjine = 0, fukuanjine = 0, fapiaojine = 0; for (int i = 0; i < dataGridView1.SelectedRows.Count; ++i) { var model = DgvDataSourceToList()[dataGridView1.SelectedRows[i].Index]; songhuoliang += DecimalHandler.Parse(model.Amount.ToString()); zongjine += DecimalHandler.Parse(model.TotalMoney.ToString()); fukuanjine += DecimalHandler.Parse(model.Money1.ToString()); fapiaojine += DecimalHandler.Parse(model.Money2.ToString()); } //lbTotalCount.Text = string.Format("选中{4}项 合计: 送货量 {0}(t) 总金额 {1} 付款金额 {2} 发票金额 {3}", // DecimalHandler.DecimalToString(songhuoliang, digit), // DecimalHandler.DecimalToString(zongjine, digit), // DecimalHandler.DecimalToString(fukuanjine, digit), // DecimalHandler.DecimalToString(fapiaojine, digit), // dataGridView1.SelectedRows.Count); //lbTotalCount.Text += string.Format(" 欠款 {0} 欠票 {1}", // DecimalHandler.DecimalToString(zongjine - fukuanjine, digit), // DecimalHandler.DecimalToString(zongjine - fapiaojine, digit)); lbTotalCount.Text = string.Format("选中{3}项 合计: 送货量 {0}(t) 总金额 {1} 发票金额 {2}", DecimalHandler.DecimalToString(songhuoliang, digit), DecimalHandler.DecimalToString(zongjine, digit), DecimalHandler.DecimalToString(fapiaojine, digit), dataGridView1.SelectedRows.Count); lbTotalCount.Text += string.Format(" 欠票 {0}", DecimalHandler.DecimalToString(zongjine - fukuanjine, digit)); }
private void btnOK_Click(object sender, EventArgs e) { if (_is4Modify) { try { _model.Corporation = txtCorporation.Text; if (string.IsNullOrEmpty(txtProject.Text)) { MessageBoxEx.Show("必须填写项目名称!"); return; } _model.Project = txtProject.Text; _model.Supplier = txtSupplier.Text; _model.Amount = DecimalHandler.Parse(txtAmount.Text); _model.DuiZhang = DecimalHandler.Parse(txtDuiZhang.Text); _model.InvoiceDate = DateTime.Parse(txtInvoiceDate.Text); _model.ReceiptDate = DateTime.Parse(txtReceiptDate.Text); _model.InvoiceNum = DecimalHandler.Parse(txtInvoiceNum.Text); _model.ReceiptNum = DecimalHandler.Parse(txtReceiptNum.Text); //下面的字段暂时不进行修改 //_model.EntryTime = DateTime.Now; //_model.SerialNo = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type03Receipt); //_model.OperatorId = GlobalUtils.LoginUser.Id; if (!_bllSaleBill.Update(_model)) { MessageBoxEx.Show("更新失败,请稍后重试!"); return; } MessageBoxEx.Show("更新成功!"); _updateDel(_curPage); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!"); //throw; } } else { SteelManagement.Model.SaleBill model = new SteelManagement.Model.SaleBill(); try { model.Corporation = txtCorporation.Text; if (string.IsNullOrEmpty(txtProject.Text)) { MessageBoxEx.Show("必须填写项目名称!"); return; } model.Project = txtProject.Text; model.Supplier = txtSupplier.Text; model.Amount = DecimalHandler.Parse(txtAmount.Text); model.DuiZhang = DecimalHandler.Parse(txtDuiZhang.Text); model.InvoiceDate = DateTime.Parse(txtInvoiceDate.Text); model.ReceiptDate = DateTime.Parse(txtReceiptDate.Text); model.InvoiceNum = DecimalHandler.Parse(txtInvoiceNum.Text); model.ReceiptNum = DecimalHandler.Parse(txtReceiptNum.Text); model.EntryTime = DateTime.Now; model.SerialNo = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type05SaleBill); model.OperatorId = GlobalUtils.LoginUser.Id; if (_bllSaleBill.Add(model) <= 0) { MessageBoxEx.Show("添加失败,请稍后重试!"); return; } MessageBoxEx.Show("添加成功"); _updateDel(_curPage); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!"); //throw; } } }
private void btnOK_Click(object sender, EventArgs e) { if (_is4Modify) { try { _model.DiaoZhuang = DecimalHandler.Parse(txtDiaoZhuang.Text); _model.LiXi = DecimalHandler.Parse(txtLiXi.Text); _model.ChengDui = DecimalHandler.Parse(txtChengDui.Text); _model.OtherCost = DecimalHandler.Parse(txtOtherCost.Text); _model.TieXi = DecimalHandler.Parse(txtTieXi.Text); _model.Corporation = txtCorporation.Text; if (string.IsNullOrEmpty(txtProject.Text)) { MessageBoxEx.Show("必须填写项目名称!"); return; } _model.Project = txtProject.Text; _model.Dateline = DateTime.Parse(txtDateline.Text); _model.Supplier = txtSupplier.Text; _model.Brand = txtBrand.Text; _model.TransportWay = txtTransportWay.Text; _model.Size = txtSize.Text; _model.Texture = txtTexture.Text; _model.Amount = DecimalHandler.Parse(txtAmount.Text); _model.Quote = DecimalHandler.Parse(txtQuote.Text); _model.Fluctuation1 = DecimalHandler.Parse(txtFluctuation1.Text); _model.TransportCost = DecimalHandler.Parse(txtTransportCost.Text); _model.Price = DecimalHandler.Parse(txtPrice.Text); _model.TotalMoney = DecimalHandler.Parse(txtTotalMoney.Text); _model.FuYuDate = DateTime.Parse(txtFuYuDate.Text); _model.Money1 = DecimalHandler.Parse(txtMoney1.Text); _model.InvoiceDate = DateTime.Parse(txtInvoiceDate.Text); _model.Money2 = DecimalHandler.Parse(txtMoney2.Text); if (!_bllPurchaseInfo.Update(_model)) { MessageBoxEx.Show("更新失败,请稍后重试!"); return; } MessageBoxEx.Show("更新成功!"); _updateDel(_curPage); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!"); //throw; } } else { SteelManagement.Model.PurchaseInfo model = new SteelManagement.Model.PurchaseInfo(); try { model.Corporation = txtCorporation.Text; if (string.IsNullOrEmpty(txtProject.Text)) { MessageBoxEx.Show("必须填写项目名称!"); return; } model.Project = txtProject.Text; model.Dateline = DateTime.Parse(txtDateline.Text); model.Supplier = txtSupplier.Text; model.Brand = txtBrand.Text; model.TransportWay = txtTransportWay.Text; model.Size = txtSize.Text; model.Texture = txtTexture.Text; model.Amount = DecimalHandler.Parse(txtAmount.Text); model.Quote = DecimalHandler.Parse(txtQuote.Text); model.Fluctuation1 = DecimalHandler.Parse(txtFluctuation1.Text); model.TransportCost = DecimalHandler.Parse(txtTransportCost.Text); model.Price = DecimalHandler.Parse(txtPrice.Text); model.TotalMoney = DecimalHandler.Parse(txtTotalMoney.Text); model.FuYuDate = DateTime.Parse(txtFuYuDate.Text); model.Money1 = DecimalHandler.Parse(txtMoney1.Text); model.InvoiceDate = DateTime.Parse(txtInvoiceDate.Text); model.Money2 = DecimalHandler.Parse(txtMoney2.Text); model.EntryTime = DateTime.Now; model.SerialNo = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type01Purchase);//生成流水号 model.OperatorId = GlobalUtils.LoginUser.Id; model.DiaoZhuang = DecimalHandler.Parse(txtDiaoZhuang.Text); model.LiXi = DecimalHandler.Parse(txtLiXi.Text); model.ChengDui = DecimalHandler.Parse(txtChengDui.Text); model.OtherCost = DecimalHandler.Parse(txtOtherCost.Text); model.TieXi = DecimalHandler.Parse(txtTieXi.Text); if (_bllPurchaseInfo.Add(model) <= 0) { MessageBoxEx.Show("添加失败,请稍后重试!"); return; } MessageBoxEx.Show("添加成功"); _updateDel(_curPage); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!"); //throw; } } }
private void UpdateTotalMoney(object sender, EventArgs e) { decimal totalMoney = DecimalHandler.Parse(txtPrice.Text) * DecimalHandler.Parse(txtAmount.Text); txtTotalMoney.Text = DecimalHandler.DecimalToString(totalMoney); }
private void btnOK_Click(object sender, EventArgs e) { if (_is4Modify) { try { //_model.JianChiLv = DecimalHandler.Parse(txtJianChiLv.Text); //_model.ArrivalTime = DateTime.Parse(txtArrivalTime.Text); //_model.SettleTime = DateTime.Parse(txtSettleTime.Text); //_model.Supplier = txtSupplier.Text; //_model.Brand = txtBrand.Text; //_model.TransportWay = txtTransportWay.Text; //_model.Size = txtSize.Text; //_model.Texture = txtTexture.Text; //_model.Amount = DecimalHandler.Parse(txtAmount.Text); //_model.Margin = DecimalHandler.Parse(txtMargin.Text); //_model.OnlinePrice = DecimalHandler.Parse(txtOnlinePrice.Text); //_model.Fluctuation1 = DecimalHandler.Parse(txtFluctuation1.Text); //_model.Fluctuation2 = DecimalHandler.Parse(txtFluctuation2.Text); //_model.SalePrice = DecimalHandler.Parse(txtSalePrice.Text); //_model.TotalSale = DecimalHandler.Parse(txtTotalSale.Text); //_model.MarginRate = DecimalHandler.Parse(txtMarginRate.Text); if (!_bllReceiptInfo.Update(_model)) { MessageBoxEx.Show("更新失败,请稍后重试!"); return; } MessageBoxEx.Show("更新成功!"); _updateDel(_curPage); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!"); //throw; } } else { SteelManagement.Model.ReceiptInfo model = new SteelManagement.Model.ReceiptInfo(); try { model.InvoiceDate = DateTime.Parse(txtInvoiceDate.Text); model.ReceiptDate = DateTime.Parse(txtReceiptDate.Text); model.InvoiceNum = DecimalHandler.Parse(txtInvoiceNum.Text); model.ReceiptNum = DecimalHandler.Parse(txtReceiptNum.Text); model.EntryTime = DateTime.Now; model.SerialNo = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type03Receipt); model.OperatorId = GlobalUtils.LoginUser.Id; //上传图像 proPictureBox1.Image?.Save(GlobalUtils.LocalReceiptPicPath + "\\" + model.SerialNo + ".jpg"); if (_bllReceiptInfo.Add(model) <= 0) { MessageBoxEx.Show("添加失败,请稍后重试!"); return; } MessageBoxEx.Show("添加成功"); _updateDel(_curPage); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!"); //throw; } } }
public static List <Model.SteelInfo> GetSteelListFromExcel(string filename, DateTime time) { //1.创建工作簿对象 IWorkbook wkbook = null; try { if (Path.GetExtension(filename).Equals(".xls")) { wkbook = new HSSFWorkbook(new FileStream(filename, FileMode.Open)); } else if (Path.GetExtension(filename).Equals(".xlsx")) { wkbook = new XSSFWorkbook(new FileStream(filename, FileMode.Open)); } else { MessageBoxEx.Show("打开文件错误,请重试!"); return(null); } } catch (Exception) { MessageBoxEx.Show("文件占用,请关闭Excel后再打开文件!"); return(null); } //2.创建工作表对象 ISheet sheet = wkbook.GetSheet("sheet1"); List <Model.SteelInfo> res = new List <SteelInfo>(); for (int i = 0; i <= sheet.LastRowNum; ++i) { try { var row = sheet.GetRow(i); Model.SteelInfo model = new SteelInfo(); model.EntryTime = DateTime.Now; model.Name = row.GetCell(0)?.StringCellValue; model.Size = row.GetCell(1)?.StringCellValue; model.Texture = row.GetCell(2)?.StringCellValue; model.ProducePlace = row.GetCell(3)?.StringCellValue; model.Price = DecimalHandler.Parse(row.GetCell(4)?.NumericCellValue.ToString()); model.InfoTime = time; try { model.Fluctuation = DecimalHandler.Parse(row.GetCell(5)?.NumericCellValue.ToString()); } catch (Exception) { try { if (row.GetCell(5)?.StringCellValue == "-") { model.Fluctuation = null; } } catch (Exception e) { throw e; } } model.Remark = row.GetCell(6)?.StringCellValue; model.State = row.GetCell(7)?.StringCellValue; res.Add(model); } catch (Exception) { MessageBoxEx.Show("第" + (i + 1) + "行数据有误"); } } return(res.Count == 0 ? null : res); }
private void btnOK_Click(object sender, EventArgs e) { if (_is4Modify) { try { _model.Corporation = txtCorporation.Text; if (string.IsNullOrEmpty(txtProject.Text)) { MessageBoxEx.Show("项目名称不能为空!"); return; } _model.Project = txtProject.Text; _model.TieXi = DecimalHandler.Parse(txtTieXi.Text); _model.LiXi = DecimalHandler.Parse(txtLiXi.Text); _model.JianChiLv = DecimalHandler.Parse(txtJianChiLv.Text); _model.ArrivalTime = DateTime.Parse(txtArrivalTime.Text); _model.SettleTime = DateTime.Parse(txtSettleTime.Text); _model.Supplier = txtSupplier.Text; _model.Brand = txtBrand.Text; _model.TransportWay = txtTransportWay.Text; _model.Size = txtSize.Text; _model.Texture = txtTexture.Text; _model.Amount = DecimalHandler.Parse(txtAmount.Text); _model.Margin = DecimalHandler.Parse(txtMargin.Text); _model.OnlinePrice = DecimalHandler.Parse(txtOnlinePrice.Text); _model.Fluctuation1 = DecimalHandler.Parse(txtFluctuation1.Text); _model.Fluctuation2 = DecimalHandler.Parse(txtFluctuation2.Text); _model.SalePrice = DecimalHandler.Parse(txtSalePrice.Text); _model.TotalSale = DecimalHandler.Parse(txtTotalSale.Text); _model.MarginRate = DecimalHandler.Parse(txtMarginRate.Text); if (!_bllSaleInfo.Update(_model)) { MessageBoxEx.Show("更新失败,请稍后重试!"); return; } MessageBoxEx.Show("更新成功!"); _updateDel(_curPage); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!"); //throw; } } else { SteelManagement.Model.SaleInfo model = new SteelManagement.Model.SaleInfo(); try { model.Corporation = txtCorporation.Text; if (string.IsNullOrEmpty(txtProject.Text)) { MessageBoxEx.Show("项目名称不能为空!"); return; } model.Project = txtProject.Text; model.TieXi = DecimalHandler.Parse(txtTieXi.Text); model.LiXi = DecimalHandler.Parse(txtLiXi.Text); model.JianChiLv = DecimalHandler.Parse(txtJianChiLv.Text); model.ArrivalTime = DateTime.Parse(txtArrivalTime.Text); model.SettleTime = DateTime.Parse(txtSettleTime.Text); model.Supplier = txtSupplier.Text; model.Brand = txtBrand.Text; model.TransportWay = txtTransportWay.Text; model.Size = txtSize.Text; model.Texture = txtTexture.Text; model.Amount = DecimalHandler.Parse(txtAmount.Text); model.Margin = DecimalHandler.Parse(txtMargin.Text); model.OnlinePrice = DecimalHandler.Parse(txtOnlinePrice.Text); model.Fluctuation1 = DecimalHandler.Parse(txtFluctuation1.Text); model.Fluctuation2 = DecimalHandler.Parse(txtFluctuation2.Text); model.SalePrice = DecimalHandler.Parse(txtSalePrice.Text); model.TotalSale = DecimalHandler.Parse(txtTotalSale.Text); model.MarginRate = DecimalHandler.Parse(txtMarginRate.Text); model.EntryTime = DateTime.Now; model.SerialNo = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type02Sale); model.OperatorId = GlobalUtils.LoginUser.Id; if (_bllSaleInfo.Add(model) <= 0) { MessageBoxEx.Show("添加失败,请稍后重试!"); return; } MessageBoxEx.Show("添加成功"); _updateDel(_curPage); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!"); //throw; } } }
private void UpdateMargin(object sender, EventArgs e) { decimal onlinePrice = DecimalHandler.Parse(txtOnlinePrice.Text); txtMargin.Text = DecimalHandler.DecimalToString(onlinePrice - _purchaseInfoModel.Quote ?? 0); }