Пример #1
0
        /// <summary>
        /// Function to insert values to StockJournal Table
        /// </summary>
        /// <param name="stockjournalmasterinfo"></param>
        /// <returns></returns>
        public decimal StockJournalMasterAdd(StockJournalMasterInfo stockjournalmasterinfo)
        {
            decimal decStockJournalMasterId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("StockJournalMasterAdd", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam               = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value         = stockjournalmasterinfo.VoucherNo;
                sprmparam               = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value         = stockjournalmasterinfo.InvoiceNo;
                sprmparam               = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value         = stockjournalmasterinfo.SuffixPrefixId;
                sprmparam               = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value         = stockjournalmasterinfo.VoucherTypeId;
                sprmparam               = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value         = stockjournalmasterinfo.Date;
                sprmparam               = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value         = stockjournalmasterinfo.Narration;
                sprmparam               = sccmd.Parameters.Add("@additionalCost", SqlDbType.Decimal);
                sprmparam.Value         = stockjournalmasterinfo.AdditionalCost;
                sprmparam               = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
                sprmparam.Value         = stockjournalmasterinfo.FinancialYearId;
                sprmparam               = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value         = stockjournalmasterinfo.FinancialYearId;
                sprmparam               = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value         = stockjournalmasterinfo.Extra1;
                sprmparam               = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value         = stockjournalmasterinfo.Extra2;
                decStockJournalMasterId = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decStockJournalMasterId);
        }
Пример #2
0
        /// <summary>
        /// Function to get particular values from StockJournal Table based on the parameter
        /// </summary>
        /// <param name="stockJournalMasterId"></param>
        /// <returns></returns>
        public StockJournalMasterInfo StockJournalMasterView(decimal stockJournalMasterId)
        {
            StockJournalMasterInfo stockjournalmasterinfo = new StockJournalMasterInfo();
            SqlDataReader          sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("StockJournalMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@stockJournalMasterId", SqlDbType.Decimal);
                sprmparam.Value = stockJournalMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    stockjournalmasterinfo.StockJournalMasterId = decimal.Parse(sdrreader[0].ToString());
                    stockjournalmasterinfo.VoucherNo            = sdrreader[1].ToString();
                    stockjournalmasterinfo.InvoiceNo            = sdrreader[2].ToString();
                    stockjournalmasterinfo.SuffixPrefixId       = decimal.Parse(sdrreader[3].ToString());
                    stockjournalmasterinfo.VoucherTypeId        = decimal.Parse(sdrreader[4].ToString());
                    stockjournalmasterinfo.Date            = DateTime.Parse(sdrreader[5].ToString());
                    stockjournalmasterinfo.Narration       = sdrreader[6].ToString();
                    stockjournalmasterinfo.AdditionalCost  = decimal.Parse(sdrreader[7].ToString());
                    stockjournalmasterinfo.FinancialYearId = decimal.Parse(sdrreader[8].ToString());
                    stockjournalmasterinfo.ExtraDate       = DateTime.Parse(sdrreader[9].ToString());
                    stockjournalmasterinfo.Extra1          = sdrreader[10].ToString();
                    stockjournalmasterinfo.Extra2          = sdrreader[11].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(stockjournalmasterinfo);
        }