Esempio n. 1
0
 /// <summary>
 /// Function to Update values in SalesQuotationDetails Table
 /// </summary>
 /// <param name="salesquotationdetailsinfo"></param>
 public void SalesQuotationDetailsEdit(SalesQuotationDetailsInfo salesquotationdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesQuotationDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.QuotationDetailsId;
         sprmparam       = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.QuotationMasterId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.UnitConversionId;
         sprmparam       = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Qty;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.BatchId;
         sprmparam       = sccmd.Parameters.Add("@slno", SqlDbType.Int);
         sprmparam.Value = salesquotationdetailsinfo.Slno;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salesquotationdetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salesquotationdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Function to get particular values from SalesQuotationDetails Table based on the parameter
        /// </summary>
        /// <param name="quotationDetailsId"></param>
        /// <returns></returns>
        public SalesQuotationDetailsInfo SalesQuotationDetailsView(decimal quotationDetailsId)
        {
            SalesQuotationDetailsInfo salesquotationdetailsinfo = new SalesQuotationDetailsInfo();
            SqlDataReader             sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesQuotationDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal);
                sprmparam.Value = quotationDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salesquotationdetailsinfo.QuotationDetailsId = Convert.ToDecimal(sdrreader[0].ToString());
                    salesquotationdetailsinfo.QuotationMasterId  = Convert.ToDecimal(sdrreader[1].ToString());
                    salesquotationdetailsinfo.ProductId          = Convert.ToDecimal(sdrreader[2].ToString());
                    salesquotationdetailsinfo.UnitId             = Convert.ToDecimal(sdrreader[3].ToString());
                    salesquotationdetailsinfo.UnitConversionId   = Convert.ToDecimal(sdrreader[4].ToString());
                    salesquotationdetailsinfo.Qty     = Convert.ToDecimal(sdrreader[5].ToString());
                    salesquotationdetailsinfo.Rate    = Convert.ToDecimal(sdrreader[6].ToString());
                    salesquotationdetailsinfo.Amount  = Convert.ToDecimal(sdrreader[7].ToString());
                    salesquotationdetailsinfo.Slno    = int.Parse(sdrreader[8].ToString());
                    salesquotationdetailsinfo.Extra1  = sdrreader[11].ToString();
                    salesquotationdetailsinfo.Extra2  = sdrreader[12].ToString();
                    salesquotationdetailsinfo.BatchId = Convert.ToDecimal(sdrreader[13].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salesquotationdetailsinfo);
        }