Last post Aug 24, 2017 08:33 PM by Gilbert Gayv
Aug 22, 2017 09:12 PM|Gilbert Gayv|LINK
I've received the task of mapping the science lab where I study. My teacher already have a way to store the information of all the users in a mysql table, information regarding if the user is connected, away or disconnected, among other things. My problem
here is that I don't know exactly what kind of technology I should use to show each of this user in the map. I'm currently trying to build the map using buttons to simulate the room, though, I don't know if there is an easier way to do it.
protected void Page_Load(object sender, EventArgs e)
foreach (Button b in this.Controls.OfType<Button>())
string MyConString ="SERVER=000.000.000.00;" + "DB=fakedb;" + "User=fakeuser;" + "Password=fakepass;";
SqlConnection con = new SqlConnection(MyConString);
SqlCommand command = con.CreateCommand();
string str = "Select Status from Ustatus where Username = @user";
command = new SqlCommand(str, con);
command.CommandType = System.Data.CommandType.Text;
object obj = command.ExecuteScalar();
string statuser = obj.ToString();
if (statuser == "ONLINE")
b.ForeColor = Color.Green;
b.BackColor = Color.Green;
else if (statuser == "OFFLINE")
b.ForeColor = Color.Red;
b.BackColor = Color.Red;
b.ForeColor = Color.Yellow;
b.BackColor = Color.Yellow;
Thank you in advance but your help
Aug 22, 2017 11:46 PM|jzero|LINK
I think best would be a drawing with tables, seats and computers or a simple draw with such representation.
To do something look for drawing shapes, but have in mind you will have to work with coordinates (x,y), sizes (w,h), etc.
Aug 23, 2017 07:09 AM|Eric Du|LINK
Hi Gilbert Gayv,
According to your description, as far as I know, you want to fix the multiple buttons position(one button represent one student) in the page, then loop the all buttons in page load event, to check the student state, then show the respond state of the student
in the button.
I think this way is good way to achieve this goal. If you don't want to fix the student position, I think you could use datacontrol like repeater to dynamically add them then show the statue.
Here are some tutorials for you to refer, please to check:
Screen Layout Designing in a Movie Theater using GridView:
Online Ticket Booking System using ASP.NET:
Aug 24, 2017 08:33 PM|Gilbert Gayv|LINK
Thank you, the examples give me a better idea of what I was doing and how to do it.