public bool delete(A_register_class c)
        {
            bool isSuccess = false;

            SqlConnection conn = new SqlConnection(myconnstring);

            try
            {
                string sql = "DELETE FROM Register WHERE ID = @ContactId";

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@ContactId", c.ContactId);

                conn.Open();
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                Console.WriteLine(msg);
            }
            finally
            {
            }
            return(isSuccess);
        }
        public bool update(A_register_class c)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstring);

            try
            {
                string sql = "UPDATE Register SET First_Name = @FirstName, Last_Name = @LastName, Email = @Email, Course = @Course, Phone_Number = @Phone, Address = @Address, Gender = @Gender WHERE ID = @ContactId";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@FirstName", c.FirstName);
                cmd.Parameters.AddWithValue("@LastName", c.LastName);
                cmd.Parameters.AddWithValue("@Email", c.Email);
                cmd.Parameters.AddWithValue("@Course", c.Course);
                cmd.Parameters.AddWithValue("@Phone", c.Phone);
                cmd.Parameters.AddWithValue("@Address", c.Address);
                cmd.Parameters.AddWithValue("@Gender", c.Gender);
                cmd.Parameters.AddWithValue("@ContactId", c.ContactId);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                Console.WriteLine(msg);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
        public bool Insert2(A_register_class c)
        {
            //Default return type
            bool isSuccess = false;

            //connect DataBase
            SqlConnection conn = new SqlConnection(myconnstring);

            try
            {
                //sql Query
                string     sql = "INSERT INTO staff_db (First_Name, Last_Name, Email, Course, Phone_Number, Address, Gender) VALUES (@FirstName, @LastName, @Email, @Course, @Phone, @Address, @Gender)";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@FirstName", c.FirstName);
                cmd.Parameters.AddWithValue("@LastName", c.LastName);
                cmd.Parameters.AddWithValue("@Email", c.Email);
                cmd.Parameters.AddWithValue("@Course", c.Course);
                cmd.Parameters.AddWithValue("@Phone", c.Phone);
                cmd.Parameters.AddWithValue("@Address", c.Address);
                cmd.Parameters.AddWithValue("@Gender", c.Gender);

                conn.Open();
                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                Console.WriteLine(msg);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
        public bool Insert3(A_register_class c)
        {
            //Default return type
            bool isSuccess = false;

            //connect DataBase
            SqlConnection conn = new SqlConnection(myconnstring2);

            try
            {
                //sql Query
                string     sql = "INSERT INTO attendance_db (Reg_No, Class, Faculty) VALUES (@RegNum, @Class2, @Faculty)";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@RegNum", c.RegNum);
                cmd.Parameters.AddWithValue("@Class2", c.Class2);
                cmd.Parameters.AddWithValue("@Faculty", c.Faculty);

                conn.Open();
                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                Console.WriteLine(msg);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }