private void btn_ListDone_Click(object sender, EventArgs e) { databaseConnection con = new databaseConnection(); string sql_updateBug = "UPDATE tbl_Bug SET B_Subject= '" + txt_ListSubject.Text + "', B_Code='" + rtxt_ListCode.Text + "', B_Describe='" + rtxt_ListDescribtion.Text + "' WHERE B_Id= '" + lbl_BugIdDisplay.Text + "'"; MySqlCommand cmd = new MySqlCommand(sql_updateBug, con.Db_Connect()); cmd.ExecuteNonQuery(); MessageBox.Show("Update Successful"); txt_ListSubject.Clear(); rtxt_ListCode.Clear(); rtxt_ListDescribtion.Clear(); string sql_Buglist = "Select B_Id,B_Subject from tbl_bug"; MySqlCommand cmd1 = new MySqlCommand(sql_Buglist, con.Db_Connect()); DataTable dt = new DataTable(); MySqlDataAdapter msda = new MySqlDataAdapter(cmd1); dt.Clear(); msda.Fill(dt); dataGridView_Bug.DataSource = dt; con.CloseConnection(); }
private void BugDetailView_Load(object sender, EventArgs e) { databaseConnection con = new databaseConnection(); string sql_BugDetailView = "Select B_Subject, B_Describe, B_Code,B_Update, Date from tbl_bug where B_Id ='" + lbl_BGDBugid.Text + "'"; string sql_BugDetailView1 = "Select tbl_userlogin.UserName from tbl_userlogin left join tbl_bug on tbl_bug.User_Id = tbl_userlogin.User_Id where tbl_bug.B_Id ='" + lbl_BGDBugid.Text + "'"; MySqlCommand cmd = new MySqlCommand(sql_BugDetailView, con.Db_Connect()); MySqlCommand cmd1 = new MySqlCommand(sql_BugDetailView1, con.Db_Connect()); MySqlDataReader r = cmd.ExecuteReader(); MySqlDataReader r1 = cmd1.ExecuteReader(); if (r.Read() && r1.Read()) { lbl_BGDSubject.Text = r.GetString("B_Subject"); rtxt_BugDescribtion.Text = r.GetString("B_Describe"); rtxt_BGDBugProblem.Text = r.GetString("B_Code"); lbl_BGDTrackUser.Text = r1.GetString("UserName"); rtxt_BGDBugSolution.Text = r.GetString("B_Update"); lbl_BGDDate.Text = r.GetString("Date"); } else { MessageBox.Show("error !!!!!! UserName aand Usr_Type not shown"); } con.CloseConnection(); }
private void dataGridView_Bug_MouseClick(object sender, MouseEventArgs e) { try { //showing data to field after clicking the row DataGridViewRow row = dataGridView_Bug.SelectedRows[0]; lbl_BugIdDisplay.Text = row.Cells["B_Id"].Value.ToString(); txt_ListSubject.Text = row.Cells["B_Subject"].Value.ToString(); databaseConnection con = new databaseConnection(); string sql_Buglist = "Select * from tbl_bug where B_Id ='" + lbl_BugIdDisplay.Text + "'"; MySqlCommand cmd1 = new MySqlCommand(sql_Buglist, con.Db_Connect()); MySqlDataReader r = cmd1.ExecuteReader(); if (r.Read()) { rtxt_ListCode.Text = r.GetString("B_Code"); rtxt_ListDescribtion.Text = r.GetString("B_Describe"); } else { MessageBox.Show("error !!!!!! B_Code aand B_Describe not shown" + sql_Buglist); } } catch (Exception ex) { } }
private void btn_Submit_Click(object sender, EventArgs e) { databaseConnection con = new databaseConnection(); string sql_PpupdateBug = "UPDATE tbl_Bug SET B_Update='" + rtxt_PpUpdateCode.Text + "' WHERE B_Id= '" + lbl_PpBugId.Text + "'"; MySqlCommand cmd = new MySqlCommand(sql_PpupdateBug, con.Db_Connect()); cmd.ExecuteNonQuery(); MessageBox.Show("Submitted Successfully!!"); rtxt_PpErrorCode.Clear(); rtxt_PpUpdateCode.Clear(); string sql_Buglist = "Select B_Id,B_Subject from tbl_bug"; MySqlCommand cmd1 = new MySqlCommand(sql_Buglist, con.Db_Connect()); DataTable dt = new DataTable(); MySqlDataAdapter msda = new MySqlDataAdapter(cmd1); dt.Clear(); msda.Fill(dt); dataGridView_Bug.DataSource = dt; con.CloseConnection(); }
void startServing() { serverSocket = new TcpListener(IPAddress.Any, 8052); serverPingSocket = new TcpListener(IPAddress.Any, 8051); clientSocket = default(TcpClient); serverSocket.Start(); serverPingSocket.Start(); Console.WriteLine(" >> " + "Server Started"); db = new databaseConnection(); db.updateVideoEdits("1", "{\"name\": \"Afzaal Ahmad Zeeshan\",\"age\": 20}"); db.getVideoEdits("1"); Console.WriteLine(db.getVideoEdits("1")); Thread pinging = new Thread(sendPings); pinging.Start(); while (true) { clientSocket = serverSocket.AcceptTcpClient(); clientPingSocket = serverPingSocket.AcceptTcpClient(); Client client = new Client(max_acceptedSend, this); lock (clients) { clients.Add(client); Console.WriteLine(" >> " + "Client No:" + clients.Count + " started!"); client.StartClient(clientSocket, clientPingSocket, Convert.ToString(clients.Count)); //start servering the client } clientSocket = null; clientPingSocket = null; } }
private void btn_Submit_Click(object sender, EventArgs e) { try { //converting image to byte byte[] images = null; //first declare using system.io; then FileStream streem = new FileStream(imglocation, FileMode.Open, FileAccess.Read); BinaryReader brs = new BinaryReader(streem); images = brs.ReadBytes((int)streem.Length); if (rtxt_Code.Text != "" && rtxt_Describe.Text != "" && txt_Subject.Text != "" && txt_Imageurl.Text != "") { //Inserting data to the database databaseConnection con = new databaseConnection(); String sql_insertbug = "INSERT INTO tbl_bug(User_Id,B_Subject,B_Describe,B_Code,B_Image,B_Update,Date, Project) VALUES ('" + lbl_UserIdDisplay.Text + "','" + txt_Subject.Text + "','" + rtxt_Describe.Text + "','" + rtxt_Code.Text + "','" + images + "','','" + dateTimePicker_Tracker.Text + "','" + comboBox_Project.Text + "')"; MySqlCommand cmd1 = new MySqlCommand(sql_insertbug, con.Db_Connect()); cmd1.ExecuteNonQuery(); MessageBox.Show("Bug have been reported"); con.CloseConnection(); //clearing all the values from the field pictureBox_Bug.Image = null; txt_Imageurl.Clear(); txt_Subject.Clear(); rtxt_Describe.Clear(); rtxt_Code.Clear(); } else { MessageBox.Show("Fill all the empty Field!!"); } try { databaseConnection con = new databaseConnection(); string sql_Buglist = "Select B_Id,B_Subject from tbl_bug"; MySqlCommand cmd1 = new MySqlCommand(sql_Buglist, con.Db_Connect()); DataTable dt = new DataTable(); MySqlDataAdapter msda = new MySqlDataAdapter(cmd1); dt.Clear(); msda.Fill(dt); dataGridView_Bug.DataSource = dt; } catch (Exception) { throw; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_UserChange_Click(object sender, EventArgs e) { DialogResult value = MessageBox.Show("Do you really want to change your Account to Programmer Type?", "Confirm exit", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (value == DialogResult.Yes) { databaseConnection con = new databaseConnection(); string sql_changeuser = "******" + lbl_usrIdShowPass.Text + "'"; MySqlCommand cmd = new MySqlCommand(sql_changeuser, con.Db_Connect()); cmd.ExecuteNonQuery(); MessageBox.Show("Request sent"); } }
public void AdminPanelfun() { try { //loading data in datagrid view in page load databaseConnection con1 = new databaseConnection(); string sql_Usrlist = "Select User_Id,UserName from tbl_userlogin"; MySqlCommand cmd1 = new MySqlCommand(sql_Usrlist, con1.Db_Connect()); DataTable dt = new DataTable(); MySqlDataAdapter msda1 = new MySqlDataAdapter(cmd1); dt.Clear(); msda1.Fill(dt); dataGridView_ApUserList.DataSource = dt; con1.CloseConnection(); //loading new buglist with no solution reply databaseConnection con = new databaseConnection(); string sql_Buglist = "Select B_Id,B_Subject from tbl_bug where B_Update=''"; MySqlCommand cmd = new MySqlCommand(sql_Buglist, con.Db_Connect()); DataTable dt1 = new DataTable(); MySqlDataAdapter msda = new MySqlDataAdapter(cmd); dt1.Clear(); msda.Fill(dt1); dataGridView_APBGL.DataSource = dt1; con.CloseConnection(); //loading solved buglist with solution reply databaseConnection con2 = new databaseConnection(); string sql_BuglistSolve = "Select B_Id,B_Subject from tbl_bug where B_Update!=''"; MySqlCommand cmd2 = new MySqlCommand(sql_BuglistSolve, con2.Db_Connect()); DataTable dt2 = new DataTable(); MySqlDataAdapter msda2 = new MySqlDataAdapter(cmd2); dt2.Clear(); msda2.Fill(dt2); dataGridView_APBGS.DataSource = dt2; con2.CloseConnection(); } catch (Exception) { } }
private void btn_BGDDeleteBug_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Do you really want to delete this User?", "Confirm Delete", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); databaseConnection con = new databaseConnection(); if (result == DialogResult.Yes) { string sql_UdBgListDelete = "DELETE FROM tbl_bug WHERE B_Id='" + lbl_BGDBugid.Text + "'"; MySqlCommand cmd = new MySqlCommand(sql_UdBgListDelete, con.Db_Connect()); cmd.ExecuteNonQuery(); MessageBox.Show("Delete Successful"); //working function calling commented var principalForm1 = Application.OpenForms.OfType <AdminPanel>().FirstOrDefault(); principalForm1.AdminPanelfun(); } this.Close(); }
private void TrackerPanel_Load(object sender, EventArgs e) { try { databaseConnection con = new databaseConnection(); string sql_Buglist = "Select B_Id,B_Subject from tbl_bug"; MySqlCommand cmd1 = new MySqlCommand(sql_Buglist, con.Db_Connect()); DataTable dt = new DataTable(); MySqlDataAdapter msda = new MySqlDataAdapter(cmd1); dt.Clear(); msda.Fill(dt); dataGridView_Bug.DataSource = dt; con.CloseConnection(); } catch (Exception) { throw; } }
/// <summary> /// creating object for changing the password /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_APchangepassDone_Click(object sender, EventArgs e) { databaseConnection con = new databaseConnection(); string sql_LUserlist = "Select * from tbl_userlogin where User_Id = '" + usidpassth + "' "; MySqlCommand cmd1 = new MySqlCommand(sql_LUserlist, con.Db_Connect()); MySqlDataReader r = cmd1.ExecuteReader(); if (r.Read()) { String OldPassword = r.GetString("Password"); if (OldPassword == txt_APOldPassword.Text) { if (txt_APNewPassword.Text == txt_APConfirmPassword.Text) { string sql_updateBug = "UPDATE tbl_userlogin SET Password='******' WHERE User_Id= '" + usidpassth + "'"; MySqlCommand cmd2 = new MySqlCommand(sql_updateBug, con.Db_Connect()); cmd2.ExecuteNonQuery(); MessageBox.Show("Password changed successfully!!!"); txt_APOldPassword.Clear(); txt_APNewPassword.Clear(); txt_APConfirmPassword.Clear(); groupBox_Changepassword.Hide(); } else { MessageBox.Show("New password and Confirm password do not match!!!"); } } else { MessageBox.Show("Old Password not match"); } } else { } }
//object for btn_NUSubmit /// <summary> /// connecting to database /// </summary> private void btn_NUSubmit_Click(object sender, EventArgs e) { databaseConnection con = new databaseConnection(); string sql_LUserlist = "Select UserName from tbl_userlogin"; MySqlCommand cmd1 = new MySqlCommand(sql_LUserlist, con.Db_Connect()); MySqlDataReader r = cmd1.ExecuteReader(); if (r.Read()) { String UserNameCheck = r.GetString("UserName"); if (txt_NUUsername.Text != UserNameCheck) { try { if (txt_NUConfPass.Text == txt_NUPassword.Text) { //Connecting to the database for checking unique username String sql_insertusr = "******" + txt_NUUsername.Text + "','" + txt_NUPassword.Text + "','Tracker','No')"; MySqlCommand cmd2 = new MySqlCommand(sql_insertusr, con.Db_Connect()); cmd2.ExecuteNonQuery(); MessageBox.Show("User " + txt_NUUsername.Text + " successfully Created!!!"); //clearing the text box txt_NUUsername.Clear(); txt_NUPassword.Clear(); txt_NUConfPass.Clear(); //closing connection this.Close(); } else { //displaying error message MessageBox.Show("Password do not match."); } } catch (Exception) { //displaying error message MessageBox.Show("User Name already exists."); txt_NUUsername.Clear(); txt_NUPassword.Clear(); txt_NUConfPass.Clear(); } } else { MessageBox.Show("UserName already exist!!!"); } } else { } //redirecting the page to Login Login login = new Login(); login.Show(); //for hiding loginpanel this.Hide(); }