Exemple #1
0
 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;
         }
         modAccReceivableForm 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;
     }
 }
Exemple #2
0
 public void EditItem(int id)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         _action     = "EDIT";
         modAccReceivableForm mod = _dal.GetItem(id, out Util.emsg);
         if (mod != null)
         {
             txtId.Text           = id.ToString();
             dtpFormDate.Value    = mod.FormDate;
             txtNo.Text           = mod.No;
             txtCustId.Text       = mod.CustId;
             txtCustName.Text     = mod.CustName;
             txtGetMny.Text       = mod.GetMny.ToString();
             txtReceivable.Text   = mod.ReceivableMny.ToString();
             txtSubjectId.Text    = mod.SubjectId;
             txtSubjectName.Text  = mod.SubjectName;
             txtDetailId.Text     = mod.DetailId;
             txtDetailName.Text   = mod.DetailName;
             txtCurrency.Text     = mod.Currency;
             txtExchangeRate.Text = mod.ExchangeRate.ToString();
             txtCheckNo.Text      = mod.CheckNo;
             cboCheckType.Text    = mod.CheckType;
             cboBankName.Text     = mod.BankName;
             dtpPromiseDate.Value = mod.PromiseDate;
             txtRemark.Text       = mod.Remark;
             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;
                 if (mod.SubjectId == "1075" || mod.SubjectId == "5125")  //应收票据  应付票据
                 {
                     txtCheckNo.ReadOnly    = false;
                     cboCheckType.Enabled   = true;
                     cboBankName.Enabled    = true;
                     dtpPromiseDate.Enabled = true;
                 }
                 else
                 {
                     txtCheckNo.ReadOnly    = true;
                     cboCheckType.Enabled   = false;
                     cboBankName.Enabled    = false;
                     dtpPromiseDate.Enabled = false;
                 }
             }
             txtCustId.ReadOnly      = true;
             txtCustName.ReadOnly    = true;
             txtSubjectId.ReadOnly   = true;
             txtSubjectName.ReadOnly = true;
             txtCurrency.ReadOnly    = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }