private void btn_logIn_Click(object sender, EventArgs e) { if (txt_box_login_userid.Text == "" || txt_box_login_password.Text == "") { MessageBox.Show("Please enter the value"); txt_box_login_userid.Text = ""; txt_box_login_password.Text = ""; Form1.Instance.PnlContainer.Controls["login"].BringToFront(); } else { string id = txt_box_login_userid.Text; string password = txt_box_login_password.Text; string query = "SELECT * FROM USER_INFO WHERE USER_ID = '" + id + "' AND PASSWORD = '******'"; dbobj.readDatathroughAdapter(query, dtUsers); if (dtUsers.Rows.Count == 1) { dbobj.closeConn(); string result = txt_box_login_userid.Text.Substring(0, 1); if (result == "a") { if (!Form1.Instance.PnlContainer.Controls.ContainsKey("admin_panel")) { admin_panel ap = new admin_panel(); ap.Dock = DockStyle.Fill; Form1.Instance.PnlContainer.Controls.Add(ap); } Form1.Instance.PnlContainer.Controls["admin_panel"].BringToFront(); } else if (result == "p") { if (!Form1.Instance.PnlContainer.Controls.ContainsKey("patient_panel")) { patient_panel pp = new patient_panel(); pp.Dock = DockStyle.Fill; Form1.Instance.PnlContainer.Controls.Add(pp); } Form1.Instance.PnlContainer.Controls["patient_panel"].BringToFront(); } else if (result == "d") { if (!Form1.Instance.PnlContainer.Controls.ContainsKey("doctor_panel")) { doctor_panel dp = new doctor_panel(); dp.Dock = DockStyle.Fill; Form1.Instance.PnlContainer.Controls.Add(dp); } Form1.Instance.PnlContainer.Controls["doctor_panel"].BringToFront(); } } else { MessageBox.Show("Please, Enter Valid Information"); } } }
private void btn_signup_Click(object sender, EventArgs e) { string user_id = txt_box_userid.Text; string name = txt_box_name.Text; string password = txt_box_password.Text; string phone = txt_box_phone.Text; string address = txt_box_address.Text; if (user_id == "" || name == "" || password == "" || phone == "" || address == "") { MessageBox.Show("Please Enter All The Informations"); } else { string result = txt_box_userid.Text.Substring(0, 1); if (result == "p") { string query = "INSERT INTO USER_INFO(USER_ID,NAME,PASSWORD,PHONE,ADDRESS) VALUES (@user_id,@name,@password,@phone,@address)"; SqlCommand insertCommand = new SqlCommand(query); insertCommand.Parameters.AddWithValue("@user_id", user_id); insertCommand.Parameters.AddWithValue("@name", name); insertCommand.Parameters.AddWithValue("@password", password); insertCommand.Parameters.AddWithValue("@phone", phone); insertCommand.Parameters.AddWithValue("@address", address); int success = dbobj.executeQuery(insertCommand); if (success == 1) { login.genUserId = user_id; MessageBox.Show("SignUp Successful"); if (!Form1.Instance.PnlContainer.Controls.ContainsKey("patient_panel")) { patient_panel pp = new patient_panel(); pp.Dock = DockStyle.Fill; Form1.Instance.PnlContainer.Controls.Add(pp); } Form1.Instance.PnlContainer.Controls["patient_panel"].BringToFront(); } else { MessageBox.Show("Fail inserted"); txt_box_userid.Text = ""; txt_box_name.Text = ""; txt_box_password.Text = ""; txt_box_phone.Text = ""; txt_box_address.Text = ""; Form1.Instance.PnlContainer.Controls["signup"].BringToFront(); } } else { MessageBox.Show("Please Enter Informations As Directed"); txt_box_userid.Text = ""; txt_box_name.Text = ""; txt_box_password.Text = ""; txt_box_phone.Text = ""; txt_box_address.Text = ""; Form1.Instance.PnlContainer.Controls["signup"].BringToFront(); } } }
public void load() { _obj4 = this; patient_panel_home p_p_h = new patient_panel_home(); p_p_h.Dock = DockStyle.Fill; patient_panel_right_side.Controls.Add(p_p_h); patient_panel_right_side.Controls["patient_panel_home"].BringToFront(); }
private void patient_panel_Load(object sender, EventArgs e) { _obj4 = this; patient_panel_home p_p_h = new patient_panel_home(); p_p_h.Dock = DockStyle.Fill; patient_panel_right_side.Controls.Add(p_p_h); patient_panel_right_side.Controls["patient_panel_home"].BringToFront(); }