private void toolPost_Click(object sender, EventArgs e) { try { if (DBGrid.RowCount == 0) { return; } DBGrid.EndEdit(); if (MessageBox.Show("您真的要更改业务员吗?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } string custidlist = string.Empty; for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value != null && Convert.ToBoolean(DBGrid.Rows[i].Cells[0].Value) == true) { if (string.IsNullOrEmpty(custidlist)) { custidlist = DBGrid.Rows[i].Cells[1].Value.ToString(); } else { custidlist += "," + DBGrid.Rows[i].Cells[1].Value.ToString(); } } } if (string.IsNullOrEmpty(custidlist)) { MessageBox.Show("请勾选您要的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } bool ret = _dal.UpdateSalesMan(custidlist, cboNewMan.ComboBox.SelectedValue.ToString(), out Util.emsg); if (ret) { LoadData(); } 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; } }
private void toolSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.DataSource == null) { return; } //for(int i=0;i<DBGrid.RowCount;i++) //{ // modVendorOrderList mod = (modVendorOrderList)DBGrid.Rows[i].DataBoundItem; // if (mod.Price <= 0) // { // MessageBox.Show("请设置产品[" + mod.ProductName + "]的价格,必须>0", clsTranslate.TranslateString("information"), MessageBoxButtons.OK,MessageBoxIcon.Information); // DBGrid.CurrentCell = DBGrid.Rows[i].Cells["Price"]; // return; // } //} DBGrid.EndEdit(); BindingCollection <modVendorOrderList> list = (BindingCollection <modVendorOrderList>)DBGrid.DataSource; var p = (from c in list where c.Price <= 0 select c.ProductName).FirstOrDefault(); if (!string.IsNullOrEmpty(p)) { MessageBox.Show("请设置产品[" + p + "]的价格,必须>0", clsTranslate.TranslateString("information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } dalVendorOrderList dal = new dalVendorOrderList(); bool ret = dal.Save(list, out Util.emsg); if (ret) { MessageBox.Show("保存成功", clsTranslate.TranslateString("information"), MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Dispose(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Faulure"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolClear_Click(object sender, EventArgs e) { if (DBGrid.RowCount == 0) { return; } DBGrid.EndEdit(); string selectionlist = string.Empty; for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value != null && Convert.ToBoolean(DBGrid.Rows[i].Cells[0].Value) == true) { if (string.IsNullOrEmpty(selectionlist)) { selectionlist = DBGrid.Rows[i].Cells[1].Value.ToString(); } else { selectionlist += "," + DBGrid.Rows[i].Cells[1].Value.ToString(); } } } if (string.IsNullOrEmpty(selectionlist)) { MessageBox.Show("请勾选您要的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("您真的要清理这些产品资料?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } bool ret = _dal.DeleteUselessProduct(selectionlist, out Util.emsg); if (ret) { LoadData(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void toolSelect_Click(object sender, EventArgs e) { if (DBGrid.RowCount == 0) { return; } DBGrid.EndEdit(); selectionlist = string.Empty; for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value != null && Convert.ToBoolean(DBGrid.Rows[i].Cells[0].Value) == true) { if (string.IsNullOrEmpty(selectionlist)) { selectionlist = DBGrid.Rows[i].Cells[1].Value.ToString(); } else { selectionlist += "," + DBGrid.Rows[i].Cells[1].Value.ToString(); } } } if (string.IsNullOrEmpty(selectionlist)) { MessageBox.Show("请勾选您要的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!toolCheckAll.Visible && selectionlist.IndexOf(",") > 0) { MessageBox.Show("您只能选择一项!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.DialogResult = DialogResult.OK; this.Dispose(); }
private void toolSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DBGrid.EndEdit(); if (dtpFormDate.Value < Util.modperiod.StartDate) { MessageBox.Show("该日期的数据已锁定,不能更新数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); dtpFormDate.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_QUOTATION_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 (DBGrid.RowCount == 0) { MessageBox.Show("没有明细数据", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[0].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[1].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[1].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product name") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[5].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[5].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[5].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()) <= 0) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must > 0!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[6].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[6].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[6].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (Convert.ToDecimal(DBGrid.Rows[i].Cells[6].Value.ToString()) <= 0) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" must > 0!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } modQuotationForm mod = new modQuotationForm(); mod.FormId = txtFormId.Text.Trim(); mod.FormDate = dtpFormDate.Value; mod.No = txtNo.Text.Trim(); mod.CustId = txtCustName.Tag.ToString(); mod.CustName = txtCustName.Text.Trim(); mod.Remark = txtRemark.Text.Trim(); mod.ContactPerson = txtContactPerson.Text.Trim(); mod.Currency = txtCurrency.Text.Trim(); mod.UpdateUser = Util.UserId; string detaillist = string.Empty; BindingCollection <modQuotationDetail> list = new BindingCollection <modQuotationDetail>(); for (int i = 0; i < DBGrid.RowCount; i++) { modQuotationDetail modd = new modQuotationDetail(); modd.Seq = i + 1; modd.ProductId = DBGrid.Rows[i].Cells[0].Value.ToString(); modd.ProductName = DBGrid.Rows[i].Cells[1].Value.ToString(); modd.Specify = DBGrid.Rows[i].Cells[2].Value == null ? string.Empty : DBGrid.Rows[i].Cells[2].Value.ToString(); modd.UnitNo = DBGrid.Rows[i].Cells[3].Value == null ? string.Empty : DBGrid.Rows[i].Cells[3].Value.ToString(); modd.Brand = DBGrid.Rows[i].Cells[4].Value == null ? string.Empty : DBGrid.Rows[i].Cells[4].Value.ToString(); modd.Qty = Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()); modd.Price = Convert.ToDecimal(DBGrid.Rows[i].Cells[6].Value.ToString()); modd.Remark = DBGrid.Rows[i].Cells[7].Value == null ? string.Empty : DBGrid.Rows[i].Cells[7].Value.ToString(); list.Add(modd); } bool ret = _dal.Save(_action, mod, list, out Util.emsg); if (ret) { ini.IniWriteValue("QUOTATION", "CONTACT_PERSON", txtContactPerson.Text.Trim()); 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; } }
private void btnPost_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DBGrid.EndEdit(); if (DBGrid.RowCount == 0) { MessageBox.Show("没有明细数据", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[0].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[4].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[4].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[4].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (Convert.ToDecimal(DBGrid.Rows[i].Cells[4].Value.ToString()) <= 0) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must > 0!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[5].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[5].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[5].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } modSalesShipment mod = new modSalesShipment(); mod.ShipId = _dal.GetNewId(DateTime.Today); mod.ShipDate = DateTime.Today; mod.ShipType = "收营单"; //mod.No = txtNo.Text.Trim(); mod.AdFlag = 1; dalCustomerList dalcust = new dalCustomerList(); //mod.CustOrderNo = txtCustOrderNo.Text.Trim(); mod.CustName = "散客"; mod.CustId = clsLxms.GetDefaultCustId(); mod.PayMethod = "现金"; mod.SalesMan = Util.UserId; mod.OtherMny = 0; mod.KillMny = 0; mod.Currency = Util.Currency; dalAccCurrencyList dalcur = new dalAccCurrencyList(); modAccCurrencyList modcur = dalcur.GetItem(mod.Currency, out Util.emsg); mod.ExchangeRate = modcur.ExchangeRate; mod.DetailSum = decimal.Parse(txtAmount.Text); mod.UpdateUser = Util.UserId; mod.Status = 0; mod.ReceiveStatus = 1; mod.AccountNo = "现金"; mod.MakeDate = DateTime.Today; mod.ReceiveDate = DateTime.Today.ToString("yyyy-MM-dd"); mod.InvoiceStatus = 0; mod.InvoiceMny = 0; string detaillist = string.Empty; dalCustomerOrderList dalorder = new dalCustomerOrderList(); BindingCollection <modSalesShipmentDetail> list = new BindingCollection <modSalesShipmentDetail>(); for (int i = 0; i < DBGrid.RowCount; i++) { modSalesShipmentDetail modd = new modSalesShipmentDetail(); modd.Seq = i + 1; modd.ProductId = DBGrid.Rows[i].Cells[0].Value.ToString(); modd.ProductName = DBGrid.Rows[i].Cells[1].Value.ToString(); modd.Specify = DBGrid.Rows[i].Cells[8].Value.ToString(); modd.UnitNo = DBGrid.Rows[i].Cells[3].Value.ToString(); modd.Size = 1; modd.Qty = Convert.ToDecimal(DBGrid.Rows[i].Cells[4].Value.ToString()); modd.Price = Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()); modd.SalesManMny = 0; modd.WarehouseId = clsLxms.GetDefaultWarehouseId(); list.Add(modd); } bool ret = _dal.Save("ADD", mod, list, out Util.emsg); if (ret) { this.DialogResult = DialogResult.OK; LoadHistory(); DBGrid.Rows.Clear(); txtQty.Text = "0"; txtAmount.Text = "0"; btnPreview_Click(null, null); txtProduct.Focus(); } 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; } }
private void toolSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DBGrid.EndEdit(); if (dtpFormDate.Value < Util.modperiod.StartDate) { MessageBox.Show("该日期的数据已锁定,不能更新数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); dtpFormDate.Focus(); return; } if (DBGrid.RowCount == 0) { MessageBox.Show("没有明细数据", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[0].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[1].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[1].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product name") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[4].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[4].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Current Price") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[4].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Current Price") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } modPriceAdjustForm mod = new modPriceAdjustForm(); mod.FormId = txtFormId.Text.Trim(); mod.FormDate = dtpFormDate.Value; mod.Remark = txtRemark.Text.Trim(); mod.UpdateUser = Util.UserId; mod.Status = 0; string detaillist = string.Empty; BindingCollection <modPriceAdjustDetail> list = new BindingCollection <modPriceAdjustDetail>(); for (int i = 0; i < DBGrid.RowCount; i++) { modPriceAdjustDetail modd = new modPriceAdjustDetail(); modd.Seq = i + 1; modd.ProductId = DBGrid.Rows[i].Cells[0].Value.ToString(); modd.ProductName = DBGrid.Rows[i].Cells[1].Value.ToString(); modd.Qty = Convert.ToDecimal(DBGrid.Rows[i].Cells[2].Value.ToString()); modd.CurrentPrice = Convert.ToDecimal(DBGrid.Rows[i].Cells[3].Value.ToString()); modd.TruePrice = Convert.ToDecimal(DBGrid.Rows[i].Cells[4].Value.ToString()); modd.CurrentMny = Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()); modd.TrueMny = Convert.ToDecimal(DBGrid.Rows[i].Cells[6].Value.ToString()); modd.Differ = Convert.ToDecimal(DBGrid.Rows[i].Cells[7].Value.ToString()); modd.Remark = DBGrid.Rows[i].Cells[8].Value == null ? string.Empty : DBGrid.Rows[i].Cells[8].Value.ToString(); list.Add(modd); } bool ret = _dal.Save(_action, mod, list, 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; } }
private void toolSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DBGrid.EndEdit(); if (dtpFormDate.Value < Util.modperiod.StartDate) { MessageBox.Show("该日期的数据已锁定,不能更新数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); dtpFormDate.Focus(); return; } if (string.IsNullOrEmpty(txtCheckId.Text.Trim())) { MessageBox.Show(clsTranslate.TranslateString("Check Id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCheckId.Focus(); return; } if (DBGrid.RowCount == 0) { MessageBox.Show("没有明细数据", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } for (int i = 0; i < DBGrid.RowCount; i++) { switch (DBGrid.Rows[i].Cells[0].Value.ToString().Trim()) { case "1055": //应收帐款 dalCustomerList dalcust = new dalCustomerList(); if (!dalcust.Exists(DBGrid.Rows[i].Cells["DetailId"].Value.ToString().Trim(), out Util.emsg)) { MessageBox.Show("应收帐款明细不正确!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; case "5145": //应付帐款 dalVendorList dalvendor = new dalVendorList(); if (!dalvendor.Exists(DBGrid.Rows[i].Cells["DetailId"].Value.ToString().Trim(), out Util.emsg)) { MessageBox.Show("应付帐款明细不正确!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; case "1060": //其它应收款 dalOtherReceivableObject dalrec = new dalOtherReceivableObject(); if (!dalrec.Exists(DBGrid.Rows[i].Cells["DetailId"].Value.ToString().Trim(), out Util.emsg)) { MessageBox.Show("其它应收款明细不正确!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; case "5155": //其它应付款 dalOtherReceivableObject dalpay = new dalOtherReceivableObject(); if (!dalpay.Exists(DBGrid.Rows[i].Cells["DetailId"].Value.ToString().Trim(), out Util.emsg)) { MessageBox.Show("其它应付款明细不正确!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; case "1075": //应收票据 case "5125": //应付票据 if (DBGrid.Rows[i].Cells[7].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[7].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Check No") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[8].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[8].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Check Type") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[9].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[9].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Bank Name") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[10].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[10].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Promise Date") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; } } if (Math.Abs(Convert.ToDecimal(txtMny.Text) - GetDetailSum()) > Convert.ToDecimal("0.001")) { MessageBox.Show("金额不平衡!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } modAccCheckForm mod = new modAccCheckForm(); mod.FormId = txtFormId.Text.Trim(); mod.FormDate = dtpFormDate.Value; mod.CheckId = Convert.ToInt32(txtCheckId.Text); mod.Remark = txtRemark.Text.Trim(); mod.UpdateUser = Util.UserId; mod.Status = 0; string detaillist = string.Empty; BindingCollection <modAccCheckFormDetail> list = new BindingCollection <modAccCheckFormDetail>(); for (int i = 0; i < DBGrid.RowCount; i++) { modAccCheckFormDetail modd = new modAccCheckFormDetail(); modd.Seq = i + 1; modd.SubjectId = DBGrid.Rows[i].Cells[0].Value.ToString(); modd.SubjectName = DBGrid.Rows[i].Cells[1].Value.ToString(); modd.DetailId = DBGrid.Rows[i].Cells[2].Value == null ? string.Empty : DBGrid.Rows[i].Cells[2].Value.ToString(); modd.DetailName = DBGrid.Rows[i].Cells[3].Value.ToString(); modd.Currency = DBGrid.Rows[i].Cells[4].Value == null ? string.Empty : DBGrid.Rows[i].Cells[4].Value.ToString(); modd.Mny = Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()); modd.ExchangeRate = Convert.ToDecimal(DBGrid.Rows[i].Cells[6].Value.ToString()); modd.CheckNo = DBGrid.Rows[i].Cells[7].Value == null ? string.Empty : DBGrid.Rows[i].Cells[7].Value.ToString(); modd.CheckType = DBGrid.Rows[i].Cells[8].Value == null ? string.Empty : DBGrid.Rows[i].Cells[8].Value.ToString(); modd.BankName = DBGrid.Rows[i].Cells[9].Value == null ? string.Empty : DBGrid.Rows[i].Cells[9].Value.ToString(); modd.PromiseDate = Convert.ToDateTime(DBGrid.Rows[i].Cells[10].Value); modd.Remark = DBGrid.Rows[i].Cells[11].Value == null ? string.Empty : DBGrid.Rows[i].Cells[11].Value.ToString(); list.Add(modd); } bool ret = _dal.Save(_action, mod, list, 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; } }