Accessing the access point Essay

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

Accessing the access point

In functions such as add user we need to connect to each Access Point and update its users table. Connection to the Access Point is done by using the SNMP protocol. In this application we are using known EXE files that perform the SNMP protocol using the parameters that we send. We are using 2 files: snmpSET. exe and snmpGET. exe . As we mentioned in the SNMP chapter, each function has an object ID. For example, in the AVAYA access point, the object ID 1. 3. 6. 1. 2. 1. 1. 5. 0 represents the get IP function.

In this application the structure that we are using to connect to the access points includes 2 classes: snmp.cs and avaya. cs . The snmp class has 2 functions snmpSET and snmpGET both get the arguments they need in order to activate the equivalent EXE file by opening a new process and waiting for its result. The avaya class has simple functions that calling them results in obtaining the object ID of the function that we want to perform. Let us say we want to find the location of a specific access point.

In order to do that we retrieve from the database the access points’ IP address and from the avaya class the object ID. Once we have all this information we call the snmpGET function from the snmp class and we send the data we have.

The command line that will be at the end would look like this: snmpGet. exe 132. 68. 52. 181 1. 3. 6. 1. 2. 1. 1. 6. 0 -APpass The Appass is the access point password. Appendixes Application code webform1 – application login private void Button1_Click(object sender, System. EventArgs e) // login button { String user, password, db_password; String super; sqlDataAdapter1. Fill(userDS1); user = TextBox2. Text. ToString(); password = TextBox3. Text. ToString(); DataRow [] arr = userDS1. user. Select(“userName ='”+user+”‘”); if(arr. Length! =0) { db_password = arr[0]. ItemArray. GetValue(1). ToString(); super = arr[0].

ItemArray. GetValue(2). ToString(); if (db_password. Equals(password)) { //go to manager page if (super == “0”) Response. Redirect(“WebForm2. aspx”); else Response. Redirect(“WebForm3. aspx”); } else { //message to user login fail Label3. Text = “Login failed “; Label3. Visible=true; } } else { //user name not found Label3. Text = “User name not found”; Label3. Visible=true; } } Webform3 – application users management private void Button2_Click(object sender, System. EventArgs e) { //add user button Label3. Visible=true; Label4. Visible=true; Label5. Visible=true; CheckBox1. Visible=true; TextBox1. Visible=true; TextBox2.

Visible=true; Button1. Visible=true; Button2. Visible=true; Button3. Visible=true; Button5. Visible=true; Button6. Visible=false; DropDownList1. Visible=false; DataGrid1. Visible=false; Label6. Text=”Insert the user detials and press add”; } private void Button3_Click(object sender, System. EventArgs e) { Label3. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBox1. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; Button1. Visible=false; Button2. Visible=true; Button3. Visible=true; Button5. Visible=true; Button6. Visible=true; DropDownList1. Visible=true; DataGrid1. Visible=false;

Label6. Text=”Select the user you wish to remove and press remove”; DropDownList1. Items. Clear(); int i=0; try //bring the users list into the dropdown box { managers1. Clear(); sqlDataAdapter1. SelectCommand. CommandText = “SELECT userName FROM [user]”; sqlDataAdapter1. Fill(managers1); DataRow [] arr = managers1. user. Select(); i = arr. GetLength(0); while (i! =0) { DropDownList1. Items. Add(arr[i-1]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter1. SelectCommand = new SqlCommand( “SELECT * FROM [user]”,sqlConnection1); sqlDataAdapter1. Fill(managers1,”user”); } catch(Exception ev) { Label6.

Text=”ERROR ACSESSING THE DATABASE”; } private void Button5_Click(object sender, System. EventArgs e) //show all users { Label3. Visible=false; Label4. Visible=false; Label5. Visible=false; CheckBox1. Visible=false; TextBox1. Visible=false; TextBox2. Visible=false; Button1. Visible=false; Button2. Visible=true; Button3. Visible=true; Button5. Visible=true; Button6. Visible=false; DropDownList1. Visible=false; DataGrid1. Visible=true; try { //refrash data and bind sqlDataAdapter1. SelectCommand = new SqlCommand( “SELECT * FROM [user]”,sqlConnection1); sqlDataAdapter1. Fill(managers1,”user”); DataGrid1. DataSource = managers1;

DataGrid1. DataBind(); DataGrid1. Visible=true; } catch(Exception ev) { Label6. Text=”ERROR ACSESSING THE DATABASE”; } Label6. Text=”what would you like to do? “; } private void Button1_Click(object sender, System. EventArgs e) //add user action button { String user_name,pass,super_user=”0″; String str2=””; user_name = TextBox1. Text. ToString(); pass = TextBox2. Text. ToString(); if (CheckBox1. Checked) super_user = “1”; try {//add user to the data base str2= “‘”+user_name +”‘, ‘”+ pass +”‘, ‘” +super_user+ “‘”; SqlCommand insCommand = new SqlCommand(“INSERT INTO [user] (userName, pass, super_user) VALUES (” + str2 +”)”,sqlConnection1); insCommand. Connection.

Open(); insCommand. ExecuteNonQuery(); insCommand. Connection. Close(); } catch(Exception ev) { Label6. Text=”ERROR ACSESSING THE DATABASE”; } //clear the text boxes TextBox1. Text=””; TextBox2. Text=””; CheckBox1. Checked = false; } private void Button6_Click(object sender, System. EventArgs e) //remove user action button { String user_name; int i; user_name = DropDownList1. SelectedItem. Text. ToString(); Label6. Text=”Removing user ” + user_name; SqlCommand DelCommand = new SqlCommand(“DELETE FROM [user] WHERE userName = ‘” + user_name + “‘”,sqlConnection1);

DelCommand. Connection. Open(); DelCommand. ExecuteNonQuery(); DelCommand. Connection. Close(); //refrash dropdownlist managers1. Clear(); sqlDataAdapter1. Fill(managers1); DropDownList1. Items. Clear(); sqlDataAdapter1. SelectCommand. CommandText = “SELECT userName FROM [user]”; sqlDataAdapter1. Fill(managers1); DataRow [] arr = managers1. user. Select(); i = arr. GetLength(0); while (i! =0) { DropDownList1. Items. Add(arr[i-1]. ItemArray. GetValue(0). ToString()); i=i-1; } sqlDataAdapter1. SelectCommand = new SqlCommand( “SELECT * FROM [user]”,sqlConnection1); sqlDataAdapter1. Fill(managers1,”user”); }.

Free Accessing the access point Essay Sample

A

  • Subject:

  • University/College: University of Chicago

  • Type of paper: Thesis/Dissertation Chapter

  • Date: 5 June 2017

  • Words:

  • Pages:

We will write a custom essay sample on Accessing the access point

for only $16.38 $13.9/page

your testimonials