private void return_btn_Click(object sender, EventArgs e) { TeacherCalander n = new TeacherCalander(); n.Show(); this.Hide(); }
private void button2_Click(object sender, EventArgs e) { // StreamReader per = new StreamReader("permissionFile.txt"); //reads the permission from permission file. // string permission = per.ReadLine(); //now we will check the permission if (log_in_page.permission == "manager") //according to that, we wil be able to determine { //wich screed to go back to. ManagerCalander managerCalander = new ManagerCalander(); managerCalander.Show(); Visible = false; } else if (log_in_page.permission == "teacher") { TeacherCalander teacherCalander = new TeacherCalander(); teacherCalander.Show(); Visible = false; } else if (log_in_page.permission == "student") { StudentCalander frmCal = new StudentCalander(); frmCal.Show(); Visible = false; } //per.Close(); }
private void button2_Click(object sender, EventArgs e) { TeacherCalander frmCal = new TeacherCalander(); frmCal.Show(); Visible = false; }
private void return_btn_Click(object sender, EventArgs e) { User user = new User(); user = user.GetUser(log_in_page.userId); if (user.getPermission().ToLower() == "manager") { ManagerCalander n = new ManagerCalander(); n.Show(); this.Hide(); } else if (user.getPermission().ToLower() == "teacher") { TeacherCalander n = new TeacherCalander(); n.Show(); this.Hide(); } }
private void button2_Click(object sender, EventArgs e) { if (log_in_page.permission.ToLower() == "manager") { ManagerCalander n = new ManagerCalander(); n.Show(); this.Hide(); } else if (log_in_page.permission.ToLower() == "teacher") { TeacherCalander n = new TeacherCalander(); n.Show(); this.Hide(); } else { StudentCalander n = new StudentCalander(); n.Show(); this.Hide(); } }
private void return_btn_Click(object sender, EventArgs e) { if (log_in_page.permission == "manager") { ManagerCalander managerCalander = new ManagerCalander(); managerCalander.Show(); Visible = false; } else if (log_in_page.permission == "teacher") { TeacherCalander teacherCalander = new TeacherCalander(); teacherCalander.Show(); Visible = false; } else if (log_in_page.permission == "student") { StudentCalander frmCal = new StudentCalander(); frmCal.Show(); Visible = false; } }
private void SendCompletedCallBack(object sender, AsyncCompletedEventArgs e) { if (e.Cancelled) { MessageBox.Show(string.Format("{0} send canceled.", e.UserState), "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (e.Error != null) { MessageBox.Show(string.Format("{0} {1}", e.UserState, e.Error), "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { progressBar1.Value = 100; if (progressBar1.Value == 100) { MessageBox.Show("Your message has been succssfully sent", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } ; TeacherCalander frmCal = new TeacherCalander(); frmCal.Show(); Visible = false; } }
private void create_btn_Click(object sender, EventArgs e) { if (title_txt.Text == "") { MessageBox.Show("please fill the title"); } else if (place_txt.Text == "") { MessageBox.Show("please fill the place"); } else if (hours_start.Value > hours_end.Value) { MessageBox.Show("your start hours is later than your end hours."); } else if (hours_start.Value == hours_end.Value && minutes_start.Value >= minutes_end.Value) { MessageBox.Show("your start hour is later or equal to your end hour."); } else if (send_to_lst.Items.Count == 0) { MessageBox.Show("there are no student to invite."); } else { string help; dataBase dataBase = new dataBase(); SqlConnection conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); //SqlCommand cmd = new SqlCommand("INSERT INTO Events(Event_name,event_kind,date,hours_start,minutes_start,hours_end,minutes_end,Event_details,event_place,up_for_cancellation) VALUES(@Event_name,@event_kind,@date,@hours_start,@minutes_start,@hours_end,@minutes_end,@Event_details,@Place,@up_for_cancellation) ", conn); SqlCommand cmd = new SqlCommand("INSERT INTO Events(Event_name,event_kind,up_for_cancellation) VALUES(@Event_name,@event_kind,@up_for_cancellation) ", conn); cmd.Parameters.Add("@up_for_cancellation", "YES"); cmd.Parameters.Add("@event_kind", "Muliplayer"); help = title_txt.Text; help = help.Replace("'", string.Empty); cmd.Parameters.Add("@Event_name", help); cmd.ExecuteNonQuery(); //cmd.ExecuteNonQuery(); //take the max id event from Event table string query = "Select MAX(Event_id) from Events"; SqlDataAdapter sda = new SqlDataAdapter(query, conn); DataTable dtb = new DataTable(); sda.Fill(dtb); string event_id = ""; if (dtb.Rows.Count > 0) { event_id = dtb.Rows[0][0].ToString().Trim(); } int event_Id = Int32.Parse(event_id); help = place_txt.Text; help = help.Replace("'", string.Empty); SqlCommand cmd0 = new SqlCommand("UPDATE Events SET event_place ='" + help + "' WHERE Event_id ='" + event_id + "'", conn); cmd0.ExecuteNonQuery(); SqlCommand cmd1 = new SqlCommand("UPDATE Events SET event_privacy ='public' WHERE Event_id ='" + event_id + "'", conn); cmd1.ExecuteNonQuery(); help = details_txt.Text; help = help.Replace("'", string.Empty); SqlCommand cmd2 = new SqlCommand("UPDATE Events SET Event_details ='" + help + "'WHERE Event_id ='" + event_id + "'", conn); cmd2.ExecuteNonQuery(); SqlCommand cmd3 = new SqlCommand("UPDATE Events SET date ='" + date_pkr.Text + "'WHERE Event_id ='" + event_id + "'", conn); cmd3.ExecuteNonQuery(); SqlCommand cmd4 = new SqlCommand("UPDATE Events SET hours_start ='" + hours_start.Text + "'WHERE Event_id ='" + event_id + "'", conn); cmd4.ExecuteNonQuery(); SqlCommand cmd5 = new SqlCommand("UPDATE Events SET minutes_start ='" + minutes_start.Text + "'WHERE Event_id ='" + event_id + "'", conn); cmd5.ExecuteNonQuery(); SqlCommand cmd6 = new SqlCommand("UPDATE Events SET hours_end ='" + hours_end.Text + "'WHERE Event_id ='" + event_id + "'", conn); cmd6.ExecuteNonQuery(); SqlCommand cmd7 = new SqlCommand("UPDATE Events SET minutes_end ='" + minutes_end.Text + "'WHERE Event_id ='" + event_id + "'", conn); cmd7.ExecuteNonQuery(); for (int i = 0; i < send_to_lst.Items.Count; i++) { string username = send_to_lst.Items[i].ToString().Replace(" ", ""); string queryTogetStudentID = "Select id from connection_details Where userName = '******'"; SqlDataAdapter sda6 = new SqlDataAdapter(queryTogetStudentID, conn); DataTable dtb6 = new DataTable(); sda6.Fill(dtb6); string sendToId = dtb6.Rows[0][0].ToString().Trim(); cmd = new SqlCommand("INSERT INTO Events_to_Users(Event_ID,User_ID) VALUES(@Event_ID,@User_ID) ", conn); cmd.Parameters.Add("@Event_ID", event_Id); cmd.Parameters.Add("@User_ID", sendToId); cmd.ExecuteNonQuery(); //MessageBox.Show("Your Event has added for: " + username); } cmd = new SqlCommand("INSERT INTO Events_to_Users(Event_ID,User_ID) VALUES(@Event_ID,@User_ID) ", conn); cmd.Parameters.Add("@Event_ID", event_Id); cmd.Parameters.Add("@User_ID", log_in_page.userId); cmd.ExecuteNonQuery(); MessageBox.Show("Your Event has added."); TeacherCalander n = new TeacherCalander(); n.Show(); this.Hide(); } }
private void button1_Click(object sender, EventArgs e) { string HobiesForReplacing = hobies_txt.Text; HobiesForReplacing = HobiesForReplacing.Replace("'", string.Empty); string FreeTextForReplacing = freetext_txt.Text; FreeTextForReplacing = FreeTextForReplacing.Replace("'", string.Empty); string AddressForReplace = address_txt.Text; AddressForReplace = AddressForReplace.Replace("'", string.Empty); string PhoneForReplace = phone_txt.Text; PhoneForReplace = PhoneForReplace.Replace("'", string.Empty); string EmailForReplace = Email_1st.Text; EmailForReplace = EmailForReplace.Replace("'", string.Empty); string PEmailForReplace = PEmail_txt.Text; PEmailForReplace = PEmailForReplace.Replace("'", string.Empty); string PasswordForReplace = pass_txt.Text; PasswordForReplace = PasswordForReplace.Replace("'", string.Empty); CheckDetails check = new CheckDetails(); if (pass_txt.Text == userId) { MessageBox.Show("Your password is the same as before, please update it."); } else if (pass_txt.Text == "") { MessageBox.Show("Please update your password."); } else if (pass_txt.Text != confirm_pass_txt.Text) { MessageBox.Show("Passwords do not match."); } else if (!check.CheckEmail(Email_1st.Text)) { MessageBox.Show("Email is not valid!"); } else if (Email_1st.Text != Email_2nd.Text) { MessageBox.Show("Emails do not match."); } else if (phone_txt.Text == "") { MessageBox.Show("Please update your phone number."); } else if (!check.Check_onlyNums(phone_txt.Text) || phone_txt.Text.Length != 10) { MessageBox.Show("Invalid phone number."); } else if (!check.CheckEmail(PEmail_txt.Text) && log_in_page.permission == "student") { MessageBox.Show("Parent Email is not valid!"); } else if (PEmail_txt.Text != confirm_PEmail_txt.Text) { MessageBox.Show("Parent Emails do not match."); } else if (PEmail_txt.Text == Email_1st.Text) { MessageBox.Show("Parent Email is the same as yours."); } else if (yearCB.SelectedIndex == -1 && log_in_page.permission == "student") { MessageBox.Show("Please fill year."); } else if (classCB.SelectedIndex == -1 && log_in_page.permission == "student") { MessageBox.Show("Please fill class."); } else { try { dataBase dataBase = new dataBase(); SqlConnection conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd1 = new SqlCommand("UPDATE users SET phoneNumber ='" + PhoneForReplace + "' WHERE id ='" + userId + "'", conn); cmd1.ExecuteNonQuery(); conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd2 = new SqlCommand("UPDATE users SET Email ='" + EmailForReplace + "' WHERE id ='" + userId + "'", conn); cmd2.ExecuteNonQuery(); if (log_in_page.permission == "student") { conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd3 = new SqlCommand("UPDATE users SET ParentEmail ='" + PEmailForReplace + "' WHERE id ='" + userId + "'", conn); cmd3.ExecuteNonQuery(); conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd4 = new SqlCommand("UPDATE users SET grade ='" + yearCB.Items[yearCB.SelectedIndex].ToString() + "' WHERE id ='" + userId + "'", conn); cmd4.ExecuteNonQuery(); conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd5 = new SqlCommand("UPDATE users SET classNumber ='" + classCB.Items[classCB.SelectedIndex].ToString() + "' WHERE id ='" + userId + "'", conn); cmd5.ExecuteNonQuery(); } conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd6 = new SqlCommand("UPDATE users SET address ='" + AddressForReplace + "' WHERE id ='" + userId + "'", conn); cmd6.ExecuteNonQuery(); conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd7 = new SqlCommand("UPDATE users SET birthDate ='" + birthdate_pckr.Text + "' WHERE id ='" + userId + "'", conn); cmd7.ExecuteNonQuery(); conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd8 = new SqlCommand("UPDATE users SET freeTxt ='" + FreeTextForReplacing + "' WHERE id ='" + userId + "'", conn); cmd8.ExecuteNonQuery(); conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd9 = new SqlCommand("UPDATE users SET hobies ='" + HobiesForReplacing + "' WHERE id ='" + userId + "'", conn); cmd9.ExecuteNonQuery(); conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); SqlCommand cmd10 = new SqlCommand("UPDATE connection_details SET password ='******' WHERE id ='" + userId + "'", conn); cmd10.ExecuteNonQuery(); /* adding the image - dont ask*/ if (imgLocation != "") { byte[] images = null; FileStream stream = new FileStream(imgLocation, FileMode.Open, FileAccess.Read); BinaryReader brs = new BinaryReader(stream); images = brs.ReadBytes((int)stream.Length); conn = dataBase.connect_to_scheduluz_DB(); conn.Open(); string sqlQuery = "UPDATE users SET picture =@images WHERE id ='" + userId + "'"; cmd = new SqlCommand(sqlQuery, conn); cmd.Parameters.Add(new SqlParameter("@images", images)); int N = cmd.ExecuteNonQuery(); } MessageBox.Show("Your Details has been updated." + userId); if (per == "manager") { ManagerCalander managerCalander = new ManagerCalander(); managerCalander.Show(); Visible = false; } else if (per == "teacher") { TeacherCalander teacherCalander = new TeacherCalander(); teacherCalander.Show(); Visible = false; } else { StudentCalander frmCal = new StudentCalander(); frmCal.Show(); Visible = false; } } catch { MessageBox.Show("Problem detected. please contact your Scheduluz Guide for more information."); } } }