Пример #1
0
        //[List codes]Recent
        public List <DonatorsPage> GetAllRecent()
        {
            List <DonatorsPage> list = new List <DonatorsPage>();

            dal.Open();
            dal.SetSql("select Users.UserID, Monetaries.MonetaryID, Users.FirstName, Users.LastName, Monetaries.Amount, Monetaries.Date, Monetaries.Validate from Users inner join Monetaries on Users.UserID=Monetaries.UserID order by Monetaries.Date desc");
            SqlDataReader dr = dal.GetReader();

            while (dr.Read() == true)
            {
                DonatorsPage dn = new DonatorsPage();
                dn.UserID     = (int)dr["UserID"];
                dn.MonetaryID = (int)dr["MonetaryID"];
                dn.FirstName  = dr["FirstName"].ToString();
                dn.LastName   = dr["LastName"].ToString();
                dn.Amount     = (decimal)dr["Amount"];
                dn.Date       = (DateTime)dr["Date"];
                dn.Validate   = (bool)dr["Validate"];

                list.Add(dn);
            }
            dr.Close();
            dal.Close();

            return(list);
        }
Пример #2
0
        //[Edit codes]Edit Amount and Validation
        public DonatorsPage GetMonetary(int mID)
        {
            DonatorsPage dn = new DonatorsPage();

            dal.Open();
            dal.SetSql("SELECT Monetaries.MonetaryID, Monetaries.Amount, Monetaries.Validate FROM Monetaries WHERE Monetaries.MonetaryID = @mID");
            dal.AddParameter("@mID", mID);
            SqlDataReader dr = dal.GetReader();

            if (dr.Read() == true)
            {
                dn.MonetaryID = (int)dr["MonetaryID"];
                dn.Amount     = (decimal)dr["Amount"];
                dn.Validate   = (bool)dr["Validate"];
            }
            dr.Close();
            dal.Close();

            return(dn);
        }
Пример #3
0
        //Edit codes

        //[Edit codes]Edit First and Last Names
        public DonatorsPage Get(int uID)
        {
            DonatorsPage dn = new DonatorsPage();

            dal.Open();
            dal.SetSql("SELECT Users.UserID, Users.FirstName, Users.LastName FROM Users WHERE Users.UserID = @uID");
            dal.AddParameter("@uID", uID);
            SqlDataReader dr = dal.GetReader();

            if (dr.Read() == true)
            {
                dn.UserID    = (int)dr["UserID"];
                dn.FirstName = dr["FirstName"].ToString();
                dn.LastName  = dr["LastName"].ToString();
            }
            dr.Close();
            dal.Close();

            return(dn);
        }