Ejemplo n.º 1
0
        public Lechallsc SearchLecHalls(string Lechallcode)
        {
            cmd.CommandText = "SELECT * FROM lechalls WHERE lechallcode=@lhc";
            try
            {
                cmd.Parameters.AddWithValue("lhc", Lechallcode);
                con.Open();

                SqlDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    Lechallsc u = new Lechallsc();
                    while (reader.Read())
                    {
                        u.Lechallcode = reader["lechallcode"].ToString();
                        u.Numstu      = reader["numstu"].ToString();
                    }

                    return(u);
                }
                return(null);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(null);
            }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 2
0
        public List <Lechallsc> GetComLecHalls()
        {
            List <Lechallsc> studetails = new List <Lechallsc>();

            try
            {
                cmd.CommandText = "SELECT id AS 'Explorer',lechallcode AS 'Hall Code',numstu AS 'Stu Number' FROM lechalls WHERE fac='Business'";
                cmd.CommandType = CommandType.Text;

                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Lechallsc lecgv = new Lechallsc()
                    {
                        Id          = reader[0].ToString(),
                        Lechallcode = reader[1].ToString(),
                        Numstu      = reader[2].ToString(),
                    };
                    studetails.Add(lecgv);
                }
                return(studetails);
            }
            catch (Exception) { throw; }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
Ejemplo n.º 3
0
        // Lec Halls

        public int AddLecHalls(Lechallsc lhd)
        {
            try
            {
                cmd.CommandText = "INSERT INTO lechalls(lechallcode,numstu,fac) VALUES (@lhc,@ns,'Business')";
                cmd.Parameters.AddWithValue("lhc", lhd.Lechallcode);
                cmd.Parameters.AddWithValue("ns", lhd.Numstu);

                con.Open();
                cmd.CommandType = CommandType.Text;
                return(cmd.ExecuteNonQuery());
            }
            catch (Exception) { throw; }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 4
0
 public int UpdateComlecHalls(Lechallsc clhu)
 {
     try
     {
         cmd.CommandText = "UPDATE lechalls set lechallcode=@lhc, numstu=@ns, fac='Business' WHERE lechallcode=@lhc";
         cmd.Parameters.AddWithValue("lhc", clhu.Lechallcode);
         cmd.Parameters.AddWithValue("ns", clhu.Numstu);
         con.Open();
         return(cmd.ExecuteNonQuery());
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         if (con != null)
         {
             con.Close();
         }
     }
 }
Ejemplo n.º 5
0
        public int DeleteComLecHalls(Lechallsc clhdel)
        {
            try
            {
                cmd.CommandText = "DELETE lechalls WHERE lechallcode=@lhc";
                cmd.Parameters.AddWithValue("lhc", clhdel.Lechallcode);
                cmd.CommandType = CommandType.Text;
                con.Open();

                return(cmd.ExecuteNonQuery());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }