Дипломная работа студента 5 курса

Вид материалаДиплом
Подобный материал:
1   2   3   4   5   6   7

Registration.vb

Imports System.IO

Public Class WebForm2

Inherits System.Web.UI.Page


#Region " Web Form Designer Generated Code "


'This call is required by the Web Form Designer.

Private Sub InitializeComponent()


End Sub

Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

Protected WithEvents Label2 As System.Web.UI.WebControls.Label

Protected WithEvents Label3 As System.Web.UI.WebControls.Label

Protected WithEvents Label4 As System.Web.UI.WebControls.Label

Protected WithEvents Label5 As System.Web.UI.WebControls.Label

Protected WithEvents Label6 As System.Web.UI.WebControls.Label

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Protected WithEvents TxtRegName As System.Web.UI.WebControls.TextBox

Protected WithEvents TxtRegSoname As System.Web.UI.WebControls.TextBox

Protected WithEvents TxtRegEmail As System.Web.UI.WebControls.TextBox

Protected WithEvents TxtRegUsername As System.Web.UI.WebControls.TextBox

Protected WithEvents TxtRegPassword As System.Web.UI.WebControls.TextBox

Protected WithEvents TxtRegConfPassword As System.Web.UI.WebControls.TextBox

Protected WithEvents RegNameValidator As System.Web.UI.WebControls.RegularExpressionValidator

Protected WithEvents RegSonameValidator As System.Web.UI.WebControls.RegularExpressionValidator

Protected WithEvents RegEmailValidator As System.Web.UI.WebControls.RegularExpressionValidator

Protected WithEvents RegUsernameValidator As System.Web.UI.WebControls.RegularExpressionValidator

Protected WithEvents RegPasswordValidator As System.Web.UI.WebControls.RegularExpressionValidator

Protected WithEvents RequiredFieldValidator1 As System.Web.UI.WebControls.RequiredFieldValidator

Protected WithEvents RequiredFieldValidator2 As System.Web.UI.WebControls.RequiredFieldValidator

Protected WithEvents RequiredFieldValidator3 As System.Web.UI.WebControls.RequiredFieldValidator

Protected WithEvents RequiredFieldValidator4 As System.Web.UI.WebControls.RequiredFieldValidator

Protected WithEvents RequiredFieldValidator5 As System.Web.UI.WebControls.RequiredFieldValidator

Protected WithEvents RequiredFieldValidator6 As System.Web.UI.WebControls.RequiredFieldValidator

Protected WithEvents Label7 As System.Web.UI.WebControls.Label

Protected WithEvents Label8 As System.Web.UI.WebControls.Label

Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink


'NOTE: The following placeholder declaration is required by the Web Form Designer.

'Do not delete or move it.

Private designerPlaceholderDeclaration As System.Object


Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub


#End Region


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

Dim SessionSequencer2 As New SessionSequencer2

Label7.Text = ""

Label8.Text = ""

If IsPostBack Then

Page.Validate()

If Page.IsValid Then

If TxtRegPassword.Text = TxtRegConfPassword.Text Then

Dim str As String

Dim myConnString As String = "Database=information;Data Source=localhost;User Id=tol;Password=tol"

Dim mySelectQuery As String = "SELECT login FROM usersinfo WHERE login ='" & TxtRegUsername.Text & "'"

Dim myConnection As New MySqlConnection(myConnString)

Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)

myConnection.Open()

Dim myReader As MySqlDataReader

myReader = myCommand.ExecuteReader()

While (myReader.Read())

str = myReader.GetString(0)

End While

myReader.Close()

myConnection.Close()

If str Is Nothing Then

Dim Direct As String = System.Guid.NewGuid.ToString

Dim myInsertQuery As String = "INSERT INTO usersinfo (FierstName, LastName, Login, Password, Email, Directory, Admin) Values('" & TxtRegName.Text & "','" & TxtRegSoname.Text & "','" & TxtRegUsername.Text & "','" & TxtRegPassword.Text & "','" & TxtRegEmail.Text & "','" & Direct & "'," & "0)"

Dim myCommand1 As New MySqlCommand(myInsertQuery)

myCommand1.Connection = myConnection

myConnection.Open()

myCommand1.ExecuteNonQuery()

myCommand1.Connection.Close()

Dim di As DirectoryInfo

di = New DirectoryInfo("c:\inetpub\wwwroot\cluster\usersdirectory\" & Direct)

If Not di.Exists Then

di.Create()

End If

Session("txtregname") = Me.TxtRegName.Text

Session("txtregsoname") = Me.TxtRegSoname.Text

Call SessionSequencer2.NextPage()

Else : Label7.Text = "Это Имя пользователя уже используется. Введите пожалуста другое."

End If

Else : Label8.Text = "Пароли не совпадают. Введите их заново."

End If

End If

End If

End Sub

General.vb

Imports System.IO

Imports System.Diagnostics

Imports System.ComponentModel

Public Class WebForm7

Inherits System.Web.UI.Page


#Region " Web Form Designer Generated Code "


'This call is required by the Web Form Designer.

Private Sub InitializeComponent()


End Sub

Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink

Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Protected WithEvents Button3 As System.Web.UI.WebControls.Button

Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

Protected WithEvents Button4 As System.Web.UI.WebControls.Button

Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox

Protected WithEvents Button5 As System.Web.UI.WebControls.Button

Protected WithEvents Button6 As System.Web.UI.WebControls.Button

Protected WithEvents Button7 As System.Web.UI.WebControls.Button

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

Protected WithEvents Label2 As System.Web.UI.WebControls.Label

Protected WithEvents Label3 As System.Web.UI.WebControls.Label

Protected WithEvents Button2 As System.Web.UI.WebControls.Button

Protected WithEvents File1 As System.Web.UI.phplControls.phplInputFile

Protected WithEvents CheckBox1 As System.Web.UI.WebControls.CheckBox

Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox

Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList

Protected WithEvents TextBox4 As System.Web.UI.WebControls.TextBox

Protected WithEvents TextBox5 As System.Web.UI.WebControls.TextBox

Protected WithEvents Label4 As System.Web.UI.WebControls.Label

Protected WithEvents Label5 As System.Web.UI.WebControls.Label

Protected WithEvents Label6 As System.Web.UI.WebControls.Label

Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink


'NOTE: The following placeholder declaration is required by the Web Form Designer.

'Do not delete or move it.

Private designerPlaceholderDeclaration As System.Object


Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

'ListBox1.Items.Clear()

InitializeComponent()

End Sub


#End Region


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

Dim SessionSequencer As New SessionSequencer

Dim DirStr As String = Session("directory")

'ListBox1.Items.Clear()

TextBox1.Text = Session("compilefile")

TextBox2.Text = Session("runfile")

Dim di As New DirectoryInfo(Server.MapPath(".") & "\usersdirectory\" & DirStr)

Dim fi As FileInfo

For Each fi In di.GetFiles

Me.ListBox1.Items.Add(fi.Name)

Next

End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim filename As String = File1.PostedFile.FileName.Remove(0, File1.PostedFile.FileName.LastIndexOf("\") + 1)

If File1.PostedFile.ContentLength > 1048576 Or File1.PostedFile.FileName = "" Then

Label3.Text = "Файл не закачан: или файл больше положенного размера или введён неправильный путь."

Response.Redirect("general.aspx")

Else : File1.PostedFile.SaveAs("C:\Inetpub\wwwroot\cluster\usersdirectory\" & Session("directory") & "\" & filename)

Label3.Text = "Файл успешно закачан."

'ListBox1.Items.Clear()

Response.Redirect("general.aspx")

End If

'ListBox1.Items.Clear()

End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Response.Redirect("\cluster\usersdirectory" & "\" & Session("directory") & "\" & Session("selectfile"))

End Sub


Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

Session("selectfile") = Me.ListBox1.SelectedItem.Text

End Sub


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim fi As FileInfo

fi = New FileInfo("c:\inetpub\wwwroot\cluster\usersdirectory\" & Session("directory") & "\" & Session("selectfile"))

If fi.Exists Then

fi.Delete()

End If

Response.Redirect("general.aspx")

End Sub


Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

TextBox1.Text = Session("selectfile")

Session("compilefile") = TextBox1.Text

Response.Redirect("general.aspx")

End Sub


Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

TextBox2.Text = Session("selectfile")

Session("runfile") = TextBox2.Text

Response.Redirect("general.aspx")

End Sub


Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

If Me.TextBox1.Text = "" Then

Label1.Text = ""

Response.Redirect("general.aspx")

Else

Dim clfile As String = Session("compilefile")

Dim str As String = clfile & " mpich2.lib"

Dim _pi As New ProcessStartInfo("cl", str)

_pi.UseShellExecute = False

_pi.RedirectStandardInput = True

_pi.RedirectStandardOutput = True

_pi.WorkingDirectory = "C:\Inetpub\wwwroot\cluster\usersdirectory\" & Session("directory") & "\"

Dim _pr As Process = Process.Start(_pi)

Label1.Text = ""

Response.Redirect("general.aspx")

End If

End Sub


Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

Session("comp") = DropDownList1.SelectedValue

Session("process") = TextBox3.Text

Session("parametrs") = TextBox5.Text

Session("time") = TextBox4.Text

Session("email") = CheckBox1.Checked

If TextBox2.Text = "" Then

Label1.Text = ""

Response.Redirect("general.aspx")

Else

Dim myConnectionString As String = "Database=information;Data Source=localhost;User Id=tol;Password=tol"

Dim myConnection As New MySqlConnection(myConnectionString)

Dim myInsertQuery As String = "INSERT INTO files (comp, process, directory, filename, parametrs, queue, time, email) Values(" & Session("comp") & "," & Session("process") & ",'" & Session("directory") & "','" & Session("runfile") & "','" & Session("parametrs") & "'," & 0 & "," & Session("time") & "," & Session("email") & ")"

Dim myCommand As New MySqlCommand(myInsertQuery)

myCommand.Connection = myConnection

myConnection.Open()

myCommand.ExecuteNonQuery()

myCommand.Connection.Close()

Response.Redirect("general.aspx")

End If

End Sub

End Class


Admin.vb

Imports System.IO

Imports System.Diagnostics

Imports System.ComponentModel

Public Class WebForm10

Inherits System.Web.UI.Page


#Region " Web Form Designer Generated Code "


'This call is required by the Web Form Designer.

Private Sub InitializeComponent()


End Sub

Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink

Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Protected WithEvents Label3 As System.Web.UI.WebControls.Label

Protected WithEvents Button3 As System.Web.UI.WebControls.Button

Protected WithEvents Button2 As System.Web.UI.WebControls.Button

Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox

Protected WithEvents File1 As System.Web.UI.phplControls.phplInputFile

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox

Protected WithEvents Button4 As System.Web.UI.WebControls.Button

Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

Protected WithEvents Label2 As System.Web.UI.WebControls.Label

Protected WithEvents Label4 As System.Web.UI.WebControls.Label

Protected WithEvents DataGrid2 As System.Web.UI.WebControls.DataGrid


'NOTE: The following placeholder declaration is required by the Web Form Designer.

'Do not delete or move it.

Private designerPlaceholderDeclaration As System.Object


Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub


#End Region


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

Dim SessionSequencer As New SessionSequencer3

Dim DirStr As String = Session("directory")

'ListBox1.Items.Clear()

Dim di As New DirectoryInfo(Server.MapPath(".") & "\usersdirectory\" & DirStr)

Dim fi As FileInfo

For Each fi In di.GetFiles

Me.ListBox1.Items.Add(fi.Name)

Next

Dim mySelectQuery As String = "SELECT * FROM files"

Dim mySelectQuery2 As String = "SELECT * FROM computers"

Dim myConnection As New MySqlConnection("Database=information;Data Source=localhost;User Id=tol;Password=tol")

Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)

Dim myCommand2 As New MySqlCommand(mySelectQuery2, myConnection)

myConnection.Open()

Dim myReader As MySqlDataReader

myReader = myCommand.ExecuteReader()

DataGrid1.DataSource = myReader

DataGrid1.DataBind()

myReader.Close()

Dim myReader2 As MySqlDataReader

myReader2 = myCommand2.ExecuteReader()

DataGrid2.DataSource = myReader2

DataGrid2.DataBind()

myReader2.Close()

myConnection.Close()

End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim filename As String = File1.PostedFile.FileName.Remove(0, File1.PostedFile.FileName.LastIndexOf("\") + 1)

If File1.PostedFile.ContentLength > 1048576 Or File1.PostedFile.FileName = "" Then

Label3.Text = "Файл не закачан: или файл больше положенного размера или введён неправильный путь."

Response.Redirect("general.aspx")

Else : File1.PostedFile.SaveAs("C:\Inetpub\wwwroot\cluster\usersdirectory\" & Session("directory") & "\" & filename)

Label3.Text = "Файл успешно закачан."

'ListBox1.Items.Clear()

Response.Redirect("admin.aspx")

End If

End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Response.Redirect("\cluster\usersdirectory" & "\" & Session("directory") & "\" & Session("selectfile"))

End Sub


Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

Session("selectfile") = Me.ListBox1.SelectedItem.Text

End Sub


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim fi As FileInfo

fi = New FileInfo("c:\inetpub\wwwroot\cluster\usersdirectory\" & Session("directory") & "\" & Session("selectfile"))

If fi.Exists Then

fi.Delete()

End If

Response.Redirect("admin.aspx")

End Sub


Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

If TextBox1.Text = "" Then

Label1.Text = ""

Response.Redirect("admin.aspx")

Else

Dim _pi As New ProcessStartInfo(TextBox1.Text, TextBox2.Text)

_pi.UseShellExecute = False

_pi.RedirectStandardInput = True

_pi.RedirectStandardOutput = True

_pi.WorkingDirectory = "C:\Inetpub\wwwroot\cluster\usersdirectory\" & Session("directory") & "\"

Dim _pr As Process = Process.Start(_pi)

Label1.Text = ""

Response.Redirect("admin.aspx")

End If

End Sub

End Class