Exemplo n.º 1
0
        /// <summary>
        /// Function to Update values in PaymentMaster Table
        /// </summary>
        /// <param name="paymentmasterinfo"></param>
        /// <returns></returns>
        public decimal PaymentMasterEdit(PaymentMasterInfo paymentmasterinfo)
        {
            decimal decPaymentMasterId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PaymentMasterEdit", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam          = sccmd.Parameters.Add("@paymentMasterId", SqlDbType.Decimal);
                sprmparam.Value    = paymentmasterinfo.PaymentMasterId;
                sprmparam          = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value    = paymentmasterinfo.VoucherNo;
                sprmparam          = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value    = paymentmasterinfo.InvoiceNo;
                sprmparam          = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value    = paymentmasterinfo.SuffixPrefixId;
                sprmparam          = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value    = paymentmasterinfo.Date;
                sprmparam          = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value    = paymentmasterinfo.LedgerId;
                sprmparam          = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
                sprmparam.Value    = paymentmasterinfo.TotalAmount;
                sprmparam          = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value    = paymentmasterinfo.Narration;
                sprmparam          = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value    = paymentmasterinfo.VoucherTypeId;
                sprmparam          = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value    = paymentmasterinfo.UserId;
                sprmparam          = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value    = paymentmasterinfo.FinancialYearId;
                sprmparam          = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value    = paymentmasterinfo.Extra1;
                sprmparam          = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value    = paymentmasterinfo.Extra2;
                decPaymentMasterId = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decPaymentMasterId);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Function to get particular values from PaymentMaster table based on the parameter
        /// </summary>
        /// <param name="paymentMastertId"></param>
        /// <returns></returns>
        public PaymentMasterInfo PaymentMasterView(decimal paymentMastertId)
        {
            PaymentMasterInfo paymentmasterinfo = new PaymentMasterInfo();
            SqlDataReader     sdrreader         = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PaymentMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@paymentMasterId", SqlDbType.Decimal);
                sprmparam.Value = paymentMastertId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    paymentmasterinfo.PaymentMasterId = decimal.Parse(sdrreader[0].ToString());
                    paymentmasterinfo.VoucherNo       = sdrreader[1].ToString();
                    paymentmasterinfo.InvoiceNo       = sdrreader[2].ToString();
                    paymentmasterinfo.SuffixPrefixId  = decimal.Parse(sdrreader[3].ToString());
                    paymentmasterinfo.Date            = DateTime.Parse(sdrreader[4].ToString());
                    paymentmasterinfo.LedgerId        = decimal.Parse(sdrreader[5].ToString());
                    paymentmasterinfo.TotalAmount     = decimal.Parse(sdrreader[6].ToString());
                    paymentmasterinfo.Narration       = sdrreader[7].ToString();
                    paymentmasterinfo.VoucherTypeId   = decimal.Parse(sdrreader[8].ToString());
                    paymentmasterinfo.UserId          = decimal.Parse(sdrreader[10].ToString());
                    paymentmasterinfo.FinancialYearId = decimal.Parse(sdrreader[11].ToString());
                    paymentmasterinfo.ExtraDate       = DateTime.Parse(sdrreader[12].ToString());
                    paymentmasterinfo.Extra1          = sdrreader[13].ToString();
                    paymentmasterinfo.Extra2          = sdrreader[14].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(paymentmasterinfo);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void gridfill()
 {
     try
     {
         PaymentMasterSP   SpPaymentMaster   = new PaymentMasterSP();
         PaymentMasterInfo infoPaymentMaster = new PaymentMasterInfo();
         DataTable         dtbl = new DataTable();
         if (cmbAccountLedger.Items.Count > 0)
         {
             if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView")
             {
                 if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
                 {
                     dtbl = SpPaymentMaster.PaymentMasterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue), txtVoucherNo.Text);
                     dgvPaymentRegister.DataSource = dtbl;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREG4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }