/// <summary>
 /// Function to insert values to ServiceCategory Table
 /// </summary>
 /// <param name="servicecategoryinfo"></param>
 public void ServiceCategoryAdd(ServiceCategoryInfo servicecategoryinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ServiceCategoryAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@categoryName", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.CategoryName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = servicecategoryinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to add values to ServiceCategory Table
 /// </summary>
 /// <param name="servicecategoryinfo"></param>
 /// <returns></returns>
 public decimal ServiceCategoryAddSpecificFields1(ServiceCategoryInfo servicecategoryinfo)
 {
     decimal decId = 0;
        try
        {
        decId = spServiceCatogory.ServiceCategoryAddSpecificFields1(servicecategoryinfo);
        }
        catch (Exception ex)
        {
        MessageBox.Show("SC3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return decId;
 }
 /// <summary>
 /// Function to add values and return corresponding row's id
 /// </summary>
 /// <param name="servicecategoryinfo"></param>
 /// <returns></returns>
 public bool ServiceCategoryAddSpecificFields(ServiceCategoryInfo servicecategoryinfo)
 {
     bool isSave = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ServiceCategoryAddSpecificFields", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@categoryName", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.CategoryName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Extra2;
         int inWork = sccmd.ExecuteNonQuery();
         if (inWork > 0)
         {
             isSave = true;
         }
         else
         {
             isSave = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isSave;
 }
 /// <summary>
 /// Function to view details based on parameter
 /// </summary>
 /// <param name="decServiceCategoryId"></param>
 /// <returns></returns>
 public ServiceCategoryInfo ServiceCategoryWithNarrationView(decimal decServiceCategoryId)
 {
     ServiceCategoryInfo ServiceCategoryinfo = new ServiceCategoryInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ServiceCategoryWithNarrationView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@serviceCategoryId", SqlDbType.Decimal);
         sprmparam.Value = decServiceCategoryId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             ServiceCategoryinfo.ServicecategoryId = Convert.ToDecimal(sdrreader[0].ToString());
             ServiceCategoryinfo.CategoryName = sdrreader[1].ToString();
             ServiceCategoryinfo.Narration = sdrreader[2].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return ServiceCategoryinfo;
 }
 /// <summary>
 /// Function to check status for Update
 /// </summary>
 /// <param name="servicecategoryinfo"></param>
 /// <returns></returns>
 public bool ServiceCategoryEditParticularFeilds(ServiceCategoryInfo servicecategoryinfo)
 {
     bool isEdit = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ServiceCategoryEditParticularFeilds", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@serviceCategoryId", SqlDbType.Decimal);
         sprmparam.Value = servicecategoryinfo.ServicecategoryId;
         sprmparam = sccmd.Parameters.Add("@categoryName", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.CategoryName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Narration;
         int inAffectedRows = sccmd.ExecuteNonQuery();
         if (inAffectedRows > 0)
         {
             isEdit = true;
         }
         else
         {
             isEdit = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isEdit;
 }
 /// <summary>
 /// Function to add values to ServiceCategory Table
 /// </summary>
 /// <param name="servicecategoryinfo"></param>
 /// <returns></returns>
 public decimal ServiceCategoryAddSpecificFields1(ServiceCategoryInfo servicecategoryinfo)
 {
     decimal decId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ServiceCategoryAddSpecificFields", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@categoryName", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.CategoryName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = servicecategoryinfo.Extra2;
         decId = Convert.ToInt32(sccmd.ExecuteScalar());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decId;
 }
 /// <summary>
 /// Function to view details based on parameter
 /// </summary>
 /// <param name="decServiceCategoryId"></param>
 /// <returns></returns>
 public ServiceCategoryInfo ServiceCategoryWithNarrationView(decimal decServiceCategoryId)
 {
     ServiceCategoryInfo ServiceCategoryinfo = new ServiceCategoryInfo();
        try
        {
        ServiceCategoryinfo = spServiceCatogory.ServiceCategoryWithNarrationView(decServiceCategoryId);
        }
        catch (Exception ex)
        {
        MessageBox.Show("SC7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return ServiceCategoryinfo;
 }
 /// <summary>
 /// Function to check status for Update
 /// </summary>
 /// <param name="servicecategoryinfo"></param>
 /// <returns></returns>
 public bool ServiceCategoryEditParticularFeilds(ServiceCategoryInfo servicecategoryinfo)
 {
     bool isEdit = false;
        try
        {
        isEdit = spServiceCatogory.ServiceCategoryEditParticularFeilds(servicecategoryinfo);
        }
        catch (Exception ex)
        {
        MessageBox.Show("SC4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return isEdit;
 }