You are on page 1of 12

Login.

cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RemoteNetworkSystem
{
public partial class Login : Form
{
SqlConnection con = new SqlConnection("Data Source=.;Initial
Catalog=RemoteNetwork;Integrated Security=True");
public Login()
{
InitializeComponent();
}

private void buttonAdmin_Click(object sender, EventArgs e)


{
con.Close();
if (uidTextBox.Text != "" && pwdTextBox.Text != "")
{
try
{
string qry = "select count(*) from admin where adminid='" +
uidTextBox.Text + "' and password='" + pwdTextBox.Text + "'";
SqlCommand cmd = new SqlCommand(qry, con);
con.Open();
int temp = Convert.ToInt32(cmd.ExecuteScalar());
if (temp > 0)
{
this.Hide();
adminDashboard db = new adminDashboard();
db.Show();
}
else
{
MessageBox.Show("Invalid Username/Password.");
}

con.Close();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
else
{
MessageBox.Show("Please provide
UserID/Password.",Application.CompanyName);
}
}

private void buttonUser_Click(object sender, EventArgs e)


{
con.Close();
if (uidTextBox.Text != "" && pwdTextBox.Text != "")
{

try
{
string qry = "select count(*) from users where userid='" +
uidTextBox.Text + "' and password='" + pwdTextBox.Text + "'";
SqlCommand cmd = new SqlCommand(qry, con);
con.Open();
int temp = Convert.ToInt32(cmd.ExecuteScalar());
if (temp > 0)
{
this.Hide();
userDashboard db = new userDashboard();
db.Show();
}
else
{
MessageBox.Show("Invalid Username/Password.");
}
con.Close();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
else
{
MessageBox.Show("Please provide UserID/Password.",
Application.CompanyName);
}
}

private void uidTextBox_TextChanged(object sender, EventArgs e)


{

}
private void Login_Load(object sender, EventArgs e)
{

}
}
}

user register UC

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace RemoteNetworkSystem
{
public partial class userRegUC : UserControl
{
SqlConnection con = new SqlConnection("Data Source=.;Initial
Catalog=RemoteNetwork;Integrated Security=True");
public userRegUC()
{
InitializeComponent();
}

private void groupBox1_Enter(object sender, EventArgs e)


{

private void userRegUC_Load(object sender, EventArgs e)


{
statusComboBox.SelectedIndex = 1;
}

private void buttonSubmit_Click(object sender, EventArgs e)


{
con.Close();
if(uidTextBox.Text!="" && unTextBox.Text!="" &&pwdTextBox.Text!="")
{
try
{
string qry = "insert into
users(userid,name,password,email,contact,status)values('" + uidTextBox.Text + "','" +
unTextBox.Text + "','" + pwdTextBox.Text + "','" + emailTextBox.Text + "','" +
conTextBox.Text + "','" + statusComboBox.SelectedText + "')";
SqlCommand cmd = new SqlCommand(qry, con);
con.Open();
cmd.ExecuteNonQuery();
loadData();
MessageBox.Show("User registered successfully.");
con.Close();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
else
{
MessageBox.Show("Please fill all the required fields");
}
}

private void buttonReset_Click(object sender, EventArgs e)


{
clear();
}
private void clear()
{
uidTextBox.Text = "";
unTextBox.Text = "";
emailTextBox.Text = "";
pwdTextBox.Text = "";
conTextBox.Text = "";

private void buttonCancel_Click(object sender, EventArgs e)


{
this.Hide();
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs


e)
{
dataGridView1.Visible = true;
loadData();
}

private void loadData() {


string qry = "select * from users";

using (SqlCommand cmd = new SqlCommand(qry, con))


{
cmd.CommandType = CommandType.Text;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
if (dt.Rows.Count < 1)
{
MessageBox.Show("No user found!");
}
else
{
dataGridView1.DataSource = dt;
}
}
}
}
}
}
}

monitorusersessionUC

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace RemoteNetworkSystem
{
public partial class monitorUserSession : UserControl
{
SqlConnection con = new SqlConnection("Data Source=.;Initial
Catalog=RemoteNetwork;Integrated Security=True");
string currentdate = System.DateTime.Now.ToShortDateString();
public monitorUserSession()
{
InitializeComponent();
}

private void monitorUserSession_Load(object sender, EventArgs e)


{
string currentdate = System.DateTime.Now.ToShortDateString();
string qry = "select * from userlogin where date ='" + currentdate + "'";

using (SqlCommand cmd = new SqlCommand(qry, con))


{
cmd.CommandType = CommandType.Text;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
if (dt.Rows.Count < 1)
{
MessageBox.Show("No user sessions found yet!");
}
else
{
dataGridView1.DataSource = dt;
timer1.Start();
}
}
}
}
dataGridView1.Columns[1].Width = 50;
dataGridView1.Columns[2].Width = 60;
dataGridView1.Columns[5].Width = 70;
dataGridView1.Columns[6].Width = 80;
dataGridView1.Columns[7].Width = 80;
dataGridView1.Columns[8].Width = 120;
dataGridView1.Columns[8].HeaderText = "Session Status";
dataGridView1.Columns[9].Width = 200;
dataGridView1.Columns[9].DefaultCellStyle.ForeColor = Color.Red;
dataGridView1.Columns[9].HeaderText = "Alert Message";
dataGridView1.Columns[10].Width = 170;
dataGridView1.Columns[10].HeaderText = "Remaining time";
dataGridView1.Columns[10].DefaultCellStyle.ForeColor = Color.Green;
}
private void timer1_Tick(object sender, EventArgs e)
{

string qry = "select * from userlogin where date ='" + currentdate + "'";

using (SqlCommand cmd = new SqlCommand(qry, con))


{
cmd.CommandType = CommandType.Text;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
dataGridView1.DataSource = dt;
}
}
}

private void dataGridView1_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "cSession")
{
string sid = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
if (MessageBox.Show("Are you sure to close the user's session?",
"Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
string qry = "update userlogin set access='Closed' where id='" + sid
+ "'";
SqlCommand cmd = new SqlCommand(qry, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();

}
}
}

private void dataGridView1_CellFormatting(object sender,


DataGridViewCellFormattingEventArgs e)
{
if (this.dataGridView1.Columns[e.ColumnIndex].Name == "proxyattempts")
{

if (e.Value != null)
{
if (e.Value.ToString() == "1")
{
e.Value = "User has attempted proxy site, 1st time.";

else if (e.Value.ToString() == "2")


{
e.Value = "User has attempted proxy site, 2nd time.";
}
else if (e.Value.ToString() == "3")
{
e.Value = "User has attempted proxy site, 3rd time.";
}
else if (e.Value.ToString() == "0")
{
e.Value = "";
}
e.FormattingApplied = true;
}

}
if (this.dataGridView1.Columns[e.ColumnIndex].Name == "remainingtime")
{

if (e.Value != null)
{
if (e.Value.ToString() == "10")
{
e.Value = "10 minutes left for this user's session.";

else if (e.Value.ToString() == "5")


{
e.Value = "5 minutes left for this user's session.";
}

else if (e.Value.ToString() == "0")


{
e.Value = "Session closed.";
}
else if (e.Value.ToString() == "")
{
e.Value = "";
}

e.FormattingApplied = true;
}

}
}

}
}
Partial Classes  in C# A partial class  is a special feature of C#. It provides a special ability to implement
the functionality of a single  class into multiple files and all these files are combined into a single  class file
when the application is compiled. A partial class  is created by using a partial keyword.

Generics  Overview

1. Use  generic types to maximize code reuse, type safety, and performance.


2. The most common use of  generics is to create  collection classes.
3. The .NET Framework class library contains several new generic collectionclasses in
the  System.Collections.Generic  namespace.

using System

The first,  using System, is the same  using directive you have seen in every program in this tutorial. It
allows you to type the method names of members of the Systemnamespace without typing the
word  System  every time. In myPrint(), Console is a class member of the System namespace with the
method WriteLine().

The System.ComponentModel namespace provides classes that are used to implement the run-time and
design-time behavior of components and controls.

System.Data Namespace. The System.Data namespace provides access to classes that represent the


ADO.NET architecture. ADO.NET lets you build components that efficiently manage  data  from
multiple data sources

The  System.Data.SqlClient  namespace is the .NET Data Provider for SQL Server.
Classes
Remarks. The Graphics class provides methods for drawing  to the display device. Classes such as
Rectangle and Point encapsulate GDI+ primitives. ... Classes within the System.Drawing namespace are
not supported for use within a Windows or ASP.NET service.

The namespace provides classes and interfaces that support queries that use Language-Integrated
Query (LINQ).
The  System.Text  namespace contains classes that represent ASCII and Unicode character encodings;
abstract base classes for converting blocks of characters to and from blocks of bytes; and a helper class that
manipulates and formats  String  objects without creating intermediate instances of  String.
Classes

The  System.Threading.Tasks  namespace provides types that simplify the work of writing concurrent and
asynchronous code. The main types are  Task  which represents an asynchronous operation that can be
waited on and cancelled, and  Task<TResult>, which is a task that can return a value. The  TaskFactory  class
provides static methods for creating and starting tasks, and the  TaskSchedulerclass provides the default
thread scheduling infrastructure.
Classes

System.Windows.Forms Namespace. The System.Windows.Forms namespace contains classes for


creating Windows-based applications that take full advantage of the rich user interface features available
in the Microsoft  Windows  operating system.

➢ How to create database table

To create  a new table  within a database, you use theMySQL CREATE TABLE  statement. The  CREATE
TABLEstatement is one of the most complex statements inMySQL. First, you specify the name of
the  table that you want to create  after the  CREATE TABLE clause.

➢ Primary key + foreign key

A foreign key  is a set of one or more columns in a table that refers to the  primary key in another table.
There isn't any special code, configurations, or table definitions you need to place to officially “designate”
a foreign key
➢ How to show or represent record in table

Tables  are also called datasheets. Each table in a database holds data about a different, but related,
subject. Data is stored in records. A record is composed offields  and contains all  the data about one
particular person, company, or item in a database.

A table  is an entity containing  records. A  Record  is a collection of fields holding data about one item in
an entity. An example might be an order from a store. There is atable of orders. Each individual order is
a record containing fields for the Order #, customer, date etc.

➢ Database languages (DDL/DML/DCL)


SQL SERVER – Example of  DDL, DML,  DCL and TCL Commands
 DML.  DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify,
delete, insert and update data in  database. ...
 DDL.  DDL is abbreviation of Data Definition Language. ...
 DCL.  DCL is abbreviation of Data Control  Language. ...
 TCL. TCL is abbreviation of Transactional Control  Language.

 DML (INSERT, UPDATE and DELETE)

Data modification language statements (DML)  INSERT,  UPDATE, and DELETE. Use
the  INSERT  command to enter data into a table. You may  insert  one row at a time, or select several
rows from an existing table and insert them all at once.

 DDL (CREATE, DROP and ALTER)

 Create a new table with CREATE TABLE

 Change an existing table with ALTER TABLE

 Remove a table with DROP TABLE

➢ How to add new column/feld/attributes in table


➢ How to write/execute queries/commands in DB
➢ What’s your database name

REMOTE NETWORK SYSTEM

➢ How to connect your application with database

➢ How to create button, text-box, grid view


➢ How to change button color, text
➢ How to change button link or web page address /
or click address
➢ How to add new web page/form
➢ How to explain project working

Project work  is a series of activities that allows the students to study,do research and act by themselves
using their abilities, interests, personal experience and aptitiudes. The Project Work Progresses under
the guidance and monitoring of a Teacher or other Adviser.

Dividing your project management efforts into these five phases can help give your efforts structure and
simplify them into a series of logical and manageable steps.
 Project Initiation. ...
 Project Planning. ...
 Project Execution. ...
 Project Monitoring and Control. ...
 Project Closure.

A project plan can be considered to have five key characteristics that have to be managed:

 Scope: defines what will be covered in a project.


 Resource: what can be used to meet the scope.
 Time: what tasks are to be undertaken and when.
 Quality: the spread or deviation allowed from a desired standard.
 Risk: defines in advance what may happen to drive the plan off course, and what will be done to recover
the situation.

Definition of Project Success. ... Project  management  success is defined by the level of efficiency
the  project achieved to reach the  project objectives. Efficiency is related to how the project  manages its
limited resources to meet the goals while building good relationships with internal and external
stakeholders.

The project success criteria  refer to measurable terms of what should be the outcome of the  project that
is acceptable to the end user, customer, and the stakeholders. In other words, the project
success  factors consist of activities or elements that are required to ensure successful  completion of
the  project.
➢ Back-end of all web pages
➢ How to change restrictions (if any)
Allow changes to other settings and features

1. Go to Settings and tap Screen Time.


2. Tap Content & Privacy  Restrictions.  If  asked, enter your passcode.
3. Under Allow Changes, select the features or settings you want to allow changes to and choose
Allow or Don't Allow.
combo box

In Java, you can create  combo boxes. A  combo boxis a combination of a text field and a  drop-down  list
from which the user can choose a value. If the text-field portion of the control is editable, the user can
enter a value in the field or edit a value retrieved from the  drop-down  list.

MAC address

A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the
physical network segment.MAC addresses are used as a network address for most IEEE 802 network technologies, including
Ethernet and WiFi. Facebook page : https://www.facebook.com/networkkingss.

The purpose of MAC addresses is to provide a unique hardware address or physical address for every node on a local area
network (LAN) or other network. A node is a point at which a computer or other device (e.g., a printer or router) is connected to the
network.

IP address is a number assigned to the connection in a network. The basicdifference between MAC address and IP address is
that a MAC address uniquely identifies a device that wants to take part in a network. On the other hand, an IP address uniquely
defines a connection of a network with an interface of a device.
A Mac Address is the physical or virtual address of your NIC card or network interface. From a computer on a network's standpoint,
it is the physical address of that computer's NIC card. It is used to bring information to that computer on Layer 2 of the OSI model.
The IP address is required on layer 3.

Stands for "Media Access Control Address," and no, it is not related Apple Macintosh computers. A MAC address is a hardware
identification number that uniquely identifies each device on a network.

The MAC address is a unique value associated with a network adapter. MAC addresses are also known
as hardware addresses or physical addresses. They uniquely identify an adapter on a LAN.

MAC addresses are 12-digit hexadecimal numbers (48 bits in length). By convention, MAC addresses are usually
written in one of the following formats:

MM:MM:MM:SS:SS:SS
MMMM-MMSS-SSSS
The first half (24 BITS) of a MAC address contains the ID number of the adapter manufacturer. These IDs are
regulated by an Internet standards body (see sidebar). The second half (24 MORE BITS) of a MAC address
represents the serial number assigned to the adapter by the manufacturer. In the example,
00:A0:C9:14:C8:29
The prefix
00A0C9
indicates the manufacturer is Intel Corporation

public static int ToInt32 (string value, IFormatProvider provider);


Parameters:
 value: It is a string that contains the number to convert.
 provider: An object that supplies culture-specific formatting information.

You might also like