public ShowNoteForm(ShowNotesForm form, Form1 f, string o) { InitializeComponent(); ths = form; form1 = f; if (ths.list_text.SelectedIndex > -1) { selectedItem = ths.list_text.SelectedItem.ToString(); textBox1.Text = selectedItem; } userName = f.userName.Text.ToString(); userID = f.userID; option = o; }
private void bunifuFlatButton1_Click(object sender, EventArgs e) { if (userID != -1) { movePanel(btnNotes); ShowNotesForm s = new ShowNotesForm(this); addcontroltopanel(s); } else { PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Personal Dairy Application"; popup.ContentText = "LOGIN FIRST PLZ! "; popup.Image = Properties.Resources.icons8_Error_32px; popup.Popup(); } }
private void pictureBox1_Click_1(object sender, EventArgs e) { if (option.Equals("insert") && !textBox1.Text.Equals("")) { // MessageBox.Show("insert" + userID); int newID = 0; // int useid = 0; string ordb = "Data source=orcl;User Id=scott; Password=tiger;"; OracleConnection conn_2 = new OracleConnection("Data Source=ORCL;User Id=scott;password=tiger;"); conn_2 = new OracleConnection(ordb); conn_2.Open(); OracleCommand c_2 = new OracleCommand(); c_2.Connection = conn_2; c_2.CommandText = "GETNOTID"; c_2.CommandType = CommandType.StoredProcedure; c_2.Parameters.Add("newID", OracleDbType.Int32, ParameterDirection.Output); c_2.ExecuteNonQuery(); try { newID = Convert.ToInt32(c_2.Parameters["newID"].Value.ToString()); newID += 1; } catch { newID = 1; } OracleCommand c = new OracleCommand(); c.Connection = conn_2; c.CommandText = "insert into NOTE(NOTE_ID,TEXT,EDIT_DATE,IMAGE,INSERT_DATE,USERID) values (:note_id_2,:new_text,:date_edite,:image,:insert_date,:userID)"; c.Parameters.Add("note_id_2 ", newID); c.Parameters.Add("new_text", textBox1.Text); c.Parameters.Add("date_edite", System.DateTime.Now); c.Parameters.Add("image", null); c.Parameters.Add("insert_date", System.DateTime.Now); c.Parameters.Add("userID ", userID); int test = c.ExecuteNonQuery(); if (test != -1) { //MessageBox.Show("insert sucecc" + userID); PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Personal Dairy Application"; popup.ContentText = "Note Recorded :)"; popup.Image = Properties.Resources.icons8_Notification_32px; popup.Popup(); form1.bunifuCustomLabel4.Text = (Convert.ToInt32(form1.bunifuCustomLabel4.Text) + 1).ToString(); ShowNotesForm s = new ShowNotesForm(form1); addcontroltopanel(s); } } else if (option.Equals("update") && !textBox1.Text.Equals("")) { //MessageBox.Show("update" + userID); int newID_now = 0; // int useid = 0; string ordb = "Data source=orcl;User Id=scott; Password=tiger;"; OracleConnection conn_4 = new OracleConnection("Data Source=ORCL;User Id=scott;password=tiger;"); conn_4 = new OracleConnection(ordb); conn_4.Open(); OracleCommand c_2 = new OracleCommand(); c_2.Connection = conn_4; c_2.CommandText = "GETIDNOW"; c_2.CommandType = CommandType.StoredProcedure; c_2.Parameters.Add("var", OracleDbType.Int32, ParameterDirection.Output); // c_2.Parameters.Add("text_now", OracleDbType.NVarchar2,ParameterDirection.Input); c_2.Parameters.Add("text_now", selectedItem); // lesa msh bya2raa el node_id c_2.ExecuteNonQuery(); try { newID_now = Convert.ToInt32(c_2.Parameters["var"].Value.ToString()); } catch { newID_now = 1; } ordb = "Data source=orcl;User Id=scott; Password=tiger;"; OracleConnection conn_5 = new OracleConnection("Data Source=ORCL;User Id=scott;password=tiger;"); conn_5 = new OracleConnection(ordb); conn_5.Open(); OracleCommand c_6 = new OracleCommand(); c_6.Connection = conn_5; c_6.CommandText = "update NOTE set TEXT=:new_text , EDIT_DATE=:date_edite,IMAGE=:image where USERID =:userID and NOTE_ID=:note_id "; c_6.Parameters.Add("new_text", textBox1.Text); c_6.Parameters.Add("date_edite", System.DateTime.Now); c_6.Parameters.Add("image", null); //c_6.Parameters.Add("insert_date", null); c_6.Parameters.Add("userID ", userID); c_6.Parameters.Add("note_id ", newID_now); int r = c_6.ExecuteNonQuery(); if (r != -1) { //MessageBox.Show("Text modified"); PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Personal Dairy Application"; popup.ContentText = "Note Modified :)"; popup.Image = Properties.Resources.icons8_Notification_32px; popup.Popup(); ShowNotesForm s = new ShowNotesForm(form1); addcontroltopanel(s); } } else { PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Personal Dairy Application"; popup.ContentText = "Text Empty !!!!! you should write a note or delete it"; popup.Image = Properties.Resources.icons8_Error_32px; popup.Popup(); } }
private void pictureBox2_Click_1(object sender, EventArgs e) { ShowNotesForm s = new ShowNotesForm(form1); addcontroltopanel(s); }
private void bunifuFlatButton2_Click_1(object sender, EventArgs e) { //notification PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Personal Dairy Application"; //if signed true //popup.ContentText = "Welcome, "; //popup.Image = Properties.Resources.icons8_Handshake_Heart_32px_1; //popup.Popup(); //if signed false //movePanel(btnNotes); //ShowNotesForm s = new ShowNotesForm(this); //addcontroltopanel(s); Boolean EMAIL = true; if (textBox5.Text.Equals("") || textBox3.Text.Equals("") || textBox4.Text.Equals("")) { popup.ContentText = "Something wrong, try again and enter all data. "; popup.Image = Properties.Resources.icons8_Error_32px; popup.Popup(); } else if (dateTimePicker1.Value > System.DateTime.Now) { popup.ContentText = "INvalid Birthdate !!!"; popup.Image = Properties.Resources.icons8_Error_32px; popup.Popup(); } else { conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select user_id FROM users where user_email=:email"; cmd.Parameters.Add("email", textBox3.Text.ToString()); cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { EMAIL = false; } dr.Close(); conn.Close(); if (EMAIL != false) { conn.Open(); cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select max(user_id) from users"; cmd.CommandType = CommandType.Text; dr = cmd.ExecuteReader(); if (dr.Read()) { userID = Convert.ToInt32(dr[0]) + 1; } else { userID = 1; } dr.Close(); cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "INSERT INTO users VALUES (:id,:name,:email,:pass,:bdate)"; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("id", userID); cmd.Parameters.Add("name", textBox5.Text); cmd.Parameters.Add("email", textBox3.Text); cmd.Parameters.Add("pass", textBox4.Text); cmd.Parameters.Add("bdate", Convert.ToDateTime(dateTimePicker1.Value)); int err = cmd.ExecuteNonQuery(); if (err != -1) { cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select count(note_id) from note where userid=" + userID; cmd.CommandType = CommandType.Text; dr = cmd.ExecuteReader(); if (dr.Read()) { bunifuCustomLabel4.Text = dr[0].ToString(); } else { bunifuCustomLabel4.Text = 0.ToString(); } dr.Close(); cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select count(bn_id) from bussines_note where userid=" + userID; cmd.CommandType = CommandType.Text; dr = cmd.ExecuteReader(); if (dr.Read()) { bunifuCustomLabel5.Text = dr[0].ToString(); } else { bunifuCustomLabel5.Text = 0.ToString(); } dr.Close(); cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select count(rem_id) from reminder where userid=" + userID; cmd.CommandType = CommandType.Text; dr = cmd.ExecuteReader(); if (dr.Read()) { bunifuCustomLabel7.Text = dr[0].ToString(); } else { bunifuCustomLabel7.Text = 0.ToString(); } dr.Close(); conn.Close(); movePanel(btnNotes); ShowNotesForm s = new ShowNotesForm(this); addcontroltopanel(s); userName.Text = textBox5.Text.ToString(); popup.ContentText = "Welcome, " + textBox5.Text.ToString(); popup.Image = Properties.Resources.icons8_Handshake_Heart_32px_1; popup.Popup(); textBox5.Text = ""; textBox3.Text = ""; textBox4.Text = ""; dateTimePicker1.Value = System.DateTime.Now; } conn.Close(); } else { popup.ContentText = "EMAIL already exist !!"; popup.Image = Properties.Resources.icons8_Error_32px; popup.Popup(); } } }
private void bunifuFlatButton3_Click_2(object sender, EventArgs e) { //notification //if signed true PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Personal Dairy Application"; Boolean EMAIL = true, PASS = true; conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select user_id FROM users where user_email=:email"; cmd.Parameters.Add("email", textBox1.Text.ToString()); cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { userID = Convert.ToInt32(dr[0]); } else { EMAIL = false; } dr.Close(); conn.Close(); if (EMAIL == true) { string name = ""; conn.Open(); cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select user_email,user_pass,user_name from users where user_id=" + userID; cmd.CommandType = CommandType.Text; dr = cmd.ExecuteReader(); if (dr.Read()) { if (!textBox2.Text.Equals(dr[1].ToString())) { PASS = false; } else { name = dr[2].ToString(); } } dr.Close(); if (PASS == true) { cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select count(note_id) from note where userid=" + userID; cmd.CommandType = CommandType.Text; dr = cmd.ExecuteReader(); if (dr.Read()) { bunifuCustomLabel4.Text = dr[0].ToString(); } dr.Close(); cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select count(bn_id) from bussines_note where userid=" + userID; cmd.CommandType = CommandType.Text; dr = cmd.ExecuteReader(); if (dr.Read()) { bunifuCustomLabel5.Text = dr[0].ToString(); } dr.Close(); cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select count(rem_id) from reminder where userid=" + userID; cmd.CommandType = CommandType.Text; dr = cmd.ExecuteReader(); if (dr.Read()) { bunifuCustomLabel7.Text = dr[0].ToString(); } dr.Close(); conn.Close(); movePanel(btnNotes); ShowNotesForm s = new ShowNotesForm(this); addcontroltopanel(s); userName.Text = name.ToString(); popup.ContentText = "Welcome, " + name; popup.Image = Properties.Resources.icons8_Handshake_Heart_32px_1; popup.Popup(); textBox1.Text = ""; textBox2.Text = ""; } else { popup.ContentText = "Password incorrect, try agian if you already have a mail if not sign up. "; popup.Image = Properties.Resources.icons8_Error_32px; popup.Popup(); } } else { popup.ContentText = "Email incorrect, try agian if you already have a mail if not sign up. "; popup.Image = Properties.Resources.icons8_Error_32px; popup.Popup(); } conn.Close(); }