private void toolEdit_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.CurrentRow == null) { return; } modSalesDesignForm mod = (modSalesDesignForm)DBGrid.CurrentRow.DataBoundItem; EditDesignForm frm = new EditDesignForm(); frm.EditItem(mod.Id); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void DBGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.CurrentRow == null) { return; } modSalesDesignForm mod = (modSalesDesignForm)DBGrid.CurrentRow.DataBoundItem; switch (DBGrid.Columns[e.ColumnIndex].Name) { case "ReceiveStatus": case "ReceiveDate": case "AccountNo": _dal.UpdateReceiveStatus(mod.Id, mod.ReceiveStatus, mod.ReceiveDate, mod.AccountNo, Util.UserId, out Util.emsg); if (DBGrid.Columns[e.ColumnIndex].Name == "ReceiveStatus" && mod.ReceiveStatus == 1) { DBGrid.CurrentRow.Cells["ReceiveDate"].Value = DateTime.Today.ToString("yyyy-MM-dd"); } break; case "InvoiceStatus": case "InvoiceNo": case "InvoiceMny": _dal.UpdateInvoiceStatus(mod.Id, mod.InvoiceStatus, mod.InvoiceMny, mod.InvoiceNo, Util.UserId, out Util.emsg); break; } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolDel_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.CurrentRow == null) { return; } if (MessageBox.Show(clsTranslate.TranslateString("Do you really want to delete it?"), clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } modSalesDesignForm mod = _dal.GetItem(Convert.ToInt32(DBGrid.CurrentRow.Cells[0].Value), out Util.emsg); if (mod.Status == 1) { MessageBox.Show("该单据已审核,您不能删除!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } bool ret = _dal.Delete(mod.Id, out Util.emsg); if (ret) { LoadData(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void AddItem(string sheetname, modSalesDesignForm modd, string col, ref IList <modExcelRangeData> list) { switch (sheetname) { case "蓝图对帐单": list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "B" + col)); //list.Add(new modExcelRangeData(modd.No, "C" + col, "C" + col)); list.Add(new modExcelRangeData(modd.FormDate.ToString("yyyy-MM-dd"), "D" + col, "D" + col)); list.Add(new modExcelRangeData(modd.CustOrderNo, "E" + col, "E" + col)); list.Add(new modExcelRangeData(modd.UnitNo, "F" + col, "F" + col)); list.Add(new modExcelRangeData((modd.Qty * modd.AdFlag).ToString(), "G" + col, "G" + col)); list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Mny / modd.Qty), "H" + col, "H" + col)); list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Mny * modd.AdFlag), "I" + col, "I" + col)); list.Add(new modExcelRangeData(modd.Remark, "J" + col, "J" + col)); break; case "威廉姆对帐单": list.Add(new modExcelRangeData(modd.FormDate.ToString("yyyy-MM-dd"), "B" + col, "B" + col)); list.Add(new modExcelRangeData(modd.No, "C" + col, "C" + col)); list.Add(new modExcelRangeData(modd.CustOrderNo, "E" + col, "E" + col)); list.Add(new modExcelRangeData(modd.ProductName, "F" + col, "F" + col)); list.Add(new modExcelRangeData((modd.Qty * modd.AdFlag).ToString(), "I" + col, "I" + col)); list.Add(new modExcelRangeData(modd.UnitNo, "J" + col, "J" + col)); if (modd.Qty > 0) { list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Mny / modd.Qty), "K" + col, "K" + col)); } list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Mny * modd.AdFlag), "L" + col, "L" + col)); break; case "深科达对帐单": list.Add(new modExcelRangeData(modd.FormDate.ToString("yyyy-MM-dd"), "A" + col, "A" + col)); list.Add(new modExcelRangeData(modd.No, "B" + col, "B" + col)); list.Add(new modExcelRangeData(modd.ProductName, "C" + col, "C" + col)); list.Add(new modExcelRangeData(modd.ProductName, "D" + col, "D" + col)); //list.Add(new modExcelRangeData(modd.Specify, "F" + col, "F" + col)); list.Add(new modExcelRangeData(modd.CustOrderNo, "G" + col, "G" + col)); list.Add(new modExcelRangeData(modd.UnitNo, "I" + col, "I" + col)); list.Add(new modExcelRangeData((modd.Qty * modd.AdFlag).ToString(), "J" + col, "J" + col)); if (modd.Qty > 0) { list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Mny / modd.Qty), "K" + col, "K" + col)); } list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Mny * modd.AdFlag), "L" + col, "L" + col)); list.Add(new modExcelRangeData(modd.Remark, "M" + col, "M" + col)); break; default: list.Add(new modExcelRangeData(modd.FormDate.ToString("yyyy-MM-dd"), "A" + col, "A" + col)); list.Add(new modExcelRangeData(modd.CustOrderNo, "B" + col, "B" + col)); list.Add(new modExcelRangeData(modd.No, "C" + col, "C" + col)); list.Add(new modExcelRangeData(modd.ProductName, "D" + col, "E" + col)); //list.Add(new modExcelRangeData(modd.Specify, "F" + col, "F" + col)); list.Add(new modExcelRangeData((modd.Qty * modd.AdFlag).ToString(), "G" + col, "G" + col)); if (modd.Qty > 0) { list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Mny / modd.Qty), "H" + col, "H" + col)); } list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Mny * modd.AdFlag), "I" + col, "I" + col)); list.Add(new modExcelRangeData(modd.Remark, "J" + col, "J" + col)); break; } }
private void mnuSalesStatement_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.RowCount == 0) { return; } IList <modExcelRangeData> list = new List <modExcelRangeData>(); string custid = string.Empty; string custname = string.Empty; string sheetname = string.Empty; int copies = 1; int pagesize = 1; int pagerows = 1; int pagecols = 1; int titleindex = 1; int datarows = 0; if (DBGrid.SelectedRows.Count == 0) { for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Visible) { datarows++; } } } else { for (int i = 0; i < DBGrid.SelectedRows.Count; i++) { if (DBGrid.SelectedRows[i].Visible) { datarows++; } } } string company = clsLxms.GetParameterValue("COMPANY_NAME"); switch (company) { case "深圳市蓝图净化用品有限公司": sheetname = "蓝图对帐单"; pagesize = 17; pagerows = 30; pagecols = 10; titleindex = 11; copies = datarows / pagesize; if (datarows % pagesize > 0) { copies++; } break; default: switch (custname) { case "威廉姆": sheetname = "威廉姆对帐单"; pagesize = 19; pagerows = 36; pagecols = 12; titleindex = 6; copies = datarows / pagesize; if (datarows % pagesize > 0) { copies++; } break; case "深科达": case "深圳市深科达气动设备有限": sheetname = "深科达对帐单"; pagesize = 17; pagerows = 31; pagecols = 13; titleindex = 8; copies = datarows / pagesize; if (datarows % pagesize > 0) { copies++; } break; default: sheetname = "普通对帐单"; pagesize = 22; pagerows = 36; pagecols = 10; titleindex = 10; copies = datarows / pagesize; if (datarows % pagesize > 0) { copies++; } break; } break; } int currrow = 0; if (DBGrid.SelectedRows.Count == 0) { for (int iCopy = 0; iCopy < copies; iCopy++) { int rowindex = 0; decimal pagesum = 0; while (rowindex < pagesize && currrow < DBGrid.RowCount) { if (currrow < DBGrid.RowCount && DBGrid.Rows[currrow].Visible) { if (string.IsNullOrEmpty(custid)) { custid = DBGrid.Rows[currrow].Cells["CustId"].Value.ToString(); custname = DBGrid.Rows[currrow].Cells["CustName"].Value.ToString(); AddHeader(sheetname, pagerows, iCopy, custid, ref list); } else if (custid.CompareTo(DBGrid.Rows[currrow].Cells["CustId"].Value.ToString()) != 0) { MessageBox.Show("您所选择的单据必须属于同一个客户!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } modSalesDesignForm modd = (modSalesDesignForm)DBGrid.Rows[currrow].DataBoundItem; string col = (iCopy * pagerows + titleindex + rowindex).ToString().Trim(); AddItem(sheetname, modd, col, ref list); rowindex++; pagesum += modd.Mny; } currrow++; } AddFoot(sheetname, pagerows, iCopy, copies, pagesum, ref list); } } else { for (int iCopy = 0; iCopy < copies; iCopy++) { int rowindex = 0; decimal pagesum = 0; while (rowindex < pagesize && currrow < DBGrid.SelectedRows.Count) { if (DBGrid.SelectedRows[currrow].Visible) { if (string.IsNullOrEmpty(custid)) { custid = DBGrid.SelectedRows[currrow].Cells["CustId"].Value.ToString(); custname = DBGrid.SelectedRows[currrow].Cells["CustName"].Value.ToString(); AddHeader(sheetname, pagerows, iCopy, custid, ref list); } else if (custid.CompareTo(DBGrid.SelectedRows[currrow].Cells["CustId"].Value.ToString()) != 0) { MessageBox.Show("您所选择的单据必须属于同一个客户!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } modSalesDesignForm modd = (modSalesDesignForm)DBGrid.SelectedRows[currrow].DataBoundItem; string col = (iCopy * pagerows + titleindex + rowindex).ToString().Trim(); AddItem(sheetname, modd, col, ref list); rowindex++; pagesum += modd.Mny; } currrow++; } AddFoot(sheetname, pagerows, iCopy, copies, pagesum, ref list); } } clsExport.ExportByTemplate(list, sheetname, 1, pagerows, pagecols, copies); } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { this.Cursor = Cursors.Default; } }
private void toolReset_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.RowCount == 0) { return; } if (DBGrid.SelectedRows.Count == 0 && DBGrid.CurrentRow == null) { return; } if (MessageBox.Show(clsTranslate.TranslateString("Do you really want to reset it?"), clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (DBGrid.SelectedRows.Count == 0) { modSalesDesignForm mod = _dal.GetItem(Convert.ToInt32(DBGrid.CurrentRow.Cells[0].Value), out Util.emsg); if (mod.AccSeq > 0) { MessageBox.Show("该单据已做凭证,不可重置!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (_dal.Reset(mod.Id, Util.UserId, out Util.emsg)) { MessageBox.Show(clsTranslate.TranslateString("Reset Success!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); LoadData(); } else { MessageBox.Show(clsTranslate.TranslateString(Util.emsg), mod.Id.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } else { for (int i = DBGrid.SelectedRows.Count - 1; i >= 0; i--) { modSalesDesignForm mod = _dal.GetItem(Convert.ToInt32(DBGrid.SelectedRows[i].Cells[0].Value), out Util.emsg); if (mod.AccSeq > 0) { MessageBox.Show("该单据已做凭证,不可重置!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (_dal.Reset(mod.Id, Util.UserId, out Util.emsg)) { DBGrid.SelectedRows[i].Cells["status"].Value = 0; DBGrid.SelectedRows[i].DefaultCellStyle.ForeColor = Color.Black; DBGrid.SelectedRows[i].Selected = false; } else { MessageBox.Show(clsTranslate.TranslateString(Util.emsg), mod.Id.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } LoadData(); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
public void EditItem(int id) { try { this.Cursor = Cursors.WaitCursor; _action = "EDIT"; FillControl.FillDesignType(cboDesignType, false); FillControl.FillReceiveStatus(cboReceiveStatus, false); FillControl.FillInvoiceStatus(cboInvoiceStatus, false); modSalesDesignForm mod = _dal.GetItem(id, out Util.emsg); if (mod != null) { txtId.Text = id.ToString(); dtpFormDate.Value = mod.FormDate; cboDesignType.SelectedValue = mod.FormType; txtCustOrderNo.Text = mod.CustOrderNo; txtNo.Text = mod.No; txtCurrency.Text = mod.Currency; txtCustName.Tag = mod.CustId; txtCustName.Text = mod.CustName; txtPayMethod.Text = mod.PayMethod; txtSalesMan.Text = mod.SalesMan; txtUnitNo.Text = mod.UnitNo; txtQty.Text = mod.Qty.ToString(); txtMny.Text = mod.Mny.ToString(); txtSalesManMny.Text = mod.SalesManMny.ToString(); txtProductName.Text = mod.ProductName; txtRemark.Text = mod.Remark; cboReceiveStatus.SelectedIndex = Convert.ToInt32(mod.ReceiveStatus); cboAccountNo.SelectedValue = mod.AccountNo; txtReceiveDate.Text = mod.ReceiveDate; cboInvoiceStatus.SelectedIndex = mod.InvoiceStatus; txtInvoiceMny.Text = mod.InvoiceMny.ToString(); txtInvoiceNo.Text = mod.InvoiceNo; if (mod.Status == 1) { status4.Image = Properties.Resources.audited; Util.ChangeStatus(this, true); toolSave.Enabled = false; } else { status4.Image = null; toolSave.Visible = true; Util.ChangeStatus(this, false); txtId.ReadOnly = true; toolSave.Enabled = true; } cboReceiveStatus.Enabled = true; cboInvoiceStatus.Enabled = true; cboAccountNo.Enabled = true; txtInvoiceMny.ReadOnly = false; txtInvoiceNo.ReadOnly = false; btnUpdate.Enabled = true; btnReceiveDate.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (dtpFormDate.Value < Util.modperiod.StartDate) { MessageBox.Show("该日期的数据已锁定,不能更新数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); dtpFormDate.Focus(); return; } if (cboDesignType.SelectedValue == null || string.IsNullOrEmpty(cboDesignType.SelectedValue.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Form Type") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); cboDesignType.Focus(); return; } if (cboReceiveStatus.SelectedValue == null || string.IsNullOrEmpty(cboReceiveStatus.SelectedValue.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Receive Status") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); cboReceiveStatus.Focus(); return; } if (cboInvoiceStatus.SelectedValue == null || string.IsNullOrEmpty(cboInvoiceStatus.SelectedValue.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Invoice Status") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); cboInvoiceStatus.Focus(); return; } if (string.IsNullOrEmpty(txtQty.Text.Trim())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtQty.Focus(); return; } else if (!Util.IsNumeric(txtQty.Text)) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtQty.Focus(); return; } if (string.IsNullOrEmpty(txtMny.Text.Trim())) { MessageBox.Show(clsTranslate.TranslateString("Mny") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtMny.Focus(); return; } else if (!Util.IsNumeric(txtMny.Text)) { MessageBox.Show(clsTranslate.TranslateString("Mny") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtMny.Focus(); return; } if (string.IsNullOrEmpty(txtSalesManMny.Text.Trim())) { MessageBox.Show(clsTranslate.TranslateString("Sales Man Mny") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtSalesManMny.Focus(); return; } else if (!Util.IsNumeric(txtSalesManMny.Text)) { MessageBox.Show(clsTranslate.TranslateString("Sales Man Mny") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtSalesManMny.Focus(); return; } if (string.IsNullOrEmpty(txtInvoiceMny.Text.Trim())) { MessageBox.Show(clsTranslate.TranslateString("Invoice Mny") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtInvoiceMny.Focus(); return; } else if (!Util.IsNumeric(txtInvoiceMny.Text)) { MessageBox.Show(clsTranslate.TranslateString("Invoice Mny") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtInvoiceMny.Focus(); return; } if (cboInvoiceStatus.SelectedIndex == 2) { if (Convert.ToDecimal(txtInvoiceMny.Text) == 0) { MessageBox.Show(clsTranslate.TranslateString("Invoice Mny") + clsTranslate.TranslateString(" must >0 !"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtInvoiceMny.Focus(); return; } if (string.IsNullOrEmpty(txtInvoiceNo.Text.Trim())) { MessageBox.Show(clsTranslate.TranslateString("Invoice No") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtInvoiceNo.Focus(); return; } } if (txtCustName.Tag == null) { MessageBox.Show(clsTranslate.TranslateString("Cust Id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCustName.Focus(); return; } if (string.IsNullOrEmpty(txtCustName.Text)) { MessageBox.Show(clsTranslate.TranslateString("Cust Name") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCustName.Focus(); return; } if (clsLxms.GetParameterValue("NEED_SHIP_NO").CompareTo("T") == 0 && string.IsNullOrEmpty(txtNo.Text)) { MessageBox.Show(clsTranslate.TranslateString("No") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtNo.Focus(); return; } if (clsLxms.GetParameterValue("NEED_CUST_ORDER_NO").CompareTo("T") == 0 && string.IsNullOrEmpty(txtCustOrderNo.Text)) { MessageBox.Show(clsTranslate.TranslateString("Cust Order No") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCustOrderNo.Focus(); return; } if (string.IsNullOrEmpty(txtSalesMan.Text)) { MessageBox.Show(clsTranslate.TranslateString("Sales Man") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtSalesMan.Focus(); return; } if (string.IsNullOrEmpty(txtUnitNo.Text)) { MessageBox.Show(clsTranslate.TranslateString("Unit No") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtUnitNo.Focus(); return; } if (string.IsNullOrEmpty(txtProductName.Text)) { MessageBox.Show(clsTranslate.TranslateString("Product Name") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtProductName.Focus(); return; } if (!string.IsNullOrEmpty(txtCustOrderNo.Text.Trim())) { dalCustomerOrderList dalorder = new dalCustomerOrderList(); if (!dalorder.Exists(txtCustName.Tag.ToString(), txtCustOrderNo.Text.Trim(), out Util.emsg)) { if (MessageBox.Show("无法找到对应的客户订单号,您要继续保存吗?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } } modSalesDesignForm mod = new modSalesDesignForm(); mod.Id = Convert.ToInt32(txtId.Text); mod.FormDate = dtpFormDate.Value; mod.FormType = cboDesignType.SelectedValue.ToString(); mod.No = txtNo.Text.Trim(); mod.AdFlag = cboDesignType.SelectedValue.ToString().IndexOf("退货") > 0 ? -1 : 1; mod.CustOrderNo = txtCustOrderNo.Text.Trim(); mod.CustId = txtCustName.Tag.ToString(); mod.CustName = txtCustName.Text.Trim(); mod.PayMethod = txtPayMethod.Text.Trim(); mod.SalesMan = txtSalesMan.Text.Trim(); mod.ProductName = txtProductName.Text.Trim(); mod.Remark = txtRemark.Text.Trim(); mod.Currency = txtCurrency.Text.Trim(); dalAccCurrencyList dalcur = new dalAccCurrencyList(); modAccCurrencyList modcur = dalcur.GetItem(txtCurrency.Text.Trim(), out Util.emsg); mod.ExchangeRate = modcur.ExchangeRate; mod.UnitNo = txtUnitNo.Text.Trim(); mod.Qty = Convert.ToDecimal(txtQty.Text); mod.Mny = Convert.ToDecimal(txtMny.Text); mod.SalesManMny = Convert.ToDecimal(txtSalesManMny.Text); mod.UpdateUser = Util.UserId; mod.Status = 0; mod.ReceiveStatus = cboReceiveStatus.SelectedIndex; mod.AccountNo = cboAccountNo.SelectedValue == null ? string.Empty : cboAccountNo.SelectedValue.ToString(); mod.ReceiveDate = txtReceiveDate.Text.Trim(); mod.InvoiceStatus = cboInvoiceStatus.SelectedIndex; mod.InvoiceMny = Convert.ToDecimal(txtInvoiceMny.Text); mod.InvoiceNo = txtInvoiceNo.Text.Trim(); string detaillist = string.Empty; bool ret = false; if (_action == "NEW" || _action == "ADD") { ret = _dal.Insert(mod, out Util.emsg); } else { ret = _dal.Update(mod.Id, mod, out Util.emsg); } if (ret) { this.DialogResult = DialogResult.OK; this.Dispose(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }