private void BtnChangePassword_Click(object sender, EventArgs e)
 {
     if (TxtGrade.Text == "" || TxtStrand.Text == "" || TxtTrack.Text == "")
     {
         NotificationFillBlank a = new NotificationFillBlank();
         a.ShowDialog();
     }
     else
     {
         try
         {
             GetAccountInfo();
             UpdateAccount();
             con.Open();
             String       query = "update voters set grade = @grade, track = @track, strand = @strand where account_id = @id";
             MySqlCommand cmd   = new MySqlCommand(query, con);
             cmd.Parameters.AddWithValue("@id", user_id);
             cmd.Parameters.AddWithValue("@grade", TxtGrade.Text);
             cmd.Parameters.AddWithValue("@track", TxtTrack.Text);
             cmd.Parameters.AddWithValue("@strand", TxtStrand.Text);
             cmd.ExecuteNonQuery();
             con.Close();
             LogHistoryEdit(GlobalVar.user_id, GlobalVar.user_type, GlobalVar.user);
             CloseTransparent();
             NotificationEditSuccess a = new NotificationEditSuccess();
             a.ShowDialog();
         }
         catch
         {
             NotificationConnectionError a = new NotificationConnectionError();
             a.ShowDialog();
         }
     }
 }
 private void BtnEditTeacher_Click(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         MemoryStream ms = new MemoryStream();
         StudentPicture.Image.Save(ms, StudentPicture.Image.RawFormat);
         byte[] a = ms.GetBuffer();
         ms.Close();
         String       query = "update candidate set img = @img, gender = @gender, age = @age, grade = @grade, track = @track, strand = @strand, partylist = @partylist, position = @position, platform = @platform where candidate_id = @id";
         MySqlCommand cmd   = new MySqlCommand(query, con);
         cmd.Parameters.AddWithValue("@id", lblcandidateid.Text);
         cmd.Parameters.Add("@img", MySqlDbType.LongBlob).Value = a;
         if (GenderFemaleCheckBox.Checked)
         {
             cmd.Parameters.AddWithValue("@gender", "Female");
         }
         else if (GenderMaleCheckBox.Checked)
         {
             cmd.Parameters.AddWithValue("@gender", "Male");
         }
         cmd.Parameters.AddWithValue("@age", TxtAge.Text);
         cmd.Parameters.AddWithValue("@grade", TxtGrade.Text);
         cmd.Parameters.AddWithValue("@track", TxtTrack.Text);
         cmd.Parameters.AddWithValue("@strand", TxtStrand.Text);
         cmd.Parameters.AddWithValue("@partylist", TxtPartylist.Text);
         cmd.Parameters.AddWithValue("@position", TxtPosition.Text);
         cmd.Parameters.AddWithValue("@platform", TxtPlatform.Text);
         cmd.ExecuteNonQuery();
         con.Close();
         LogHistoryEdit(GlobalVar.user_id, GlobalVar.user_type, GlobalVar.user);
         NotificationEditSuccess d = new NotificationEditSuccess();
         d.ShowDialog();
         CloseTransparent();
     }
     catch
     {
         NotificationConnectionError a = new NotificationConnectionError();
         a.ShowDialog();
     }
 }
Exemple #3
0
 private void BtnChangePassword_Click(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         String       query = "update title set title = @title where title_id = @id";
         MySqlCommand cmd   = new MySqlCommand(query, con);
         cmd.Parameters.AddWithValue("@id", "1");
         cmd.Parameters.AddWithValue("@title", TxtTitle.Text);
         cmd.ExecuteNonQuery();
         con.Close();
         LogHistoryEdit(GlobalVar.user_id, GlobalVar.user_type, GlobalVar.user);
         NotificationEditSuccess a = new NotificationEditSuccess();
         a.ShowDialog();
     }
     catch
     {
         NotificationConnectionError a = new NotificationConnectionError();
         a.ShowDialog();
     }
 }
Exemple #4
0
 private void BtnChangePassword_Click(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         String       query = "update partylist set partylist = @partylist where position_id = @id";
         MySqlCommand cmd   = new MySqlCommand(query, con);
         cmd.Parameters.AddWithValue("@id", lblpartylistid.Text);
         cmd.Parameters.AddWithValue("@position", TxtPosition.Text);
         cmd.ExecuteNonQuery();
         con.Close();
         CloseTransparent();
         LogHistoryEdit(GlobalVar.user_id, GlobalVar.user_type, GlobalVar.user);
         NotificationEditSuccess a = new NotificationEditSuccess();
         a.ShowDialog();
     }
     catch
     {
         NotificationConnectionError a = new NotificationConnectionError();
         a.ShowDialog();
     }
 }