Exemplo n.º 1
0
 private void btnPostPay_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (cboPayStatus.SelectedIndex == 1)
         {
             if (cboAccountNo.SelectedValue == null)
             {
                 MessageBox.Show(clsTranslate.TranslateString("Account no") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 cboAccountNo.Focus();
                 return;
             }
         }
         if (_idtype == "SALE")
         {
             dalSalesShipment dal = new dalSalesShipment();
             bool             ret = dal.UpdateReceiveStatus(true, false, _idlist, cboPayStatus.SelectedIndex, cboAccountNo.SelectedValue == null ? string.Empty : cboAccountNo.SelectedValue.ToString(), dtpPayDate.Value.ToString("yyyy-MM-dd"), 0, 0, string.Empty, Util.UserId, out Util.emsg);
             if (ret)
             {
                 this.DialogResult = DialogResult.OK;
                 //this.Dispose();
             }
             else
             {
                 MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             dalPurchaseList dal = new dalPurchaseList();
             bool            ret = dal.UpdatePayStatus(true, false, _idlist, cboPayStatus.SelectedIndex, cboAccountNo.SelectedValue == null ? string.Empty : cboAccountNo.SelectedValue.ToString(), dtpPayDate.Value.ToString("yyyy/MM/dd"), 0, 0, string.Empty, Util.UserId, 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;
     }
 }
Exemplo n.º 2
0
        private void DBGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (DBGrid.CurrentRow == null)
                {
                    return;
                }
                modPurchaseList mod = (modPurchaseList)DBGrid.CurrentRow.DataBoundItem;
                switch (DBGrid.Columns[e.ColumnIndex].Name)
                {
                case "PayStatus":
                case "PayDate":
                case "AccountNo":
                    _dal.UpdatePayStatus(mod.PurchaseId, mod.PayStatus, mod.PayDate, mod.AccountNo, Util.UserId, out Util.emsg);
                    if (DBGrid.Columns[e.ColumnIndex].Name == "PayStatus" && mod.PayStatus == 1)
                    {
                        DBGrid.CurrentRow.Cells["PayDate"].Value = DateTime.Today.ToString("yyyy-MM-dd");
                    }
                    break;

                case "InvoiceStatus":
                case "InvoiceNo":
                case "InvoiceMny":
                    _dal.UpdateInvoiceStatus(mod.PurchaseId, mod.InvoiceStatus, mod.InvoiceMny, mod.InvoiceNo, Util.UserId, out Util.emsg);
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 3
0
 private void btnPostInvoice_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (string.IsNullOrEmpty(txtInvoiceMny.Text.Trim()))
         {
             MessageBox.Show(clsTranslate.TranslateString("Invoice Mny") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtInvoiceMny.Focus();
             return;
         }
         else if (!Util.IsNumeric(txtInvoiceMny.Text))
         {
             MessageBox.Show(clsTranslate.TranslateString("Invoice Mny") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtInvoiceMny.Focus();
             return;
         }
         if (cboInvoiceStatus.SelectedIndex == 2)
         {
             if (Convert.ToDecimal(txtInvoiceMny.Text) == 0)
             {
                 MessageBox.Show(clsTranslate.TranslateString("Invoice Mny") + clsTranslate.TranslateString(" must >0 !"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 txtInvoiceMny.Focus();
                 return;
             }
             if (string.IsNullOrEmpty(txtInvoiceNo.Text.Trim()))
             {
                 MessageBox.Show(clsTranslate.TranslateString("Invoice No") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 txtInvoiceNo.Focus();
                 return;
             }
         }
         if (_idtype == "SALE")
         {
             dalSalesShipment _dal = new dalSalesShipment();
             bool             ret  = _dal.UpdateReceiveStatus(false, true, _idlist, 0, dtpPayDate.Value.ToString("yyyy/MM/dd"), string.Empty, cboInvoiceStatus.SelectedIndex, Convert.ToDecimal(txtInvoiceMny.Text), txtInvoiceNo.Text.Trim(), Util.UserId, out Util.emsg);
             if (ret)
             {
                 this.DialogResult = DialogResult.OK;
                 //this.Dispose();
             }
             else
             {
                 MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             dalPurchaseList _dal = new dalPurchaseList();
             bool            ret  = _dal.UpdatePayStatus(false, true, _idlist, 0, dtpPayDate.Value.ToString("yyyy/MM/dd"), string.Empty, cboInvoiceStatus.SelectedIndex, Convert.ToDecimal(txtInvoiceMny.Text), txtInvoiceNo.Text.Trim(), Util.UserId, 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;
     }
 }