public DeliveryNoteMasterInfo DeliveryNoteMasterViewAllByMasterId(decimal decDeliveryNoteMasterId)
 {
     DeliveryNoteMasterInfo infoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
        try
        {
        infoDeliveryNoteMaster = spDeliveryNoteMaster.DeliveryNoteMasterViewAllByMasterId(decDeliveryNoteMasterId);
        }
        catch (Exception ex)
        {
        MessageBox.Show("DNBLL:12" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return infoDeliveryNoteMaster;
 }
 public void DeliveryNoteMasterEdit(DeliveryNoteMasterInfo deliverynotemasterinfo)
 {
     try
        {
         spDeliveryNoteMaster.DeliveryNoteMasterEdit(deliverynotemasterinfo);
        }
        catch (Exception ex)
        {
        MessageBox.Show("DNBLL:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
 }
 public DeliveryNoteMasterInfo DeliveryNoteMasterView(decimal deliveryNoteMasterId)
 {
     DeliveryNoteMasterInfo deliverynotemasterinfo = new DeliveryNoteMasterInfo();
        try
        {
        deliverynotemasterinfo = spDeliveryNoteMaster.DeliveryNoteMasterView(deliveryNoteMasterId);
        }
        catch (Exception ex)
        {
        MessageBox.Show("DNBLL:22" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return deliverynotemasterinfo;
 }
 public decimal DeliveryNoteMasterAdd(DeliveryNoteMasterInfo deliverynotemasterinfo)
 {
     decimal decDeliveryNoteMasterId = 0;
        try
        {
        decDeliveryNoteMasterId = spDeliveryNoteMaster.DeliveryNoteMasterAdd(deliverynotemasterinfo);
        }
        catch (Exception ex)
        {
        MessageBox.Show("DNBLL:14" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        return decDeliveryNoteMasterId;
 }
 /// <summary>
 /// Function to DeliveryNote Master View SalesMan And Pricing
 /// </summary>
 /// <param name="deliveryNoteMasterId"></param>
 /// <returns></returns>
 public DeliveryNoteMasterInfo DeliveryNoteMasterViewSalesManAndPricing(decimal deliveryNoteMasterId)
 {
     DeliveryNoteMasterInfo deliverynotemasterinfo = new DeliveryNoteMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DeliveryNoteMasterViewSalesManAndPricing", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@deliveryNoteMasterId", SqlDbType.Decimal);
         sprmparam.Value = deliveryNoteMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             deliverynotemasterinfo.DeliveryNoteMasterId = decimal.Parse(sdrreader["deliveryNoteMasterId"].ToString());
             deliverynotemasterinfo.PricinglevelId = decimal.Parse(sdrreader["pricinglevelId"].ToString());
             deliverynotemasterinfo.EmployeeId = decimal.Parse(sdrreader["employeeId"].ToString());
             deliverynotemasterinfo.ExchangeRateId = decimal.Parse(sdrreader["exchangeRateId"].ToString());
             deliverynotemasterinfo.UserId = decimal.Parse(sdrreader["userId"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return deliverynotemasterinfo;
 }
 /// <summary>
 /// Function to Delivery Note Master View All By MasterId
 /// </summary>
 /// <param name="decDeliveryNoteMasterId"></param>
 /// <returns></returns>
 public DeliveryNoteMasterInfo DeliveryNoteMasterViewAllByMasterId(decimal decDeliveryNoteMasterId)
 {
     DeliveryNoteMasterInfo infoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
     SqlDataReader sdrReader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sqlcmd = new SqlCommand("DeliveryNoteMasterViewAllByMasterId", sqlcon);
         sqlcmd.CommandType = CommandType.StoredProcedure;
         SqlParameter param = new SqlParameter();
         param = sqlcmd.Parameters.Add("@deliveryNoteMasterId", SqlDbType.Decimal);
         param.Value = decDeliveryNoteMasterId;
         sdrReader = sqlcmd.ExecuteReader();
         while (sdrReader.Read())
         {
             infoDeliveryNoteMaster.DeliveryNoteMasterId = decimal.Parse(sdrReader["deliveryNoteMasterId"].ToString());
             infoDeliveryNoteMaster.VoucherNo = sdrReader["voucherNo"].ToString();
             infoDeliveryNoteMaster.InvoiceNo = sdrReader["invoiceNo"].ToString();
             infoDeliveryNoteMaster.VoucherTypeId = Convert.ToDecimal(sdrReader["voucherTypeId"].ToString());
             infoDeliveryNoteMaster.SuffixPrefixId = Convert.ToDecimal(sdrReader["suffixPrefixId"].ToString());
             infoDeliveryNoteMaster.Date = Convert.ToDateTime(sdrReader["date"].ToString());
             infoDeliveryNoteMaster.LedgerId = Convert.ToDecimal(sdrReader["ledgerId"].ToString());
             infoDeliveryNoteMaster.PricinglevelId = Convert.ToDecimal(sdrReader["pricingLevelId"].ToString());
             infoDeliveryNoteMaster.EmployeeId = Convert.ToDecimal(sdrReader["employeeId"].ToString());
             infoDeliveryNoteMaster.Narration = (sdrReader["narration"].ToString());
             infoDeliveryNoteMaster.SuffixPrefixId = Convert.ToDecimal(sdrReader["suffixPrefixId"].ToString());
             infoDeliveryNoteMaster.ExchangeRateId = Convert.ToDecimal(sdrReader["exchangeRateId"].ToString());
             infoDeliveryNoteMaster.TotalAmount = Convert.ToDecimal(sdrReader["totalAmount"].ToString());
             infoDeliveryNoteMaster.UserId = Convert.ToDecimal(sdrReader["userId"].ToString());
             infoDeliveryNoteMaster.TransportationCompany = (sdrReader["transportationCompany"].ToString());
             infoDeliveryNoteMaster.LrNo = (sdrReader["lrNo"].ToString());
             infoDeliveryNoteMaster.OrderMasterId = Convert.ToDecimal((sdrReader["orderMasterId"].ToString()));
             infoDeliveryNoteMaster.QuotationMasterId = Convert.ToDecimal((sdrReader["quotationMasterId"].ToString()));
         }
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         sqlcon.Close();
     }
     return infoDeliveryNoteMaster;
 }
 /// <summary>
 /// Function to get particular values from DeliveryNoteMaster Table based on the parameter
 /// </summary>
 /// <param name="deliveryNoteMasterId"></param>
 /// <returns></returns>
 public DeliveryNoteMasterInfo DeliveryNoteMasterView(decimal deliveryNoteMasterId)
 {
     DeliveryNoteMasterInfo deliverynotemasterinfo = new DeliveryNoteMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DeliveryNoteMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@deliveryNoteMasterId", SqlDbType.Decimal);
         sprmparam.Value = deliveryNoteMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             deliverynotemasterinfo.DeliveryNoteMasterId = decimal.Parse(sdrreader[0].ToString());
             deliverynotemasterinfo.VoucherNo = sdrreader[1].ToString();
             deliverynotemasterinfo.InvoiceNo = sdrreader[2].ToString();
             deliverynotemasterinfo.VoucherTypeId = decimal.Parse(sdrreader[3].ToString());
             deliverynotemasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[4].ToString());
             deliverynotemasterinfo.Date = DateTime.Parse(sdrreader[5].ToString());
             deliverynotemasterinfo.LedgerId = decimal.Parse(sdrreader[6].ToString());
             deliverynotemasterinfo.OrderMasterId = decimal.Parse(sdrreader[7].ToString());
             deliverynotemasterinfo.PricinglevelId = decimal.Parse(sdrreader[8].ToString());
             deliverynotemasterinfo.EmployeeId = decimal.Parse(sdrreader[9].ToString());
             deliverynotemasterinfo.Narration = sdrreader[10].ToString();
             deliverynotemasterinfo.ExchangeRateId = decimal.Parse(sdrreader[11].ToString());
             deliverynotemasterinfo.TotalAmount = decimal.Parse(sdrreader[12].ToString());
             deliverynotemasterinfo.UserId = decimal.Parse(sdrreader[13].ToString());
             deliverynotemasterinfo.LrNo = sdrreader[14].ToString();
             deliverynotemasterinfo.TransportationCompany = sdrreader[15].ToString();
             deliverynotemasterinfo.QuotationMasterId = decimal.Parse(sdrreader[16].ToString());
             deliverynotemasterinfo.FinancialYearId = decimal.Parse(sdrreader[17].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return deliverynotemasterinfo;
 }
 /// <summary>
 /// Function to Update values in DeliveryNoteMaster Table
 /// </summary>
 /// <param name="deliverynotemasterinfo"></param>
 public void DeliveryNoteMasterEdit(DeliveryNoteMasterInfo deliverynotemasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DeliveryNoteMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@deliveryNoteMasterId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.DeliveryNoteMasterId;
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = deliverynotemasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = deliverynotemasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = deliverynotemasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@orderMasterId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.OrderMasterId;
         sprmparam = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.PricinglevelId;
         sprmparam = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.EmployeeId;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = deliverynotemasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.ExchangeRateId;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@lrNo", SqlDbType.VarChar);
         sprmparam.Value = deliverynotemasterinfo.LrNo;
         sprmparam = sccmd.Parameters.Add("@transportationCompany", SqlDbType.VarChar);
         sprmparam.Value = deliverynotemasterinfo.TransportationCompany;
         sprmparam = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.QuotationMasterId;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = deliverynotemasterinfo.FinancialYearId;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }