public void MonthlySalarySettingsEdit(MonthlySalaryInfo monthlysalaryinfo)
        {
            try
            {
                SPMonthlySalary.MonthlySalarySettingsEdit(InfoMonthlySalary);
            }

            catch (Exception ex)
            {
                MessageBox.Show("MS5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 public decimal MonthlySalaryAddWithIdentity(MonthlySalaryInfo monthlysalaryinfo)
 {
     decimal decResult = 0;
     try
     {
         decResult = SPMonthlySalary.MonthlySalaryAddWithIdentity(monthlysalaryinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("MS4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decResult;
 }
 /// <summary>
 /// Function to update the monthly salary settings
 /// </summary>
 /// <param name="monthlysalaryinfo"></param>
 public void MonthlySalarySettingsEdit(MonthlySalaryInfo monthlysalaryinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("MonthlySalarySettingsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@monthlySalaryId", SqlDbType.Decimal);
         sprmparam.Value = monthlysalaryinfo.MonthlySalaryId;
         sprmparam = sccmd.Parameters.Add("@salaryMonth", SqlDbType.DateTime);
         sprmparam.Value = monthlysalaryinfo.SalaryMonth;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = monthlysalaryinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = monthlysalaryinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = monthlysalaryinfo.Extra2;
         int ineffectedrow = sccmd.ExecuteNonQuery();
         if (ineffectedrow > 0)
         {     }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to get particular values from MonthlySalary Table based on the parameter
 /// </summary>
 /// <param name="monthlySalaryId"></param>
 /// <returns></returns>
 public MonthlySalaryInfo MonthlySalaryView(decimal monthlySalaryId)
 {
     MonthlySalaryInfo monthlysalaryinfo = new MonthlySalaryInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("MonthlySalaryView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@monthlySalaryId", SqlDbType.Decimal);
         sprmparam.Value = monthlySalaryId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             monthlysalaryinfo.MonthlySalaryId = Convert.ToDecimal(sdrreader[0].ToString());
             monthlysalaryinfo.SalaryMonth = Convert.ToDateTime(sdrreader[1].ToString());
             monthlysalaryinfo.Narration = sdrreader[2].ToString();
             monthlysalaryinfo.ExtraDate = Convert.ToDateTime(sdrreader[3].ToString());
             monthlysalaryinfo.Extra1 = sdrreader[4].ToString();
             monthlysalaryinfo.Extra2 = sdrreader[5].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return monthlysalaryinfo;
 }
 /// <summary>
 /// Function to insert values to MonthlySalary Table and return the Curresponding row's Id
 /// </summary>
 /// <param name="monthlysalaryinfo"></param>
 /// <returns></returns>
 public decimal MonthlySalaryAddWithIdentity(MonthlySalaryInfo monthlysalaryinfo)
 {
     decimal decIdentity = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("MonthlySalaryAddWithIdentity", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@salaryMonth", SqlDbType.DateTime);
         sprmparam.Value = monthlysalaryinfo.SalaryMonth;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = monthlysalaryinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = monthlysalaryinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = monthlysalaryinfo.Extra2;
         object obj = sccmd.ExecuteScalar();
         if (obj != null)
         {
             decIdentity = Convert.ToDecimal(obj.ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decIdentity;
 }