예제 #1
0
        /// <summary>
        /// Function to get particular values from SalesDetails Table based on the parameter
        /// </summary>
        /// <param name="salesDetailsId"></param>
        /// <returns></returns>
        public SalesDetailsInfo SalesDetailsView(decimal salesDetailsId)
        {
            SalesDetailsInfo salesdetailsinfo = new SalesDetailsInfo();
            SqlDataReader    sdrreader        = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@salesDetailsId", SqlDbType.Decimal);
                sprmparam.Value = salesDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salesdetailsinfo.SalesDetailsId        = decimal.Parse(sdrreader[0].ToString());
                    salesdetailsinfo.SalesMasterId         = decimal.Parse(sdrreader[1].ToString());
                    salesdetailsinfo.DeliveryNoteDetailsId = decimal.Parse(sdrreader[2].ToString());
                    salesdetailsinfo.OrderDetailsId        = decimal.Parse(sdrreader[3].ToString());
                    salesdetailsinfo.QuotationDetailsId    = decimal.Parse(sdrreader[4].ToString());
                    salesdetailsinfo.ProductId             = decimal.Parse(sdrreader[5].ToString());
                    salesdetailsinfo.Qty              = decimal.Parse(sdrreader[6].ToString());
                    salesdetailsinfo.Rate             = decimal.Parse(sdrreader[7].ToString());
                    salesdetailsinfo.UnitId           = decimal.Parse(sdrreader[8].ToString());
                    salesdetailsinfo.UnitConversionId = decimal.Parse(sdrreader[9].ToString());
                    salesdetailsinfo.Discount         = decimal.Parse(sdrreader[10].ToString());
                    salesdetailsinfo.TaxId            = decimal.Parse(sdrreader[11].ToString());
                    salesdetailsinfo.BatchId          = decimal.Parse(sdrreader[12].ToString());
                    salesdetailsinfo.GodownId         = decimal.Parse(sdrreader[13].ToString());
                    salesdetailsinfo.RackId           = decimal.Parse(sdrreader[14].ToString());
                    salesdetailsinfo.TaxAmount        = decimal.Parse(sdrreader[15].ToString());
                    salesdetailsinfo.GrossAmount      = decimal.Parse(sdrreader[16].ToString());
                    salesdetailsinfo.NetAmount        = decimal.Parse(sdrreader[17].ToString());
                    salesdetailsinfo.Amount           = decimal.Parse(sdrreader[18].ToString());
                    salesdetailsinfo.SlNo             = int.Parse(sdrreader[19].ToString());
                    salesdetailsinfo.ExtraDate        = DateTime.Parse(sdrreader[20].ToString());
                    salesdetailsinfo.Extra1           = sdrreader[21].ToString();
                    salesdetailsinfo.Extra2           = sdrreader[22].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salesdetailsinfo);
        }
예제 #2
0
 /// <summary>
 /// Function to insert values to SalesDetails Table
 /// </summary>
 /// <param name="salesdetailsinfo"></param>
 public void SalesDetailsAdd(SalesDetailsInfo salesdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesDetailsAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@salesMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.SalesMasterId;
         sprmparam       = sccmd.Parameters.Add("@deliveryNoteDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.DeliveryNoteDetailsId;
         sprmparam       = sccmd.Parameters.Add("@orderDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.OrderDetailsId;
         sprmparam       = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.QuotationDetailsId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.Qty;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.UnitConversionId;
         sprmparam       = sccmd.Parameters.Add("@discount", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.Discount;
         sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.TaxId;
         sprmparam       = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.BatchId;
         sprmparam       = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.GodownId;
         sprmparam       = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.RackId;
         sprmparam       = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.TaxAmount;
         sprmparam       = sccmd.Parameters.Add("@grossAmount", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.GrossAmount;
         sprmparam       = sccmd.Parameters.Add("@netAmount", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.NetAmount;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = salesdetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@slNo", SqlDbType.Int);
         sprmparam.Value = salesdetailsinfo.SlNo;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = salesdetailsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salesdetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salesdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }