Пример #1
0
 /// <summary>
 /// Calls corresponding MaterialReceipt voucher on cell double click in Datagridview
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnViewDetails_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvMaterialReceiptRegister.CurrentRow != null)
         {
             frmMaterialReceipt frmmaterialReceiptObj  = new frmMaterialReceipt();
             frmMaterialReceipt frmMaterialReceiptOpen = Application.OpenForms["frmMaterialReceipt"] as frmMaterialReceipt;
             if (frmMaterialReceiptOpen == null)
             {
                 frmmaterialReceiptObj.MdiParent = formMDI.MDIObj;
                 frmmaterialReceiptObj.CallFromMaterialReceiptRegister(this, Convert.ToDecimal(dgvMaterialReceiptRegister.CurrentRow.Cells["dgvtxtMaterialReceiptMasterId"].Value.ToString()), Convert.ToDecimal(dgvMaterialReceiptRegister.CurrentRow.Cells["dgvtxtPOVoucherTypeId"].Value.ToString()));
             }
             else
             {
                 frmMaterialReceiptOpen.CallFromMaterialReceiptRegister(this, Convert.ToDecimal(dgvMaterialReceiptRegister.CurrentRow.Cells["dgvtxtMaterialReceiptMasterId"].Value.ToString()), Convert.ToDecimal(dgvMaterialReceiptRegister.CurrentRow.Cells["dgvtxtPOVoucherTypeId"].Value.ToString()));
                 frmMaterialReceiptOpen.BringToFront();
                 if (frmMaterialReceiptOpen.WindowState == FormWindowState.Minimized)
                 {
                     frmMaterialReceiptOpen.WindowState = FormWindowState.Normal;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "MRREG10:" + ex.Message;
     }
 }
 /// <summary>
 /// Cell double click to open details in form frmMaterialReceipt to updation
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvMaterialReceiptReport_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex > -1 && e.ColumnIndex > -1)
         {
             if (dgvMaterialReceiptReport.CurrentRow != null && dgvMaterialReceiptReport.CurrentRow.Cells["dgvtxtMaterialReceiptMasterId"].Value != null && dgvMaterialReceiptReport.CurrentRow.Cells["dgvtxtMaterialReceiptMasterId"].Value.ToString() != string.Empty)
             {
                 if (dgvMaterialReceiptReport.CurrentRow != null)
                 {
                     frmMaterialReceipt frmmaterialReceiptObj  = new frmMaterialReceipt();
                     frmMaterialReceipt frmmaterialReceiptOpen = Application.OpenForms["frmmaterialReceipt"] as frmMaterialReceipt;
                     if (frmmaterialReceiptOpen == null)
                     {
                         frmmaterialReceiptObj.MdiParent = formMDI.MDIObj;
                         frmmaterialReceiptObj.CallFromMaterialReceiptReport(this, Convert.ToDecimal(dgvMaterialReceiptReport.CurrentRow.Cells["dgvtxtMaterialReceiptMasterId"].Value.ToString()), Convert.ToDecimal(dgvMaterialReceiptReport.CurrentRow.Cells["dgvtxtPOVoucherTypeId"].Value.ToString()));
                     }
                     else
                     {
                         frmmaterialReceiptOpen.CallFromMaterialReceiptReport(this, Convert.ToDecimal(dgvMaterialReceiptReport.CurrentRow.Cells["dgvtxtMaterialReceiptMasterId"].Value.ToString()), Convert.ToDecimal(dgvMaterialReceiptReport.CurrentRow.Cells["dgvtxtPOVoucherTypeId"].Value.ToString()));
                         frmmaterialReceiptOpen.BringToFront();
                         if (frmmaterialReceiptOpen.WindowState == FormWindowState.Minimized)
                         {
                             frmmaterialReceiptOpen.WindowState = FormWindowState.Normal;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MRR14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }