示例#1
0
        /// <summary>
        /// Function to Update values in PaymentDetails Table
        /// </summary>
        /// <param name="paymentdetailsinfo"></param>
        /// <returns></returns>
        public decimal PaymentDetailsEdit(PaymentDetailsInfo paymentdetailsinfo)
        {
            decimal decPaymentDetailsId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PaymentDetailsEdit", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam           = sccmd.Parameters.Add("@paymentDetailsId", SqlDbType.Decimal);
                sprmparam.Value     = paymentdetailsinfo.PaymentDetailsId;
                sprmparam           = sccmd.Parameters.Add("@paymentMasterId", SqlDbType.Decimal);
                sprmparam.Value     = paymentdetailsinfo.PaymentMasterId;
                sprmparam           = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value     = paymentdetailsinfo.LedgerId;
                sprmparam           = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
                sprmparam.Value     = paymentdetailsinfo.Amount;
                sprmparam           = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
                sprmparam.Value     = paymentdetailsinfo.ExchangeRateId;
                sprmparam           = sccmd.Parameters.Add("@chequeNo", SqlDbType.VarChar);
                sprmparam.Value     = paymentdetailsinfo.ChequeNo;
                sprmparam           = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime);
                sprmparam.Value     = paymentdetailsinfo.ChequeDate;
                sprmparam           = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value     = paymentdetailsinfo.Extra1;
                sprmparam           = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value     = paymentdetailsinfo.Extra2;
                decPaymentDetailsId = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decPaymentDetailsId);
        }
示例#2
0
        /// <summary>
        /// Function to get particular values from PaymentDetails Table based on the parameter
        /// </summary>
        /// <param name="paymentDetailsId"></param>
        /// <returns></returns>
        public PaymentDetailsInfo PaymentDetailsView(decimal paymentDetailsId)
        {
            PaymentDetailsInfo paymentdetailsinfo = new PaymentDetailsInfo();
            SqlDataReader      sdrreader          = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PaymentDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@paymentDetailsId", SqlDbType.Decimal);
                sprmparam.Value = paymentDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    paymentdetailsinfo.PaymentDetailsId = decimal.Parse(sdrreader[0].ToString());
                    paymentdetailsinfo.PaymentMasterId  = decimal.Parse(sdrreader[1].ToString());
                    paymentdetailsinfo.LedgerId         = decimal.Parse(sdrreader[2].ToString());
                    paymentdetailsinfo.Amount           = decimal.Parse(sdrreader[3].ToString());
                    paymentdetailsinfo.ExchangeRateId   = decimal.Parse(sdrreader["exchangeRateId"].ToString());
                    paymentdetailsinfo.ChequeNo         = sdrreader[4].ToString();
                    paymentdetailsinfo.ChequeDate       = DateTime.Parse(sdrreader[5].ToString());
                    paymentdetailsinfo.ExtraDate        = DateTime.Parse(sdrreader[6].ToString());
                    paymentdetailsinfo.Extra1           = sdrreader[7].ToString();
                    paymentdetailsinfo.Extra2           = sdrreader[8].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            { sdrreader.Close();
              sqlcon.Close(); }
            return(paymentdetailsinfo);
        }