Ejemplo n.º 1
0
        /// <summary>
        /// Function to Update values in JournalMaster Table
        /// </summary>
        /// <param name="journalmasterinfo"></param>
        /// <returns></returns>
        public decimal JournalMasterEdit(JournalMasterInfo journalmasterinfo)
        {
            decimal decEffectRow = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("JournalMasterEdit", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@journalMasterId", SqlDbType.Decimal);
                sprmparam.Value = journalmasterinfo.JournalMasterId;
                sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value = journalmasterinfo.VoucherNo;
                sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value = journalmasterinfo.InvoiceNo;
                sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value = journalmasterinfo.SuffixPrefixId;
                sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value = journalmasterinfo.Date;
                sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
                sprmparam.Value = journalmasterinfo.TotalAmount;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = journalmasterinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value = journalmasterinfo.UserId;
                sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = journalmasterinfo.VoucherTypeId;
                sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value = journalmasterinfo.FinancialYearId;
                sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
                sprmparam.Value = journalmasterinfo.ExtraDate;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = journalmasterinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = journalmasterinfo.Extra2;
                decEffectRow    = sccmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decEffectRow);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Function to get particular values from JournalMaster table based on the parameter
        /// </summary>
        /// <param name="journalMasterId"></param>
        /// <returns></returns>
        public JournalMasterInfo JournalMasterView(decimal journalMasterId)
        {
            JournalMasterInfo journalmasterinfo = new JournalMasterInfo();
            SqlDataReader     sdrreader         = null;

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