示例#1
0
        public Canteen UpItem(int Canteen_MGR)
        {
            string        q   = "Select * from Canteen Where Canteen_MGR =" + Canteen_MGR;
            SqlCommand    sc  = new SqlCommand(q, Connection.get());
            SqlDataReader sdr = sc.ExecuteReader();
            Canteen       u   = new Canteen();

            while (sdr.Read())
            {
                u.Canteen_MGR      = (int)sdr["Canteen_MGR"];
                u.Canteen_Expenses = (int)sdr["Canteen_Expenses"];
                u.Time_O           = (string)sdr["Time_O"];
                u.Time_C           = (string)sdr["Time_C"];
            }
            sdr.Close();
            return(u);
        }
示例#2
0
        public List <Canteen> ShowAll()
        {
            string         q   = "Select * from Canteen";
            SqlCommand     sc  = new SqlCommand(q, Connection.get());
            SqlDataReader  sdr = sc.ExecuteReader();
            List <Canteen> lst = new List <Canteen>();

            while (sdr.Read())
            {
                Canteen u = new Canteen();
                u.Canteen_MGR      = (int)sdr["Canteen_MGR"];
                u.Canteen_Expenses = (int)sdr["Canteen_Expenses"];
                u.Time_O           = (string)sdr["Time_O"];
                u.Time_C           = (string)sdr["Time_C"];
                lst.Add(u);
            }
            sdr.Close();
            return(lst);
        }