private void TeacherEntrance_Click(object sender, EventArgs e) { string pasword = null; int userType = 0; connection.Open(); sql = "SELECT UserType,UserId,Pasword FROM LearnMath.dbo.[User] where UserId= '" + UserName.Text + "' and Pasword= '" + Password.Text + "' and UserType= '0'"; // sql = "SELECT UserId,Password FROM ILMApp.dbo.LearnMath"; command = new SqlCommand(sql, connection); SqlDataAdapter da = new SqlDataAdapter(command); dataReader = command.ExecuteReader(); //while (dataReader.Read()) //{ // userType = (int)dataReader.GetValue(0); //} if (!(dataReader.HasRows) || userType != 0) { MessageBox.Show("שם משתמש או סיסמא אינם נכונים"); } else { int i = 1; this.Hide(); MenegerAndTeacherForm T1 = new MenegerAndTeacherForm(i); T1.ShowDialog(); } connection.Close(); }
private void button1_Click(object sender, EventArgs e) { this.Hide(); MenegerAndTeacherForm m = new MenegerAndTeacherForm(); m.Show(); }
// update game settings private void button2_Click(object sender, EventArgs e) { int level = 0; int markSize = 0; string background = null; string GameName = null; if (!(comboBox1.Items.Contains("some value"))) { try { GameName = comboBox1.SelectedItem.ToString(); } catch { } int GmameIndex = 0; switch (GameName) { case "הכרת ספרות": GmameIndex = 1; break; case "מנייה": GmameIndex = 2; break; case "התאמת ספרות לכמות": GmameIndex = 3; break; case "רצף מספרים": GmameIndex = 4; break; case "משחק הזיכרון": GmameIndex = 5; break; case "חיבור וחיסור": GmameIndex = 6; break; default: GmameIndex = 0; break; } if (SmallMouse.Checked) { markSize = 0; } else { markSize = 1; } if (MultiCollor.Checked) { background = "MultiCollor"; } else { background = "blackBackground"; } level = (int)(numericUpDown1.Value); if (GmameIndex == 0) { MessageBox.Show("בחר משחק"); } else { CountNumGames++; connection.Open(); sql = "INSERT INTO [StudentPlay](PlayGameCode,GameCode,Level,UserId,MarkSize,background) VALUES('" + CountNumGames + "','" + GmameIndex + "', '" + level + "','" + UserID + "','" + markSize + "','" + background + "')"; command = new SqlCommand(sql, connection); SqlDataAdapter da = new SqlDataAdapter(command); command.ExecuteNonQuery(); connection.Close(); MessageBox.Show("פרטי משחק נשמרו"); connection.Close(); this.Hide(); MenegerAndTeacherForm mf = new MenegerAndTeacherForm(); mf.Show(); } } else { MessageBox.Show("בחר משחק"); } }