Exemplo n.º 1
0
 /// <summary>
 /// Function to Update values in StockJournal Table
 /// </summary>
 /// <param name="stockjournaldetailsinfo"></param>
 public void StockJournalDetailsEdit(StockJournalDetailsInfo stockjournaldetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("StockJournalDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@stockJournalDetailsId", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.StockJournalDetailsId;
         sprmparam       = sccmd.Parameters.Add("@stockJournalMasterId", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.StockJournalMasterId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.Qty;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.UnitConversionId;
         sprmparam       = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.BatchId;
         sprmparam       = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.GodownId;
         sprmparam       = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.RackId;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = stockjournaldetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@consumptionOrProduction", SqlDbType.VarChar);
         sprmparam.Value = stockjournaldetailsinfo.ConsumptionOrProduction;
         sprmparam       = sccmd.Parameters.Add("@slno", SqlDbType.Int);
         sprmparam.Value = stockjournaldetailsinfo.Slno;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = stockjournaldetailsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = stockjournaldetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = stockjournaldetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Function to get particular values from StockJournal Table based on parameter
        /// </summary>
        /// <param name="stockJournalDetailsId"></param>
        /// <returns></returns>
        public StockJournalDetailsInfo StockJournalDetailsView(decimal stockJournalDetailsId)
        {
            StockJournalDetailsInfo stockjournaldetailsinfo = new StockJournalDetailsInfo();
            SqlDataReader           sdrreader = null;

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