Exemplo n.º 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvPurchaseInvoice.CurrentRow != null)
                {
                    SetSortedColumns();

                    long      PGID         = Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PGID"].Value);
                    long      PIID         = Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PIID"].Value);
                    bool      LatestGRN    = false;
                    DataTable dtGetMaxPIID = CommSelect.SelectRecord(PGID, "GetMaxPIID", "Indent - check MaxID");

                    if (dtGetMaxPIID != null)
                    {
                        if (Convert.ToInt64(dtGetMaxPIID.Rows[0][0].ToString()) == PIID)
                        {
                            LatestGRN = true;
                            frmIndentEntry fPurchaseInvoice = new frmIndentEntry((int)Constant.Mode.Modify, Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PIID"].Value), LatestGRN);
                            fPurchaseInvoice.ShowDialog();
                            setDefaultGridRecords(sender, e);
                            btnEdit.Focus();
                        }
                        else
                        {
                            LatestGRN = false;
                            frmIndentEntry fPurchaseInvoice = new frmIndentEntry((int)Constant.Mode.Modify, Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PIID"].Value), LatestGRN);
                            fPurchaseInvoice.ShowDialog();
                            setDefaultGridRecords(sender, e);
                            btnEdit.Focus();

                            //MessageBox.Show("You can not edit previous GRN.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            //btnEdit.Focus();
                        }
                    }
                    //frmIndentEntry fPurchaseInvoice = new frmIndentEntry((int)Constant.Mode.Modify, Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PIID"].Value));
                    //fPurchaseInvoice.ShowDialog();
                    //setDefaultGridRecords(sender, e);
                    //btnEdit.Focus();
                }
            }
            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("PurchaseInvoice", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
        }
Exemplo n.º 2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            try
            {
                frmIndentEntry fPurchaseInvoice = new frmIndentEntry((int)Constant.Mode.Insert, 0, false);
                fPurchaseInvoice.ShowDialog();
                LoadList();

                DV           = dtblPurchaseInvoice.DefaultView;
                DV.RowFilter = StrFilter;

                dgvPurchaseInvoice.DataSource = DV.ToTable();
                lblTotRec.Text = Utill.Common.CommonMessage.TotalRecord + dgvPurchaseInvoice.RowCount.ToString();
            }
            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("PurchaseInvoice", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
        }