/// <summary>
 /// Function to Update values in StandardRate Table
 /// </summary>
 /// <param name="standardrateinfo"></param>
 public void StandardRateEdit(StandardRateInfo standardrateinfo)
 {
     try
        {
        spStandaredRate.StandardRateEdit(standardrateinfo);
        }
        catch (Exception ex)
        {
        MessageBox.Show("AL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
 }
 /// <summary>
 /// Function to insert values to StandardRate Table and return the Curresponding row's Id
 /// </summary>
 /// <param name="standardrateinfo"></param>
 /// <returns></returns>
 public decimal StandardRateAddParticularfields(StandardRateInfo standardrateinfo)
 {
     decimal decStandardRateId = 0;
        try
        {
        decStandardRateId = spStandaredRate.StandardRateAddParticularfields(standardrateinfo);
        }
        catch (Exception ex)
        {
        MessageBox.Show("AL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return decStandardRateId;
 }
 /// <summary>
 /// Function to insert values to StandardRate Table
 /// </summary>
 /// <param name="standardrateinfo"></param>
 public void StandardRateAdd(StandardRateInfo standardrateinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("StandardRateAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@standardRateId", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.StandardRateId;
         sprmparam = sccmd.Parameters.Add("@applicableFrom", SqlDbType.DateTime);
         sprmparam.Value = standardrateinfo.ApplicableFrom;
         sprmparam = sccmd.Parameters.Add("@applicableTo", SqlDbType.DateTime);
         sprmparam.Value = standardrateinfo.ApplicableTo;
         sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.ProductId;
         sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.UnitId;
         sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.Rate;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = standardrateinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.BatchId;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = standardrateinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = standardrateinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to insert values to StandardRate Table and return the Curresponding row's Id
 /// </summary>
 /// <param name="standardrateinfo"></param>
 /// <returns></returns>
 public decimal StandardRateAddParticularfields(StandardRateInfo standardrateinfo)
 {
     decimal decStandardRateId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("StandardRateAddParticularfields", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@applicableFrom", SqlDbType.DateTime);
         sprmparam.Value = standardrateinfo.ApplicableFrom;
         sprmparam = sccmd.Parameters.Add("@applicableTo", SqlDbType.DateTime);
         sprmparam.Value = standardrateinfo.ApplicableTo;
         sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.ProductId;
         sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.UnitId;
         sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.BatchId;
         sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = standardrateinfo.Rate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = standardrateinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = standardrateinfo.Extra2;
         object ObjStandardRateId = sccmd.ExecuteScalar();
         if (ObjStandardRateId != null)
         {
             decStandardRateId = Convert.ToDecimal(ObjStandardRateId.ToString());
         }
         else
         {
             decStandardRateId = 0;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decStandardRateId;
 }
 /// <summary>
 /// Function to get particular values from StandardRate table based on the parameter
 /// </summary>
 /// <param name="standardRateId"></param>
 /// <returns></returns>
 public StandardRateInfo StandardRateView(decimal standardRateId)
 {
     StandardRateInfo standardrateinfo = new StandardRateInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("StandardRateView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@standardRateId", SqlDbType.Decimal);
         sprmparam.Value = standardRateId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             standardrateinfo.StandardRateId = decimal.Parse(sdrreader[0].ToString());
             standardrateinfo.ApplicableFrom = DateTime.Parse(sdrreader[1].ToString());
             standardrateinfo.ApplicableTo = DateTime.Parse(sdrreader[2].ToString());
             standardrateinfo.ProductId = decimal.Parse(sdrreader[3].ToString());
             standardrateinfo.UnitId = decimal.Parse(sdrreader[4].ToString());
             standardrateinfo.BatchId = decimal.Parse(sdrreader[5].ToString());
             standardrateinfo.Rate = decimal.Parse(sdrreader[6].ToString());
             standardrateinfo.ExtraDate = DateTime.Parse(sdrreader[7].ToString());
             standardrateinfo.Extra1 = sdrreader[8].ToString();
             standardrateinfo.Extra2 = sdrreader[9].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return standardrateinfo;
 }
 /// <summary>
 /// Function to get particular values from StandardRate table based on the parameter
 /// </summary>
 /// <param name="standardRateId"></param>
 /// <returns></returns>
 public StandardRateInfo StandardRateView(decimal standardRateId)
 {
     StandardRateInfo standardrateinfo = new StandardRateInfo();
        try
        {
        standardrateinfo = spStandaredRate.StandardRateView(standardRateId);
        }
        catch (Exception ex)
        {
        MessageBox.Show("AL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return standardrateinfo;
 }