Пример #1
0
 /// <summary>
 /// Fills controls for updation on cell double click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvPayhead_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             PayHeadInfo infoPayhead = new PayHeadInfo();
             PayHeadSP   spPayhead   = new PayHeadSP();
             infoPayhead              = spPayhead.PayHeadView(Convert.ToDecimal(dgvPayhead.CurrentRow.Cells["dgvtxtPayheadId"].Value.ToString()));
             txtPayheadName.Text      = infoPayhead.PayHeadName;
             cmbPayheadType.Text      = infoPayhead.Type;
             strPayheadType           = cmbPayheadType.Text;
             txtPayheadNarration.Text = infoPayhead.Narration;
             btnPayheadSave.Text      = "Update";
             btnPayheadDelete.Enabled = true;
             strPayHeadName           = infoPayhead.PayHeadName;
             decPayHeadId             = Convert.ToDecimal(dgvPayhead.CurrentRow.Cells["dgvtxtPayheadId"].Value.ToString());
             if (spPayhead.payheadTypeCheckeferences(infoPayhead.PayHeadId, txtPayheadName.Text, cmbPayheadType.Text, txtPayheadNarration.Text))
             {
                 if (e.RowIndex != -1)
                 {
                     cmbPayheadType.Enabled = true;
                 }
             }
             else
             {
                 cmbPayheadType.Enabled = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public bool payheadTypeCheckeferences(decimal PayHeadId, string PayHeadName, string Type, string Narration)
        {
            bool isResult = false;

            try
            {
                isResult = SPPayHead.payheadTypeCheckeferences(PayHeadId, PayHeadName, Type, Narration);
            }
            catch (Exception ex)
            {
                MessageBox.Show("CB:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isResult);
        }