public void PurchaseOrderDetailsAdd(PurchaseOrderDetailsInfo purchaseorderdetailsinfo)
 {
     PurchaseOrderDetailsSP SPPurchaseOrderDetails = new PurchaseOrderDetailsSP();
     try
     {
         SPPurchaseOrderDetails.PurchaseOrderDetailsAdd(purchaseorderdetailsinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PoBll 7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to insert values to PurchaseOrderDetails Table
 /// </summary>
 /// <param name="purchaseorderdetailsinfo"></param>
 public void PurchaseOrderDetailsAdd(PurchaseOrderDetailsInfo purchaseorderdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PurchaseOrderDetailsAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@purchaseOrderMasterId", SqlDbType.Decimal);
         sprmparam.Value = purchaseorderdetailsinfo.PurchaseOrderMasterId;
         sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = purchaseorderdetailsinfo.ProductId;
         sprmparam = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = purchaseorderdetailsinfo.Qty;
         sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = purchaseorderdetailsinfo.Rate;
         sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = purchaseorderdetailsinfo.UnitId;
         sprmparam = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = purchaseorderdetailsinfo.UnitConversionId;
         sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = purchaseorderdetailsinfo.Amount;
         sprmparam = sccmd.Parameters.Add("@slNo", SqlDbType.Int);
         sprmparam.Value = purchaseorderdetailsinfo.SlNo;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = purchaseorderdetailsinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = purchaseorderdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to get particular values from PurchaseOrderDetails Table based on the parameter
 /// </summary>
 /// <param name="purchaseOrderDetailsId"></param>
 /// <returns></returns>
 public PurchaseOrderDetailsInfo PurchaseOrderDetailsView(decimal purchaseOrderDetailsId)
 {
     PurchaseOrderDetailsInfo purchaseorderdetailsinfo = new PurchaseOrderDetailsInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PurchaseOrderDetailsView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@purchaseOrderDetailsId", SqlDbType.Decimal);
         sprmparam.Value = purchaseOrderDetailsId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             purchaseorderdetailsinfo.PurchaseOrderDetailsId = decimal.Parse(sdrreader[0].ToString());
             purchaseorderdetailsinfo.PurchaseOrderMasterId = decimal.Parse(sdrreader[1].ToString());
             purchaseorderdetailsinfo.ProductId = decimal.Parse(sdrreader[2].ToString());
             purchaseorderdetailsinfo.Qty = decimal.Parse(sdrreader[3].ToString());
             purchaseorderdetailsinfo.Rate = decimal.Parse(sdrreader[4].ToString());
             purchaseorderdetailsinfo.UnitId = decimal.Parse(sdrreader[5].ToString());
             purchaseorderdetailsinfo.UnitConversionId = decimal.Parse(sdrreader[6].ToString());
             purchaseorderdetailsinfo.Amount = decimal.Parse(sdrreader[7].ToString());
             purchaseorderdetailsinfo.SlNo = int.Parse(sdrreader[8].ToString());
             purchaseorderdetailsinfo.ExtraDate = DateTime.Parse(sdrreader[9].ToString());
             purchaseorderdetailsinfo.Extra1 = sdrreader[10].ToString();
             purchaseorderdetailsinfo.Extra2 = sdrreader[11].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return purchaseorderdetailsinfo;
 }