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; } }
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; } }