Webform2 – wireless LAN, users and access points management Essay

Custom Student Mr. Teacher ENG 1001-04 5 June 2017

Webform2 – wireless LAN, users and access points management

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;j<i;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;j<i;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;i<k;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;j<i;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;i<k;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;i<k;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;i<APnum;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;j<i;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;j<i;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.

Free Webform2 – wireless LAN, users and access points management Essay Sample

B

  • Subject:

  • University/College: University of Arkansas System

  • Type of paper: Thesis/Dissertation Chapter

  • Date: 5 June 2017

  • Words:

  • Pages:

We will write a custom essay sample on Webform2 – wireless LAN, users and access points management

for only $16.38 $13.9/page

your testimonials