Example #1
0
        /// <summary>
        /// Function to get particular values from SalesReturnDetails Table based on the parameter
        /// </summary>
        /// <param name="salesReturnDetailsId"></param>
        /// <returns></returns>
        public SalesReturnDetailsInfo SalesReturnDetailsView(decimal salesReturnDetailsId)
        {
            SalesReturnDetailsInfo salesreturndetailsinfo = new SalesReturnDetailsInfo();
            SqlDataReader          sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesReturnDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@salesReturnDetailsId", SqlDbType.Decimal);
                sprmparam.Value = salesReturnDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salesreturndetailsinfo.SalesReturnDetailsId = decimal.Parse(sdrreader[0].ToString());
                    salesreturndetailsinfo.SalesReturnMasterId  = decimal.Parse(sdrreader[1].ToString());
                    salesreturndetailsinfo.ProductId            = decimal.Parse(sdrreader[2].ToString());
                    salesreturndetailsinfo.Qty              = decimal.Parse(sdrreader[3].ToString());
                    salesreturndetailsinfo.Rate             = decimal.Parse(sdrreader[4].ToString());
                    salesreturndetailsinfo.UnitId           = decimal.Parse(sdrreader[5].ToString());
                    salesreturndetailsinfo.UnitConversionId = decimal.Parse(sdrreader[6].ToString());
                    salesreturndetailsinfo.Discount         = decimal.Parse(sdrreader[7].ToString());
                    salesreturndetailsinfo.TaxId            = decimal.Parse(sdrreader[8].ToString());
                    salesreturndetailsinfo.BatchId          = decimal.Parse(sdrreader[9].ToString());
                    salesreturndetailsinfo.GodownId         = decimal.Parse(sdrreader[10].ToString());
                    salesreturndetailsinfo.RackId           = decimal.Parse(sdrreader[11].ToString());
                    salesreturndetailsinfo.TaxAmount        = decimal.Parse(sdrreader[12].ToString());
                    salesreturndetailsinfo.GrossAmount      = decimal.Parse(sdrreader[13].ToString());
                    salesreturndetailsinfo.NetAmount        = decimal.Parse(sdrreader[14].ToString());
                    salesreturndetailsinfo.Amount           = decimal.Parse(sdrreader[15].ToString());
                    salesreturndetailsinfo.SlNo             = int.Parse(sdrreader[16].ToString());
                    salesreturndetailsinfo.SalesDetailsId   = decimal.Parse(sdrreader[17].ToString());
                    salesreturndetailsinfo.ExtraDate        = DateTime.Parse(sdrreader[18].ToString());
                    salesreturndetailsinfo.Extra1           = sdrreader[19].ToString();
                    salesreturndetailsinfo.Extra2           = sdrreader[20].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salesreturndetailsinfo);
        }
Example #2
0
 /// <summary>
 /// Function to Update values in SalesReturnDetails Table
 /// </summary>
 /// <param name="salesreturndetailsinfo"></param>
 public void SalesReturnDetailsEdit(SalesReturnDetailsInfo salesreturndetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesReturnDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@salesReturnDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.SalesReturnDetailsId;
         sprmparam       = sccmd.Parameters.Add("@salesReturnMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.SalesReturnMasterId;
         sprmparam       = sccmd.Parameters.Add("@salesDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.SalesDetailsId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.Qty;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.UnitConversionId;
         sprmparam       = sccmd.Parameters.Add("@discount", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.Discount;
         sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.TaxId;
         sprmparam       = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.BatchId;
         sprmparam       = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.GodownId;
         sprmparam       = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.RackId;
         sprmparam       = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.TaxAmount;
         sprmparam       = sccmd.Parameters.Add("@grossAmount", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.GrossAmount;
         sprmparam       = sccmd.Parameters.Add("@netAmount", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.NetAmount;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = salesreturndetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@slNo", SqlDbType.Int);
         sprmparam.Value = salesreturndetailsinfo.SlNo;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salesreturndetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salesreturndetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }