Tuesday, January 28, 2020

Webform2 †wireless LAN, users and access points management Essay Example for Free

Webform2 – wireless LAN, users and access points management Essay Private void Page_Load(object sender, System. EventArgs e) { // intializing the sqlDataAdapter and dataSet sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM AP,sqlConnection1); sqlDataAdapter3. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM APusers,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1); sqlDataAdapter3. Fill(usersDataSet11); sqlDataAdapter2. AcceptChangesDuringFill = true; sqlDataAdapter3. AcceptChangesDuringFill = true; } private void Button9_Click(object sender, System. EventArgs e) //add button(users) { //saving the data the manager insert and adding it to the users table//goto each AP checked by the manager using SNMP protocol and add //them the user String user_name,user_id,user_MAC; String str2=,str3=; int i,j,tmp,k; user_name = TextBox1. Text. ToString(); user_id = TextBox2. Text. ToString(); user_MAC = TextBox5. Text. ToString(); int items = CheckBoxList1. Items. Count; // APs will hold the names of all the APs that the user // can access string[] APs = new string[items]; k=0; APs. Initialize(); try { apDataSet1. Clear(); sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT APname FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); DataRow [] arr = apDataSet1. AP. Select(); i = arr. GetLength(0); // add this user to the table // str2 has the names of all the APs coulms // str3 has the values of all the coulms j=0; for(j=0;ji;j++) { str3= str3 + arr[j]. ItemArray. GetValue(0) .ToString()+, ; } str3 = str3. Remove(((str3. Length)-2),2); str2= +user_name +, + user_id +, +user_MAC + , ; tmp = CheckBoxList1. SelectedIndex; for(j=0;ji;j++) { if (tmp==j) { APs[k]=CheckBoxList2. SelectedItem. Text; k++; str2= str2 + 1, ; CheckBoxList1. SelectedItem. Selected = false; tmp = CheckBoxList1. SelectedIndex; } else str2= str2 + 0, ; } str2 = str2. Remove(((str2. Length)-2),2); SqlCommand insCommand = new SqlCommand( INSERT INTO APusers (userName, id_num, mac_adr, + str3 + ) VALUES ( + str2 + ),sqlConnection1); insCommand. Connection. Open(); insCommand. ExecuteNonQuery(); insCommand. Connection. Close(); sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); / the steps to update the access points:   1. for each AP in the APs array: *  Ã‚  Ã‚   1. 1 get the AP IP address from the AP database. 1. 2 get the add entry to table object ID *   1. 3 call snmpSET function */ /* String IPaddr,OID; * for(i=0;ik;i++)   {*     DataRow [] arr = apDataSet1. AP. Select(Apname ='+APs[i]+); *  Ã‚   IPaddr = arr[0]. ItemArray. GetValue(1). ToString(); *  Ã‚   OID = avaya. addEntry(); *  Ã‚   snmpexe. snmpSet(IPaddr,OID,user_MAC); * } */ } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } TextBox7. Text=; TextBox1. Text=; TextBox2. Text=; TextBox5. Text=; TextBox3. Text=; TextBox4. Text=; } private int GetIndexofelement(string [,] arr,string elem) { int j,i = arr. Length; for(j=0;ji;i++) { if (arr[0,j]. ToString() == elem) return j; } return -1; } private void Button3_Click(object sender, System. EventArgs e) //remove user button. { CheckBox1. Visible=false; Label12. Visible=false; TextBox7. Visible=false; DataGrid2. Visible=false; DataGrid1. Visible=false; Button9. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; Label3. Visible=false; TextBox5. Visible=false; Label10. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBoxList1. Visible=false; Label1. Visible=false; Label2. Visible=false; Button10. Visible=false; TextBox3. Visible=false; TextBox4. Visible=false; DropDownList2. Visible=false; Button8. Visible=false; DropDownList1. Visible=true; Button6. Visible=true; DropDownList3. Visible=false; Button12. Visible=false; Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; DropDownList4. Visible=false; Button16. Visible=false; Button15. Visible=false; Label11. Visible=false; Label17. Visible=false; Label18. Visible=false; TextBox11. Visible=false; TextBox12. Visible=false; TextBox10. Visible=false; CheckBox2. Visible=false; Label6. Text=Select the user you wish to remove and press remove; /////////////////// //bring the users list into the dropdown box DropDownList1. Items. Clear(); int i=0; try { usersDataSet11. Clear(); sqlDataAdapter3. SelectCommand. CommandText = SELECT userName FROM APusers; sqlDataAdapter3. Fill(usersDataSet11); DataRow [] arr = usersDataSet11. APusers. Select(); i = arr. GetLength(0); while (i! =0) { DropDownList1. Items. Add(arr[i-1]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter3. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM APusers,sqlConnection1); sqlDataAdapter3. Fill(usersDataSet11,APusers); } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } } private void Button1_Click(object sender, System. EventArgs e)// add AP button { CheckBox1. Visible=true; Label12. Visible=true; TextBox7. Visible=true; DataGrid2. Visible=false; DataGrid1. Visible=false; Label1. Visible=true; Label2. Visible=true; Button10. Visible=true; TextBox3. Visible=true; TextBox4. Visible=true; TextBox5. Visible=false; Label10. Visible=false; Button9. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; Label3. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBoxList1. Visible=false; DropDownList1. Visible=false; Button6. Visible=false; DropDownList2. Visible=false; Button8. Visible=false; DropDownList3. Visible=false; Button12. Visible=false; Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; DropDownList4. Visible=false; Button16. Visible=false; Button15. Visible=false; Label11. Visible=false; Label17. Visible=false; Label18. Visible=false; TextBox11. Visible=false; TextBox12. Visible=false; TextBox10. Visible=false; CheckBox2. Visible=false; Label6. Text=Insert the AP detials and press add; } private void Button4_Click(object sender, System. EventArgs e) //remove AP button. { CheckBox1. Visible=false; Label12. Visible=false; TextBox7. Visible=false; DataGrid2. Visible=false; DataGrid1. Visible=false; DropDownList2. Visible=true; Button8. Visible=true; Button9. Visible=false; TextBox5. Visible=false; Label10. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; Label3. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBoxList1. Visible=false; DropDownList1. Visible=false; Button6. Visible=false; Label1. Visible=false; Label2. Visible=false; Button10. Visible=false; TextBox3. Visible=false; TextBox4. Visible=false; DropDownList3. Visible=false; Button12. Visible=false; Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; DropDownList4. Visible=false; Button16. Visible=false; Button15. Visible=false; Label11. Visible=false; Label17. Visible=false; Label18. Visible=false; TextBox11. Visible=false; TextBox12. Visible=false; TextBox10. Visible=false; CheckBox2. Visible=false; Label6. Text=Select the AP you wish to remove and press remove; //bring the APs list into the dropdown box try { DropDownList2. Items. Clear(); int i=0; apDataSet1. Clear(); sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT APname FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); DataRow [] arr = apDataSet1. AP. Select(); i = arr. GetLength(0); while (i! =0) { DropDownList2. Items. Add(arr[i-1]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } } private void Button5_Click(object sender, System. EventArgs e) //show all users button { CheckBox1. Visible=false; Label12. Visible=false; TextBox7. Visible=false; DataGrid2. Visible=false; DataGrid1. Visible=true; Button9. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; TextBox5. Visible=false; Label10. Visible=false; Label3. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBoxList1. Visible=false; DropDownList1. Visible=false; Button6. Visible=false; Label1. Visible=false; Label2. Visible=false; Button10. Visible=false; TextBox3. Visible=false; TextBox4. Visible=false; DropDownList2. Visible=false; Button8. Visible=false; DropDownList3. Visible=false; Button12. Visible=false; Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; DropDownList4. Visible=false; Button16. Visible=false; Button15. Visible=false; Label11. Visible=false; Label17. Visible=false; Label18. Visible=false; TextBox11. Visible=false; TextBox12. Visible=false; TextBox10. Visible=false; CheckBox2. Visible=false; try { sqlDataAdapter3. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM APusers,sqlConnection1); sqlDataAdapter3. Fill(usersDataSet11,APusers); DataGrid1. DataSource = usersDataSet11; DataGrid1. DataBind(); } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } Label6. Text=which operation would you like to perform? ; } private void Button6_Click(object sender, System. EventArgs e) // remove button(users) { //goto all APs listed for this user and remove the user from //ther table and then remove the user from the data base String user_name; try { user_name = DropDownList1. SelectedItem. Text. ToString(); Label6. Text=Remove user + user_name; /* * the steps to update the access points: * 0. create an array with the APs name * 1. for each AP in the APs array: *  Ã‚  Ã‚   1. 1 get the AP IP address from the AP database *  Ã‚  Ã‚   1. 2 get the remove entry to table object ID *  Ã‚  Ã‚   1. 3 call snmpSET function */ /* String IPaddr,OID; * for(i=0;ik;i++) * { *  Ã‚   DataRow [] arr = apDataSet1. AP. Select(APname ='+APs[i]+); *  Ã‚   IPaddr = arr[0]. ItemArray. GetValue(1). ToString(); *  Ã‚   OID = avaya. removeEntry(); *  Ã‚   snmpexe. snmpSet(IPaddr,OID,user_MAC); * } */ SqlCommand DelCommand = new SqlCommand(DELETE FROM APusers WHERE userName = + user_name + ,sqlConnection1); DelCommand. Connection. Open(); DelCommand. ExecuteNonQuery(); DelCommand. Connection. Close(); usersDataSet11. Clear(); sqlDataAdapter2. Fill(apDataSet1); sqlDataAdapter3. Fill(usersDataSet11); //todo: refrash list DropDownList1. Items. Clear(); int i=0; usersDataSet11. Clear(); sqlDataAdapter3. SelectCommand = new SqlCommand( SELECT userName FROM APusers,sqlConnection1); sqlDataAdapter3. Fill(usersDataSet11); DataRow [] arr = usersDataSet11. APusers. Select(); i = arr. GetLength(0); while (i! =0) { DropDownList1. Items. Add(arr[i-1]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter3. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM APusers,sqlConnection1); sqlDataAdapter3. Fill(usersDataSet11,APusers); } catch(Exception ev). {Label6. Text=ERROR ACSESSING THE DATABASE; } } private void Button10_Click(object sender, System. EventArgs e) //add button(AP) {//updata the APs table and init the AP String AP_name,AP_ip,Location; bool active; try { AP_name = TextBox3. Text. ToString(); AP_ip = TextBox4. Text. ToString(); Location = TextBox7. Text. ToString(); active = CheckBox1. Checked; apDataSet1. AP. AddAPRow(AP_name,AP_ip,Location,active); sqlDataAdapter2. Update(apDataSet1); SqlCommand myCommand = new SqlCommand(ALTER TABLE APusers ADD +AP_name+ bit,sqlConnection1); myCommand. Connection. Open(); myCommand. ExecuteNonQuery(); myCommand. Connection. Close(); //todo: make all the users in the APusers table marked as not allowed to this AP myCommand = new SqlCommand( UPDATE APusers SET +AP_name+= 0,sqlConnection1); myCommand. Connection. Open(); myCommand. ExecuteNonQuery(); myCommand. Connection. Close(); /* the steps to update the access points: * 1. connect to the AP IP address from the AP database * 2. get the remove entry to table object ID *3. call snmpSET function */ /* String IPaddr,OID; * for(i=0;ik;i++) * { *  Ã‚   OID = avaya. setName(); *  Ã‚   snmpexe. snmpSet(AP_ip,OID,AP_name); *  Ã‚   OID = avaya. setLocation(); *  Ã‚   snmpexe. snmpSet(AP_ip,OID,Location); * }   */ }catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } TextBox7. Text=; TextBox1. Text=; TextBox2. Text=; TextBox5. Text=; TextBox3. Text=; TextBox4. Text=; } private void Button8_Click(object sender, System. EventArgs e) //remove button(AP) {//remove the APs table String AP_name; try { AP_name = DropDownList2. SelectedItem. Text. ToString(); Label6. Text=Removing AP + AP_name; SqlCommand DelCommand = new SqlCommand(DELETE FROM AP WHERE APname = + AP_name + ,sqlConnection1); DelCommand. Connection. Open(); DelCommand. ExecuteNonQuery(); DelCommand. Connection. Close(); apDataSet1. Clear();sqlDataAdapter2. Fill(apDataSet1); sqlDataAdapter3. Fill(usersDataSet11); sqlDataAdapter2. AcceptChangesDuringFill = true; sqlDataAdapter3. AcceptChangesDuringFill = true; DataGrid1. DataSource = apDataSet1; DataGrid1. DataBind(); //todo: refrash list DropDownList2. Items. Clear(); int i=0; apDataSet1. Clear(); sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT APname FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); DataRow [] arr = apDataSet1. AP. Select(); i = arr. GetLength(0); while (i! =0) { DropDownList2. Items. Add(arr[i-1]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); //todo: remove the AP_name culomn from the APusers table SqlCommand myCommand = new SqlCommand(ALTER TABLE APusers DROP COLUMN +AP_name,sqlConnection1); myCommand. Connection. Open(); myCommand. ExecuteNonQuery(); myCommand. Connection. Close(); } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } /*SNMP: * goto the selected AP * a. go to the data base and get the AP IP number * b. snmp. snmpSet(IP,DisableAllUsers) */ } private void Button2_Click(object sender, System. EventArgs e) // add user button. { int i=0; CheckBox1. Visible=false; Label12. Visible=false; TextBox7. Visible=false; DataGrid2. Visible=false; DataGrid1. Visible=false; Button9. Visible=true; TextBox1. Visible=true; TextBox2. Visible=true; TextBox5. Visible=true; Label10. Visible=true; Label3. Visible=true; Label4. Visible=true; Label5. Visible=true; CheckBoxList1. Visible=true; DropDownList1. Visible=false; Button6. Visible=false; Label1. Visible=false; Label2. Visible=false; Button10. Visible=false; TextBox3. Visible=false; TextBox4. Visible=false; DropDownList2. Visible=false; Button8. Visible=false; DropDownList3. Visible=false; Button12. Visible=false; Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; DropDownList4. Visible=false; Button16. Visible=false; Button15. Visible=false; Label11. Visible=false; Label17. Visible=false; Label18. Visible=false; TextBox11. Visible=false; TextBox12. Visible=false; TextBox10. Visible=false; CheckBox2. Visible=false; Label6. Text=Insert the user detials and press add; //bring to the checkbox list all the APs available CheckBoxList1. Items. Clear(); apDataSet1. Clear(); Try { sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT APname FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); DataRow [] arr = apDataSet1. AP. Select(); i = arr. GetLength(0); int j =i; while (i! =0) { CheckBoxList1. Items. Add(arr[j-i]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } } private void Button11_Click(object sender, System. EventArgs e) //show all APs button { CheckBox1. Visible=false; Label12. Visible=false; TextBox7. Visible=false; DataGrid2. Visible=true; DataGrid1. Visible=false; Button9. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; TextBox5. Visible=false; Label10. Visible=false; Label3. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBoxList1. Visible=false; DropDownList1. Visible=false; Button6. Visible=false; Label1. Visible=false; Label2. Visible=false; Button10. Visible=false; TextBox3. Visible=false; TextBox4. Visible=false; DropDownList2. Visible=false; Button8. Visible=false; DropDownList3. Visible=false; Button12. Visible=false; Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; DropDownList4. Visible=false; Button16. Visible=false; Button15. Visible=false; Label11. Visible=false; Label17. Visible=false; Label18. Visible=false; TextBox11. Visible=false; TextBox12. Visible=false; TextBox10. Visible=false; CheckBox2. Visible=false; try { DataGrid2. DataSource = apDataSet1; DataGrid2. DataBind(); } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } Label6. Text=which operation would you like to perform?; } private void Button7_Click(object sender, System. EventArgs e) { CheckBox1. Visible=false; Label12. Visible=false; TextBox7. Visible=false; DataGrid2. Visible=false; DataGrid1. Visible=false; Button9. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; Label3. Visible=false; TextBox5. Visible=false; Label10. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBoxList1. Visible=false; Label1. Visible=false; Label2. Visible=false; Button10. Visible=false; TextBox3. Visible=false; TextBox4. Visible=false; DropDownList2. Visible=false; Button8. Visible=false; DropDownList1. Visible=false; Button6. Visible=false; DropDownList3. Visible=true; Button12. Visible=true; Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; DropDownList4. Visible=false; Button16. Visible=false; Button15. Visible=false; Label11. Visible=false; Label17. Visible=false; Label18. Visible=false; TextBox11. Visible=false; TextBox12. Visible=false; TextBox10. Visible=false; CheckBox2. Visible=false; Label6. Text=Select the user whose details you wish to update; bring the users list into the dropdown box DropDownList3. Items. Clear(); int i=0; try { usersDataSet11. Clear(); sqlDataAdapter3. SelectCommand. CommandText = SELECT userName FROM APusers; sqlDataAdapter3. Fill(usersDataSet11); DataRow [] arr = usersDataSet11. APusers. Select(); i = arr. GetLength(0); while (i! =0) { DropDownList3. Items. Add(arr[i-1]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter3. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM APusers,sqlConnection1); sqlDataAdapter3. Fill(usersDataSet11,APusers); } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } }private void Button12_Click(object sender, System. EventArgs e) { string user, id_num, mac_addr; int i=3, length; int APnum; user= DropDownList3. SelectedItem. Text. ToString(); original = user; Label6. Text=Update user + user; DropDownList3. Visible=false; Button12. Visible=false; Label13. Visible=true; Label14. Visible=true; Label15. Visible=true; Label16. Visible=true; TextBox6. Visible=true; TextBox8. Visible=true; TextBox9. Visible=true; CheckBoxList2. Visible=true; Button13. Visible=true; //filling the text boxs with the existing user data CheckBoxList2. Items. Clear(); sqlDataAdapter3. Fill(usersDataSet11); DataRow [] arr = usersDataSet11. APusers. Select(userName ='+user+); id_num = arr[0]. ItemArray. GetValue(1). ToString(); mac_addr = arr[0]. ItemArray. GetValue(2). ToString(); //displaying the current user data in text boxs TextBox6. Text=user; TextBox8. Text=id_num; TextBox9. Text=mac_addr; CheckBoxList2. Items. Clear(); apDataSet1. Clear(); try { sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT APname FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); DataRow [] arr1 = apDataSet1. AP. Select(); APnum = arr1. GetLength(0); i = APnum; int j =i; while (i! =0) { CheckBoxList2. Items. Add(arr1[j-i]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); for(i=0;iAPnum;i++) { SqlCommand myCommand = new SqlCommand( SELECT + CheckBoxList2. Items[i]. Text + FROM APusers WHERE (userName = + user +),sqlConnection1); myCommand. Connection. Open(); SqlDataReader data = myCommand. ExecuteReader(); data. Read(); CheckBoxList2. Items[i]. Selected = data. GetBoolean(0); myCommand. Connection. Close(); } } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } } private void Button13_Click(object sender, System. EventArgs e) { String user_name,user_id,user_MAC; String str2=,str3=; int i,j,tmp; user_name = TextBox6. Text. ToString(); user_id = TextBox8. Text. ToString(); user_MAC = TextBox9. Text. ToString(); int items = CheckBoxList2. Items. Count; try { apDataSet1. Clear(); sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT APname FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); DataRow [] arr = apDataSet1. AP. Select(); i = arr. GetLength(0); //todo: add this user to the table //todo: create str2 with the names of all the APs coulms //todo: create str3 with the values of all the coulms j=0; for(j=0;ji;j++) { str3= str3 + arr[j]. ItemArray. GetValue(0). ToString()+, ; } str3 = str3. Remove(((str3. Length)-2),2); Label6. Text =CheckBoxList2. SelectedIndex. ToString(); str2= +user_name +, + user_id +, +user_MAC + ,; tmp = CheckBoxList2. SelectedIndex; for(j=0;ji;j++) { if (tmp==j) { str2= str2 + 1, ; CheckBoxList2. SelectedItem. Selected = false; tmp = CheckBoxList2. SelectedIndex; } else str2= str2 + 0, ; } str2 = str2. Remove(((str2. Length)-2),2); Label6. Text =str2; SqlCommand delCommand = new SqlCommand(DELETE FROM APusers WHERE userName = + original + ,sqlConnection1); delCommand. Connection. Open(); delCommand. ExecuteNonQuery(); delCommand. Connection. Close(); SqlCommand insCommand = new SqlCommand(INSERT INTO APusers (userName, id_num, mac_adr, + str3 + ) VALUES ( + str2 + ),sqlConnection1); insCommand. Connection. Open(); insCommand. ExecuteNonQuery(); insCommand. Connection. Close(); sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT * FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); } catch(Exception ev) { Label6. Text=ERROR ACSESSING THE DATABASE; } /*SNMP: * goto the selected user * a. get all the APs IP numbers * b. for each IP *  Ã‚  Ã‚      if checked. *  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚   snmp. snmpSet(IP,addUsers) *  Ã‚  Ã‚      else *  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚   snmp. snmpSet(IP,removeUsers) */ Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; } private void Button14_Click(object sender, System. EventArgs e) { CheckBox1. Visible=false; Label12. Visible=false; TextBox7. Visible=false; DataGrid2. Visible=false; DataGrid1. Visible=false; Button9. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; TextBox5. Visible=false; Label10. Visible=false; Label3. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBoxList1. Visible=false; DropDownList1. Visible=false; Button6. Visible=false; Label1. Visible=false; Label2. Visible=false; Button10. Visible=false; TextBox3. Visible=false; TextBox4. Visible=false; DropDownList2. Visible=false; Button8. Visible=false; DropDownList3. Visible=false; Button12. Visible=false; Label13. Visible=false; Label14. Visible=false; Label15. Visible=false; Label16. Visible=false; TextBox6. Visible=false; TextBox8. Visible=false; TextBox9. Visible=false; CheckBoxList2. Visible=false; Button13. Visible=false; DropDownList4. Visible=true; Button16. Visible=true; Button15. Visible=false; Label11. Visible=false; Label17. Visible=false; Label18. Visible=false; TextBox11. Visible=false; TextBox12. Visible=false; TextBox10. Visible=false; CheckBox2. Visible=false; Label6. Text=Select the AP you wish to update and press select; //bring the APs list into the dropdown box try { DropDownList4. Items. Clear(); int i=0; apDataSet1. Clear(); sqlDataAdapter2. SelectCommand = new SqlCommand(  Ã‚  Ã‚  Ã‚  Ã‚   SELECT APname FROM AP,sqlConnection1); sqlDataAdapter2. Fill(apDataSet1,AP); DataRow [] arr = apDataSet1. AP. Select(); i = arr.

Monday, January 20, 2020

The Population Solution :: essays research papers fc

The Population Solution Question... 1. Most people assume that human numbers will stabilize at some point in the future. Discuss the conditions which can contribute to the solution of the population explosion. "Let us suppose that the average human being weighs 60 kilogram's. If that's the case then 100,000,000,000,000,000,000 people would weigh as much as the whole Earth does. That number of people is 30,000,000,000,000 times as many people as there are living today. It may seem to you that the population can go up a long, long time before it reaches the point where there are 30,000,000,000,000 times as many people as there are today. Let's think about that though. Let us suppose that the population growth rate stays at 2.0 per cent so that the number of people in the world continues to double every 35 years. How long, then, will it take for the world's population to weigh as much as the entire planet? The answer is - not quite 1,600 years. This means that by 3550 AD, the human population would weight as much as the entire planet.... Even if that were possible, it wouldn't give us much time. If the growth-rate stays at 2.0 per cent, then in a little over 2,200 years - say, by 4220 AD - the human populat i on would weigh as much as the entire Solar system, including the Sun... and by about 6700 AD - the human population would weigh as much as the entire Universe." The preceding paragraph, by Isaac Asimov describes quite alarmingly just how bad the population problem really is, that in considerably less time that has passed since the days of Julius Caesar the population will equal in mass of that of the earth. Most people assume that human numbers will stabilize at some point in the future. Hopefully it will, but not without conditions that will contribute to the solution of the population explosion, conditions which include education, birth control methods and government action. Although not the largest in terms of population size, Kenya has one of the highest rates natural increase in the world. This rapid growth rate, which is predicted to reach 120 million by the year 2050, is primarily due to high birthrates and low death rates. Alarmingly, more than half of its population is under the age of 15. This is partly due to the fact that before western influence, health care was relatively poor and families needed to be large in order to guarantee the survival of at least a couple of children to take care of both the land and the elderly.

Sunday, January 12, 2020

Lord of the Flies: Can Someone Be Innately Evil or Innately Good? Essay

The difference in the way humans perceive things is part of the complexity of mankind. What is thought of as evil to one person can be seen as good to another, and vice versa. The issue of good and evil is brought up in William Golding’s Lord of the Flies, when innocent boys are set on an island to bear the weight of society on their backs. What happens to them? How do past influences effect them? Are their actions good or evil? The actions of the boys were not a matter of being good or evil, but were actions for survival. A man’s environment does not influence him towards good or evil, nor is he born with it inside. Man has instincts and inner drives that are not matters of good and evil, but of survival. Humans are always, by natural instinct, going to do what is best for them and their survival. Animals, much like men, kill when in need. For instance, when they feel they are backed into a corner, they will attack, and when they need food, they will kill to eat. In Lord of the Flies, Ralph was being hunted by Jack’s tribe, and in a desperate attempt in his defense, he thrust his spear through a crack at the inspecting savages. Ralph attacked someone of his own kind for his own survival. It can be believed that man is the derivative of others animals, and as such, they have certain instincts that were instilled from birth. The boys on the island later began to resemble the behavior of animals. â€Å"At once the crowd surged after it, poured down the rock, leapt on to the beast, screamed, struck, bit, tore. There were no words, and no movements but the tearing of teeth and claws† (153). William Golding’s description of this scene leads a reader to believe that these boys took on animal like qualities. What kind of human tears with teeth and claws? The boys mistake Simon for their beast and result in ruthlessly killing him. In their state of mind of savagery and hunting, they saw themselves in danger of this â€Å"beast† and their first instinct was to kill anything in sight that had the possibility of being it. Humans and animals have a natural instinct to protect themselves in the face of danger, like attacking when backed into a corner. Instincts are innate, but indefinite characteristics such as good or evil are not. The significance of moral values does not apply to actions in a situation for survival. Instincts are not about being good or evil, because the issue of being good and evil is undefined. Whether an action or situation is good or evil depends on who it is and how it is being perceived. This makes this issue uncertain due to the way it is viewed from person to person. Since the way it is seen will differ, man cannot be exclusively evil or exclusively good. Consider the following example: A dog constantly jumps on the window of a door in an attempt to get the attention of the family inside. He is doing this in hopes to be let back inside the house. Someone inside the house could view this as being evil, which would be different from the view of an animal lover. They would not consider this evil and would claim that the dog had not caused physical harm and just didn’t know any better. The dog doesn’t believe that it is evil because he is only obeying environmental stimuli. He’s been inside before and knows that it is much nicer than outside, and wants the attention that is inside. The dog has tried to jump on the door before, and had received the attention of someone who thus let him in. This leads the dog to believe that what he is doing is the â€Å"right† thing to do. After all, he just wants in, right? So the dog is evil because someone inside says he is, but then he is not evil because he doesn’t think he is. The opinions on what is evil and what isn’t disagree with each other because of how it was perceived by each side. In Lord of the Flies there is a situation that deals with Piggy’s glasses, which is the key to fire on the island. The glasses are stolen in the middle of the night that leads to a brawl in the dark among the boys. Of course the fact that the glasses were stolen, and that they were Piggy’s only seeing aid, can be seen as evil, but what about Jack’s side? Jack acts upon his need for fire to cook the pig he slaughtered with his tribe to fully enjoy their prize. Ralph and Samneric engage in a fight with whoever they can touch first, not even attempting to reason. Which is evil in this situation? Humans are simply complex animals that respond to complex stimuli, and their behaviors are influenced or are a product of everything that they learn starting from the day of their birth do the day of their death. Society sets a mold for the â€Å"good† and â€Å"bad† conditions that humans are learning from day to day. The role of society in being good or evil is that it acts as this guideline for that long lived dream of acceptance. It’s where what’s good gets you in, and what’s evil is what will make you repulsive. The ideas of power and the abuse of that power are not learned from the environment. The environment is used as a resource to abuse that power. Jack manipulates the boys into joining his tribe and sets up his territory on the island. He threatens people to join his tribe, and hunts those that refuse to. Jack’s tactics are an example of how he abuses power by using the environment and how he sets the society guidelines of acceptance. A society could not exist where people are brought up to know what they define as right or wrong, and could stick to that without problem. â€Å"We decide things. But they don’t get done†(79). On the island, the civilized rules of having drinking water, shelters, and having a spot for a lavatory are not followed. The boys were brought up having rules like these, but they did not stick to them due to the problem that they didn’t have a strong enough authority figure to instill them. Society acts as this needed component to life, and if it’s not there then it needs to be made. The creation of society begins with people who have the power to set the rules of acceptance, and they are the ones who establish what is good and what is evil. Society may manipulate others into believing what is good and evil, but those that manipulate society create that belief. It’s not that man is innately good or innately evil, it’s their natural instinct that drives them to do those evil or good deeds based upon what society leads them believe. Man can not be exclusively good or evil because the state of good and evil is undefined. People are born with an instinct that drives them to do what is necessary in extreme measures. This instinct over takes any other preceding thought and becomes the need for survival. In Lord of the Flies, it wasn’t whether or not the inhabitants were evil or good, it was their human reaction and instinct in the case of survival.

Saturday, January 4, 2020

A Look at the Westward Expansion in the Post-Civil War Era

History is like a die. It can have a small or large number of sides, but it can never have just one. Regarding the United States Westward Expansion in the Post-Civil War era, there were many sides to be taken into account, including (but not limited to) the Apache Indians, the US Government workers and soldiers, the American Elite, journalists, and scholars. How historians and others perceive this era is dependent on the primary sources available. By looking at sources such as Apache Chief Geronimo’s Story of His Life, Harvard Educated Ranch Manager Richard Trimble’s Letters to his Mother, and Financial Editor H.D. Lloyd’s â€Å"Story of a Great Monopoly†, one can unearth little nuggets of information that help determine how the process of incorporation affected large and diverse groups of people. When the United States began its Westward Expansion in the second half of the 19th century, many Native American Chiefs lost much more than they gained. The first time that Apache Chief Geronimo ever saw white men was about 1858, shortly after the massacre of â€Å"Kaskiyeh†. Although he was a warrior, he was not interested in killing every white soldier or settler that he came across. Instead, his initial attitude towards the white soldiers and settlers was stated on page 117 of his autobiography as, â€Å"The Indians always tried to live peaceably with the white soldiers and settlers.† (117) This statement, along with a few others in the autobiography such as â€Å"Then we made our camp nearShow MoreRelatedThe American Dream By Thomas Jefferson1329 Words   |  6 Pagesin history self belief and reliance caused success in his article when he states, â€Å"Some 75 years later, sociologist Max Weber dubbed the qualities that Tocqueville observed the â€Å"Protesta nt ethic† (Malanga). Many years later closer to the civil war westward expansion was the new refinement of the dream. The dream aligned with the belief of manifest destiny which is defined in Jon Meacham s Time article. Meacham states, â€Å"The myth of the West was the myth of the nation: that all of us could light outRead MoreDiscovering The American Past : The Port Royal Experiment, 1861-1865 ( 237-274 )1562 Words   |  7 PagesAmerican peoples in the postwar era? Modern US History: Juniors 2nd 9:09-9:55 / 8th 2:44-3:30 Monday: 11/30/15 Essential Question: Is war an economic tool which a government might use to bolster an economy? Due Date: Tuesday 12/1/15 by the end of the period. Split class into two sections World War II the 1950s (Your investigation needs to be in depth and detailed) A. How did the government pay for the war? B. How was the economy structured during the war? C. What was the government’sRead MoreThe Political Dangers Of Santa Fe Trails1603 Words   |  7 Pagescentury, the Southwest faced a range of challenges, including the Mexican-American War (1846-1848), which was fought over the disputed boundary of Texas after it was annexed in 1845. The Mexicans and the Native Americans continued to cause problems for political agents in the Southwest. Challenges in the Southwest such as the relations with the Mexicans and Native Americans continued through to The American Civil War, 1861-65. James Silas Calhoun (b.1802) was made Indian Agent in 1851 by PresidentRead MoreThe Panic Of 1893 As One Of The Worst2326 Words   |  10 Pagesthat occurred decades later, the legacy of the Panic of 1893 as one of the worst we have experienced holds. To understand the Panic of 1893, one must look back 20 years to a very similar situation that arose with the Panic of 1873. The country was experiencing a post-Civil War hangover that caused the economy to experience inflation. After the war, efforts were increased to expand the railroad. These efforts required substantial investments that were mostly unbacked. The country was already runningRead MoreNative American Gangs During European Colonization1960 Words   |  8 Pagesstill used today in order to grant tribal membership. Many Native Americans refused to participate in the allotment process since it was contrary to their beliefs regarding community land holdings. Surplus land was sold to non-natives. The Dawes Act era also signified the movement towards assimilation where Indian youth were sent to boarding schools where they were forced to cut their hair, speak English, learn Christianity and â€Å"kill the Indian, save the man.† It wasn’t until the Indian ReorganizationRead More Twain’s Huckleberry Finn and Kerouac’s On the Road – The River and the Road3035 Words   |  13 Pageswere written after horrific wars. Consequently, in each novel the missing father is dealt with on a different level. Huck is escaping from his abusive father while Dean’s father is the catalyst for their travels. The characters in On the Road imagine that Dean’s father could be anywhere, on any street corner or in any gutter, which represents the potential to lose every material comfort that society offers whether it be through destruction of a nation via Civil War or annihilation by atomic warfareRead MoreNative American Gangs During European Colonization2674 Words   |  11 Pagesstill used today in order to grant tribal membership. Many Native Americans refused to participate in the allotment process since it was contrary to their beliefs regarding community land holdings. Surplus land was sold to non-natives. The Dawes Act era also signified the movement towards assimilation where Indian youth were sent to boarding schools where they were forced to cut their hair, speak English, learn Christianity and â€Å"kill the Indian, save the man,† as boarding school proponent Richard HenryRead MoreAmerican Civil Rights Movement Essay15820 Words   |  64 Pages1. American Civil Rights Movement THE BLACKS 1865 and 1870 - Three Constitutional amendments: The Thirteenth Amendment abolished slavery, the Fourteenth Amendment gave blacks the rights of citizenship, and The Fifteenth Amendment gave them the right to vote. Until the modern civil rights movement (1950s) blacks were denied access to public places such as restaurants, hotels, theaters, and schools. There were separate facilities marked colored only, which was sanctioned by the courts. 1896Read MoreHistory and Rolls of Law Enforcement in America10094 Words   |  41 Pagesthe work place. Included in the second section, there will be six scenarios. The responses will incorporate knowledge of policing trends and issues gained throughout the course. Followed by a reaction summary. To understand today, you often have to look at yesterday. To grasp the challenges that contemporary policing faces, we need to explore a brief history of law enforcement in the Untied States. It is a story of a countries continuing struggle with law enforcement within a democracy. On theRead MoreOne Significant Change That Has Occurred in the World Between 1900 and 2005. Explain the Impact This Change Has Made on Our Lives and Why It Is an Important Change.163893 Words   |  656 Pages Agricultural and Pastoral Societies in Ancient and Classical History Jack Metzgar, Striking Steel: Solidarity Remembered Janis Appier, Policing Women: The Sexual Politics of Law Enforcement and the LAPD Allen Hunter, ed., Rethinking the Cold War Eric Foner, ed., The New American History. Revised and Expanded Edition E SSAYS ON _ T WENTIETH- C ENTURY H ISTORY Edited by Michael Adas for the American Historical Association TEMPLE UNIVERSITY PRESS PHILADELPHIA Temple