public void DeliveryNoteDetailsEdit(DeliveryNoteDetailsInfo deliverynotedetailsinfo)
 {
     try
        {
        spDeliveryNoteDetails.DeliveryNoteDetailsEdit(deliverynotedetailsinfo);
        }
        catch (Exception ex)
        {
        MessageBox.Show("DNBLL:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
 }
 /// <summary>
 /// Function to insert values to DeliveryNoteDetails Table
 /// </summary>
 /// <param name="deliverynotedetailsinfo"></param>
 public void DeliveryNoteDetailsAdd(DeliveryNoteDetailsInfo deliverynotedetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DeliveryNoteDetailsAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@deliveryNoteMasterId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.DeliveryNoteMasterId;
         sprmparam = sccmd.Parameters.Add("@orderDetails1Id", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.OrderDetails1Id;
         sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.ProductId;
         sprmparam = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.Qty;
         sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.Rate;
         sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.UnitId;
         sprmparam = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.UnitConversionId;
         sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.Amount;
         sprmparam = sccmd.Parameters.Add("@quotationDetails1Id", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.QuotationDetails1Id;
         sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.BatchId;
         sprmparam = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.GodownId;
         sprmparam = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotedetailsinfo.RackId;
         sprmparam = sccmd.Parameters.Add("@slNo", SqlDbType.Int);
         sprmparam.Value = deliverynotedetailsinfo.SlNo;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = deliverynotedetailsinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = deliverynotedetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to get Quantity details based on parameters
 /// </summary>
 /// <param name="decDeliveryNoteId"></param>
 /// <param name="decProductId"></param>
 /// <returns></returns>
 public DeliveryNoteDetailsInfo QuantityEditingAfterCheckingSalesAndRejectionInForDeliveryNote(decimal decDeliveryNoteId, decimal decProductId)
 {
     DeliveryNoteDetailsInfo infoDeliveryNoteDetails = new DeliveryNoteDetailsInfo();
     SqlDataReader sdrReader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sqlcmd = new SqlCommand("QuantityEditingAfterCheckingSalesAndRejectionInForDeliveryNote", sqlcon);
         sqlcmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sqlcmd.Parameters.Add("@deliveryNoteMasterId", SqlDbType.Decimal);
         sprmparam.Value = decDeliveryNoteId;
         sprmparam = sqlcmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = decProductId;
         sdrReader = sqlcmd.ExecuteReader();
         while (sdrReader.Read())
         {
             infoDeliveryNoteDetails.Qty = Convert.ToDecimal(sdrReader["Qty"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrReader.Close();
         sqlcon.Close();
     }
     return infoDeliveryNoteDetails;
 }
 /// <summary>
 /// Function to get particular values from DeliveryNoteDetails table based on the parameter
 /// </summary>
 /// <param name="deliveryNoteDetails1Id"></param>
 /// <returns></returns>
 public DeliveryNoteDetailsInfo DeliveryNoteDetailsView(decimal deliveryNoteDetails1Id)
 {
     DeliveryNoteDetailsInfo deliverynotedetailsinfo = new DeliveryNoteDetailsInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DeliveryNoteDetailsView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@deliveryNoteDetails1Id", SqlDbType.Decimal);
         sprmparam.Value = deliveryNoteDetails1Id;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             deliverynotedetailsinfo.DeliveryNoteDetails1Id = decimal.Parse(sdrreader[0].ToString());
             deliverynotedetailsinfo.DeliveryNoteMasterId = decimal.Parse(sdrreader[1].ToString());
             deliverynotedetailsinfo.OrderDetails1Id = decimal.Parse(sdrreader[2].ToString());
             deliverynotedetailsinfo.ProductId = decimal.Parse(sdrreader[3].ToString());
             deliverynotedetailsinfo.Qty = decimal.Parse(sdrreader[4].ToString());
             deliverynotedetailsinfo.Rate = decimal.Parse(sdrreader[5].ToString());
             deliverynotedetailsinfo.UnitId = decimal.Parse(sdrreader[6].ToString());
             deliverynotedetailsinfo.UnitConversionId = decimal.Parse(sdrreader[7].ToString());
             deliverynotedetailsinfo.Amount = decimal.Parse(sdrreader[8].ToString());
             deliverynotedetailsinfo.QuotationDetails1Id = decimal.Parse(sdrreader[9].ToString());
             deliverynotedetailsinfo.BatchId = decimal.Parse(sdrreader[10].ToString());
             deliverynotedetailsinfo.GodownId = decimal.Parse(sdrreader[11].ToString());
             deliverynotedetailsinfo.RackId = decimal.Parse(sdrreader[12].ToString());
             deliverynotedetailsinfo.SlNo = int.Parse(sdrreader[13].ToString());
             deliverynotedetailsinfo.ExtraDate = DateTime.Parse(sdrreader[14].ToString());
             deliverynotedetailsinfo.Extra1 = sdrreader[15].ToString();
             deliverynotedetailsinfo.Extra2 = sdrreader[16].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return deliverynotedetailsinfo;
 }