Example #1
0
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         PayHeadSP   spPayhead   = new PayHeadSP();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadId   = decPayHeadId;
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type        = cmbPayheadType.Text;
         infoPayhead.Narration   = txtPayheadNarration.Text.Trim();
         if (spPayhead.PayheadCheckExistence(txtPayheadName.Text.Trim(), infoPayhead.PayHeadId) == false)
         {
             spPayhead.PayHeadEdit(infoPayhead);
             GridFill();
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Payhead name already exist");
             txtPayheadName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #2
0
 /// <summary>
 /// Function to Update values in PayHead Table
 /// </summary>
 /// <param name="payheadinfo"></param>
 public void PayHeadEdit(PayHeadInfo payheadinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PayHeadEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@payHeadId", SqlDbType.Decimal);
         sprmparam.Value = payheadinfo.PayHeadId;
         sprmparam       = sccmd.Parameters.Add("@payHeadName", SqlDbType.VarChar);
         sprmparam.Value = payheadinfo.PayHeadName;
         sprmparam       = sccmd.Parameters.Add("@type", SqlDbType.VarChar);
         sprmparam.Value = payheadinfo.Type;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = payheadinfo.Narration;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Example #3
0
 public void PayHeadAdd(PayHeadInfo payheadinfo)
 {
     try
     {
         if (base.sqlcon.State == ConnectionState.Closed)
         {
             base.sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PayHeadAdd", base.sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam7 = new SqlParameter();
         sprmparam7       = sccmd.Parameters.Add("@payHeadName", SqlDbType.VarChar);
         sprmparam7.Value = payheadinfo.PayHeadName;
         sprmparam7       = sccmd.Parameters.Add("@type", SqlDbType.VarChar);
         sprmparam7.Value = payheadinfo.Type;
         sprmparam7       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam7.Value = payheadinfo.Narration;
         sprmparam7       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam7.Value = payheadinfo.ExtraDate;
         sprmparam7       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam7.Value = payheadinfo.Extra1;
         sprmparam7       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam7.Value = payheadinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         base.sqlcon.Close();
     }
 }
Example #4
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);
     }
 }
Example #5
0
 /// <summary>
 /// Function for save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PayHeadSP   spPayhead   = new PayHeadSP();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type        = cmbPayheadType.SelectedItem.ToString();
         infoPayhead.Narration   = txtPayheadNarration.Text.Trim();
         infoPayhead.ExtraDate   = DateTime.Parse(DateTime.Now.ToString());
         infoPayhead.Extra1      = string.Empty;
         infoPayhead.Extra2      = string.Empty;
         if (btnPayheadSave.Text == "Save")
         {
             if (spPayhead.PayheadCheckExistence(txtPayheadName.Text.Trim(), 0) == false)
             {
                 Messages.SavedMessage();
                 spPayhead.PayHeadAdd(infoPayhead);
                 GridFill();
                 Clear();
             }
             else
             {
                 Messages.InformationMessage("Payhead name already exist");
                 txtPayheadName.Focus();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public void PayHeadEdit(PayHeadInfo payheadinfo)
        {
            try
            {
                SPPayHead.PayHeadEdit(payheadinfo);
            }

            catch (Exception ex)
            {
                MessageBox.Show("CB:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public PayHeadInfo PayHeadView(decimal payHeadId)
        {
            try
            {
                InfoPayHead = SPPayHead.PayHeadView(payHeadId);
            }

            catch (Exception ex)
            {
                MessageBox.Show("CB:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(InfoPayHead);
        }
Example #8
0
        /// <summary>
        /// Function to get particular values from PayHead Table based on the parameter
        /// </summary>
        /// <param name="payHeadId"></param>
        /// <returns></returns>
        public PayHeadInfo PayHeadView(decimal payHeadId)
        {
            PayHeadInfo   payheadinfo = new PayHeadInfo();
            SqlDataReader sdrreader   = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PayHeadView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@payHeadId", SqlDbType.Decimal);
                sprmparam.Value = payHeadId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    payheadinfo.PayHeadId   = Convert.ToDecimal(sdrreader[0].ToString());
                    payheadinfo.PayHeadName = sdrreader[1].ToString();
                    payheadinfo.Type        = sdrreader[2].ToString();
                    payheadinfo.Narration   = sdrreader[3].ToString();
                    payheadinfo.ExtraDate   = DateTime.Parse(sdrreader[4].ToString());
                    payheadinfo.Extra1      = sdrreader[5].ToString();
                    payheadinfo.Extra2      = sdrreader[6].ToString();
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(payheadinfo);
        }
Example #9
0
 /// <summary>
 /// Function for Delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         PayHeadInfo infoPayhead = new PayHeadInfo();
         PayHeadSP   spPayhead   = new PayHeadSP();
         if (spPayhead.PayHeadDeleteVoucherTypeCheckReference(decPayHeadId))
         {
             Messages.ReferenceExistsMessage();
             txtPayheadName.Focus();
         }
         else
         {
             Messages.DeletedMessage();
             Clear();
         }
         GridFill();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         PayHeadInfo infoPayhead = new PayHeadInfo();
         PayHeadBll BllPayHead = new PayHeadBll();
         if (BllPayHead.PayHeadDeleteVoucherTypeCheckReference(decPayHeadId))
         {
             Messages.ReferenceExistsMessage();
             txtPayheadName.Focus();
         }
         else
         {
             Messages.DeletedMessage();
             Clear();
         }
         GridFill();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <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();
             PayHeadBll BllPayHead = new PayHeadBll();
             infoPayhead = BllPayHead.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 (BllPayHead.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);
     }
 }
 /// <summary>
 /// Function for save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PayHeadBll BllPayHead = new PayHeadBll();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type = cmbPayheadType.SelectedItem.ToString();
         infoPayhead.Narration = txtPayheadNarration.Text.Trim();
         infoPayhead.ExtraDate = DateTime.Parse(DateTime.Now.ToString());
         infoPayhead.Extra1 = string.Empty;
         infoPayhead.Extra2 = string.Empty;
         if (btnPayheadSave.Text == "Save")
         {
             if (BllPayHead.PayheadCheckExistence(txtPayheadName.Text.Trim(), 0) == false)
             {
                 Messages.SavedMessage();
                 BllPayHead.PayHeadAdd(infoPayhead);
                 GridFill();
                 Clear();
             }
             else
             {
                 Messages.InformationMessage("Payhead name already exist");
                 txtPayheadName.Focus();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         PayHeadBll BllPayHead = new PayHeadBll();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadId = decPayHeadId;
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type = cmbPayheadType.Text;
         infoPayhead.Narration = txtPayheadNarration.Text.Trim();
         if (BllPayHead.PayheadCheckExistence(txtPayheadName.Text.Trim(), infoPayhead.PayHeadId) == false)
         {
             BllPayHead.PayHeadEdit(infoPayhead);
             GridFill();
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Payhead name already exist");
             txtPayheadName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }