Ejemplo n.º 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;
         }
         modAccOtherPayableForm 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;
     }
 }
Ejemplo n.º 2
0
 public void EditItem(int id)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         _action     = "EDIT";
         modAccOtherPayableForm mod = _dal.GetItem(id, out Util.emsg);
         if (mod != null)
         {
             txtId.Text                = id.ToString();
             dtpFormDate.Value         = mod.FormDate;
             cboFormType.SelectedValue = mod.AdFlag.ToString();
             txtNo.Text                = mod.No;
             txtObjectName.Text        = mod.ObjectName;
             txtPaidMny.Text           = mod.PaidMny.ToString();
             txtPayable.Text           = mod.PayableMny.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;
                 }
             }
             txtObjectName.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;
     }
 }