Esempio n. 1
0
 public void paymentCalculation(fee f, gymMember g)
 {
     if (string.IsNullOrWhiteSpace(f.lastVPaymentDate))
     {
         f.lastVPaymentDate = g.joinedDate;
     }
 }
Esempio n. 2
0
        public bool addFee(fee f, gymMember g)
        {
            try
            {
                paymentCalculation(f, g);


                DataLayer.dbConnect dbfee = new DataLayer.dbConnect();
                dbfee.openConnection();

                string qf1 = "insert into tbl_fee (amount,service,valde_date,paid_date,paid_time,memberID) values(@amount,@service,@valid_date,@paid_date,@paidTime,@memerID)";

                SqlCommand cmd1 = new SqlCommand(qf1, dbfee.getConnection());


                cmd1.Parameters.AddWithValue("@amount", f.newAmount);
                cmd1.Parameters.AddWithValue("@service", f.service);
                cmd1.Parameters.AddWithValue("@valid_date", f.PaymentvalidDate);
                cmd1.Parameters.AddWithValue("@paid_date", f.paidDate);
                cmd1.Parameters.AddWithValue("@memerID", f.memberID);
                cmd1.Parameters.AddWithValue("@paidTime", f.paidTime);


                cmd1.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ext)
            {
                MessageBox.Show(ext.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
Esempio n. 3
0
        public bool checkPaymentDetails(fee f)
        {
            DataLayer.dbConnect fpay = new DataLayer.dbConnect();
            fpay.openConnection();

            string qf = "select  * from tbl_fee where memberID=@id and feeID = (select max(feeID) from tbl_fee) ";

            SqlCommand cmdf = new SqlCommand(qf, fpay.getConnection());

            cmdf.Parameters.AddWithValue("@id", f.memberID);
            DataTable      dtx    = new DataTable();
            SqlDataAdapter daf    = new SqlDataAdapter(cmdf);
            bool           testf1 = false;

            daf.Fill(dtx);

            if (dtx.Rows.Count > 0)
            {
                f.LastPaid_amount  = double.Parse(dtx.Rows[0]["amount"].ToString());
                f.service          = dtx.Rows[0]["service"].ToString();
                f.lastVPaymentDate = dtx.Rows[0]["valde_date"].ToString();
                f.lastPaidDate     = dtx.Rows[0]["paid_date"].ToString();
                f.lastPaidTime     = dtx.Rows[0]["paid_time"].ToString();

                testf1 = true;
            }

            if (testf1 == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }