private void btnEdit_Click(object sender, EventArgs e) { try { long MIID = Convert.ToInt64(dgvMaterial.CurrentRow.Cells["MIID"].Value); long MRID = Convert.ToInt64(dgvMaterial.CurrentRow.Cells["id"].Value); bool LatestMatriealReturn = false; DataTable dtGetMaxMRID = CommSelect.SelectRecord(MIID, "GetMaxMRID", "Indent - check MaxID"); if (dtGetMaxMRID != null) { if (Convert.ToInt64(dtGetMaxMRID.Rows[0][0].ToString()) == MRID) { LatestMatriealReturn = true; SetSortedColumns(); frmMaterialReturnEntry frmMaterialReturnEntry = new frmMaterialReturnEntry((int)Constant.Mode.Modify, Convert.ToInt64(dgvMaterial.CurrentRow.Cells["id"].Value), LatestMatriealReturn); frmMaterialReturnEntry.ShowDialog(); setDefaultGridRecords(sender, e); btnEdit.Focus(); } else { LatestMatriealReturn = false; SetSortedColumns(); frmMaterialReturnEntry frmMaterialReturnEntry = new frmMaterialReturnEntry((int)Constant.Mode.Modify, Convert.ToInt64(dgvMaterial.CurrentRow.Cells["id"].Value), LatestMatriealReturn); frmMaterialReturnEntry.ShowDialog(); setDefaultGridRecords(sender, e); btnEdit.Focus(); //MessageBox.Show("You can not edit previous GRN.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //btnEdit.Focus(); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("materialIssueReturn", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Warning"); } }
private void btnNew_Click(object sender, EventArgs e) { try { frmMaterialReturnEntry frmMaterialReturnEntry = new frmMaterialReturnEntry((int)Constant.Mode.Insert, 0, false); frmMaterialReturnEntry.ShowDialog(); LoadList(); DV = dtblItemStock.DefaultView; DV.RowFilter = StrFilter; dgvMaterial.DataSource = DV.ToTable(); lblTotRec.Text = Utill.Common.CommonMessage.TotalRecord + dgvMaterial.RowCount.ToString(); // dgvItemStock_SelectionChanged(sender, e); } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("materialIssueReturn", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Warning"); } }