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;
         }
         modVendorOrderList mod = _dal.GetItem(Convert.ToInt32(DBGrid.CurrentRow.Cells[0].Value), out Util.emsg);
         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";
         modVendorOrderList mod = _dal.GetItem(id, out Util.emsg);
         if (mod != null)
         {
             txtId.Text            = id.ToString();
             dtpFormDate.Value     = mod.FormDate;
             dtpRequireDate.Value  = mod.RequireDate;
             txtVendorOrderNo.Text = mod.VendorOrderNo;
             txtCurrency.Text      = mod.Currency;
             txtVendorName.Text    = mod.VendorName;
             txtPayMethod.Text     = mod.PayMethod;
             txtPurchaseMan.Text   = mod.PurchaseMan;
             txtUnitNo.Text        = mod.UnitNo;
             txtQty.Text           = mod.Qty.ToString();
             txtPrice.Text         = mod.Price.ToString();
             txtProductName.Tag    = mod.ProductId;
             txtProductName.Text   = mod.ProductName;
             txtSize.Text          = mod.Size.ToString();
             txtRemark.Text        = mod.Remark;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }