Exemple #1
0
 /// <summary>
 /// Function to Update values in PhysicalStockDetails Table
 /// </summary>
 /// <param name="physicalstockdetailsinfo"></param>
 public void PhysicalStockDetailsEdit(PhysicalStockDetailsInfo physicalstockdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PhysicalStockDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@physicalStockDetailsId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.PhysicalStockDetailsId;
         sprmparam       = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.PhysicalStockMasterId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.Qty;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.UnitConversionId;
         sprmparam       = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.BatchId;
         sprmparam       = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.GodownId;
         sprmparam       = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.RackId;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = physicalstockdetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@slno", SqlDbType.Int);
         sprmparam.Value = physicalstockdetailsinfo.Slno;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = physicalstockdetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = physicalstockdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Exemple #2
0
        /// <summary>
        /// Function to get particular values from PhysicalStockDetails table based on the parameter
        /// </summary>
        /// <param name="physicalStockDetailsId"></param>
        /// <returns></returns>
        public PhysicalStockDetailsInfo PhysicalStockDetailsView(decimal physicalStockDetailsId)
        {
            PhysicalStockDetailsInfo physicalstockdetailsinfo = new PhysicalStockDetailsInfo();
            SqlDataReader            sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PhysicalStockDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@physicalStockDetailsId", SqlDbType.Decimal);
                sprmparam.Value = physicalStockDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    physicalstockdetailsinfo.PhysicalStockDetailsId = decimal.Parse(sdrreader[0].ToString());
                    physicalstockdetailsinfo.PhysicalStockMasterId  = decimal.Parse(sdrreader[1].ToString());
                    physicalstockdetailsinfo.ProductId        = decimal.Parse(sdrreader[2].ToString());
                    physicalstockdetailsinfo.Qty              = decimal.Parse(sdrreader[3].ToString());
                    physicalstockdetailsinfo.Rate             = decimal.Parse(sdrreader[4].ToString());
                    physicalstockdetailsinfo.UnitId           = decimal.Parse(sdrreader[5].ToString());
                    physicalstockdetailsinfo.UnitConversionId = decimal.Parse(sdrreader[6].ToString());
                    physicalstockdetailsinfo.BatchId          = decimal.Parse(sdrreader[7].ToString());
                    physicalstockdetailsinfo.GodownId         = decimal.Parse(sdrreader[8].ToString());
                    physicalstockdetailsinfo.RackId           = decimal.Parse(sdrreader[9].ToString());
                    physicalstockdetailsinfo.Amount           = decimal.Parse(sdrreader[10].ToString());
                    physicalstockdetailsinfo.Slno             = int.Parse(sdrreader[11].ToString());
                    physicalstockdetailsinfo.ExtraDate        = DateTime.Parse(sdrreader[12].ToString());
                    physicalstockdetailsinfo.Extra1           = sdrreader[13].ToString();
                    physicalstockdetailsinfo.Extra2           = sdrreader[14].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(physicalstockdetailsinfo);
        }