public bool DesignationEdit(DesignationInfo designationinfo)
 {
     bool isStatus = false;
        try
        {
        isStatus = spDesignation.DesignationEdit(designationinfo);
        }
        catch (Exception)
        {
        }
        return isStatus;
 }
 public decimal DesignationAddWithReturnIdentity(DesignationInfo designationinfo)
 {
     decimal decId = 0;
     try
     {
         decId = spDesignation.DesignationAddWithReturnIdentity(designationinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("BR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decId;
 }
 public bool DesignationEdit(DesignationInfo designationinfo)
 {
     bool isResult = false;
        try
        {
        isResult = spDesignation.DesignationEdit(designationinfo);
        }
        catch (Exception ex)
        {
        MessageBox.Show("DBLL:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return isResult;
 }
 /// <summary>
 /// Function to insert values to Designation Table
 /// </summary>
 /// <param name="designationinfo"></param>
 /// <returns></returns>
 public bool DesignationAdd(DesignationInfo designationinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DesignationAddIfNotExistsDesignation", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@designationName", SqlDbType.VarChar);
         sprmparam.Value = designationinfo.DesignationName;
         sprmparam = sccmd.Parameters.Add("@leaveDays", SqlDbType.Decimal);
         sprmparam.Value = designationinfo.LeaveDays;
         sprmparam = sccmd.Parameters.Add("@advanceAmount", SqlDbType.Decimal);
         sprmparam.Value = designationinfo.AdvanceAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = designationinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = designationinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = designationinfo.Extra2;
         int inEffectedRow = sccmd.ExecuteNonQuery();
         if (inEffectedRow > 0)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return false;
     }
     finally
     {
         sqlcon.Close();
     }
 }
 public DesignationInfo DesignationView(decimal designationId)
 {
     DesignationInfo designationinfo = new DesignationInfo();
        try
        {
        designationinfo = spDesignation.DesignationView(designationId);
        }
        catch (Exception ex)
        {
        MessageBox.Show("DBLL:5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return designationinfo;
 }
 /// <summary>
 /// Function to insert values and return id
 /// </summary>
 /// <param name="designationinfo"></param>
 /// <returns></returns>
 public decimal DesignationAddWithReturnIdentity(DesignationInfo designationinfo)
 {
     decimal decIdentity = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DesignationAddWithReturnIdentity", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@designationName", SqlDbType.VarChar);
         sprmparam.Value = designationinfo.DesignationName;
         sprmparam = sccmd.Parameters.Add("@leaveDays", SqlDbType.Decimal);
         sprmparam.Value = designationinfo.LeaveDays;
         sprmparam = sccmd.Parameters.Add("@advanceAmount", SqlDbType.Decimal);
         sprmparam.Value = designationinfo.AdvanceAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = designationinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = designationinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = designationinfo.Extra2;
         object obj = sccmd.ExecuteScalar();
         if (obj != null)
         {
             decIdentity = Convert.ToDecimal(obj.ToString());
         }
         return decIdentity;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decIdentity;
 }
 /// <summary>
 /// Function to get particular values from Designation Table based on the parameter
 /// </summary>
 /// <param name="designationId"></param>
 /// <returns></returns>
 public DesignationInfo DesignationView(decimal designationId)
 {
     DesignationInfo designationinfo = new DesignationInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DesignationView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@designationId", SqlDbType.Decimal);
         sprmparam.Value = designationId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             designationinfo.DesignationId = decimal.Parse(sdrreader[0].ToString());
             designationinfo.DesignationName = sdrreader[1].ToString();
             designationinfo.LeaveDays = decimal.Parse(sdrreader[2].ToString());
             designationinfo.AdvanceAmount = decimal.Parse(sdrreader[3].ToString());
             designationinfo.Narration = sdrreader[4].ToString();
             designationinfo.ExtraDate = DateTime.Parse(sdrreader[5].ToString());
             designationinfo.Extra1 = sdrreader[6].ToString();
             designationinfo.Extra2 = sdrreader[7].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return designationinfo;
 }