Разработка Интернет-системы "Электронная библиотека кафедры МОКС"
Описание проектирования электронной библиотеки для размещения в облаке документации кафедры. Планирование базы данных, структуры Web-системы и дизайна страниц. Разработка Интернет-системы в среде Visual Studio.NET. Разработка бизнес-логики системы.
Рубрика | Программирование, компьютеры и кибернетика |
Вид | курсовая работа |
Язык | русский |
Дата добавления | 23.08.2014 |
Размер файла | 2,5 M |
Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже
Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.
Список источников
1. Герберт Ш. Полный справочник по C#. Издательский дом "Вильямс" Москва, Санкт-Петербург, Киев 2010 - 744 с.
2. Мэтью Мак-Дональд, ASP.NET 2.0 с примерами на C# 2005 для профессионалов // Мэтью Мак-Дональд, Марио Шпушта Издательский дом "Вильямс" Москва, Санкт-Петербург, Киев 2008 - 1410 с.
3. Эндрю Троэлсен Язык программирования C# 2005 и платформа .NET 2.0 Издательский дом "Вильямс" Москва, Санкт-Петербург, Киев 2007 - 1155с.
4. Дэвид С. Программирование на ADO.NET 2.0 "Русская Редакция" Москва, Санкт-Петербруг, Нижний Новгород, Вроронеж, Новосибирск, Ростов на Дону, Екатеринбург, Самара, Киев, Харьков, Минск 2009 - 785 с.
5. Волощук Л.А., Методичні вказівки до самостійної роботи студента при виконанні курсового проекту з дисципліни "Мережні інформаційні технології" для студентів V курсу // Волощук Л.А Розновец О.И. Одесса 2013 - 44 с.
Приложение
Links.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Сводное описание для Links
/// </summary>
public class Links
{
public string[,] Link = new string[,]{
{"PageName","Link"} ,
{"User","~/pages/user/User.aspx"},
{"admin","~/pages/admin/HomeAdmin.aspx"},
{"AddFile","~/pages/user/AddFile.aspx"},
{"Select1","~/pages/user/Select1.aspx"},
{"Login","~/pages/user/Login.aspx"},
{"Home","~/pages/home.aspx"},
{"registration","~/pages/user/registration.aspx"},
{"SeeType","~/pages/user/Select1.aspx"},
{"SeeAuthor","~/pages/user/Select2.aspx"},
{"editAuthor","~/pages/admin/editAuthor.aspx"},
{"editDoc_Type","~/pages/admin/editDoc_Type.aspx"},
{"editPubHouse","~/pages/admin/editPubHouse.aspx"}
};
string fname = "~\\Files\\";
*/
public string R_fname()
{
return fname;
}
public string RetLinks(string n)
{
for (int i = 0; i < Link.GetLength(0); i++)
{
if (Link[i, 0] == n)
{
return Link[i,1];
}
}
return "";
}
public Links()
{
}
}
UserClass.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Сводное описание для UserClass
/// </summary>
public class UserClass
{
System.Data.SqlClient.SqlConnection conn =
New System.Data.SqlClient.SqlConnection("Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\library.mdf;Integrated Security=True");
public UserClass()
{
}
public UserClass(string s, string n)
{
login = s;
Pass = n;
}
public UserClass(string s)
{
string[] s1 = s.Split(':');
login = s1[0];
Pass = s1[1];
}
private string login = "";
private string pass = "";
public string con()
{
return conn.ConnectionString;
}
public string Login // the Login property
{
get
{
return login;
}
set
{
login = value;
}
}
public string Pass // the Pass property
{
get
{
return pass;
}
set
{
pass = value;
}
}
public string InitUser()
{
return "User";
}
public bool serchLogin( UserClass Us )
{
string t = "";
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("SELECT [login], [pass] FROM [dbo].[collaborator] where [login] =N'" + Us.Login + "' and pass = N'"+Us.Pass+"'" , conn);
conn.Open();
System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
t += reader.GetString(0) + ":" + reader.GetString(1); //Читаем данные из базы данных ... )
if (t == Us.Login+":"+Us.Pass) { conn.Close(); return true; }
}
}
conn.Close();
return false;
}
/// <summary>
/// Добавляет данные в таблицу
/// </summary>
/// <param name="Tab"> Имя Таблици </param>
/// <param name="TabCol"> Колонка </param>
/// <param name="Vall">Значение</param>
public string addInBase(string Tab, string TabCol,string Vall)
{
try
{
string[] DbC = TabCol.Split(','); string TabColl = "";
string[] DbV = Vall.Split(','); string TabVall = "";
for (int i = 0; i < DbC.Length; i++)
{
if (i != DbC.Length - 1) TabColl += " [" + DbC[i] + "],";
else TabColl += " [" + DbC[i] + "]";
}
for (int i = 0; i < DbV.Length; i++)
{
if (i != DbV.Length - 1) TabVall += "N'" + DbV[i] + "',";
else TabVall += "N'" + DbV[i] + "'";
}
System.Web.UI.WebControls.SqlDataSource sql = new System.Web.UI.WebControls.SqlDataSource();
sql.ConnectionString = conn.ConnectionString;
sql.InsertCommand = "INSERT INTO [" + Tab + "] (" + TabColl + ") values(" + TabVall + ")";
sql.Insert();
return "Данные успешно добавлены";
}
catch {
return "ошибка, проверьте данные";
}
}
/// <summary>
/// Метод поиска данных в таблице
/// </summary>
/// <param name="Tab"> Таблица в которой надо искать </param>
/// <param name="RetTabCol">Колонку которую надо вернуть</param>
/// <param name="SerchTabCol">Колонку в которой надо искать </param>
/// <param name="Vall">Значение которое надо искать</param>
/// <returns></returns>
public string SerchInTable(string Tab, string RetTabCol,string SerchTabCol, string Vall)
{
string t = "-1";
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("select "+RetTabCol+" from "+ Tab +" where (" + SerchTabCol + " = N'" + Vall + "')", conn);
conn.Open();
System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
try
{
t = "" + reader.GetSqlInt32(0); conn.Close(); return t; //Читаем данные из базы данных ...)
}
catch { return t; }
}
}
conn.Close();
return t;
}
/// <summary>
/// Возвращяет ответ команды S
/// </summary>
/// <param name="s">Команда (например Select * from Database)</param>
/// <param name="col">Количество колонок, значения которых надо вернуть</param>
/// <returns>string</returns>
public string MySelect(string s , int col)
{
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(s, conn);
conn.Open();
System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
string t = "";
if (reader.HasRows)
{
while (reader.Read())
{
for (int i = 0; i <= col; i++)
t += "" + reader.GetSqlInt32(i); //Читаем данные из базы данных ... )
}
}
conn.Close();
return t;
}
public string MySelect2(string s, int col)
{
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(s, conn);
conn.Open();
System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
string t = "";
if (reader.HasRows)
{
while (reader.Read())
{
for (int i = 0; i <= col; i++)
{ t += "" + reader.GetString(i); if (i != col) { t += " "; } } //Читаем данные из базы данных ... )
t += ";";
}
}
conn.Close();
return t;
}
}
4all.css
body {}
#zag
{
font-size:x-large;
color:red;
text-decoration:underline;
}
#Rgrad
{
text-align:right;
background: -webkit-radial-gradient(right, ellipse cover, rgba(30,87,153,1) 23%,rgba(38,95,159,0) 70%,rgba(125,185,232,0) 100%);
}
.Rgrad
{
text-align:right;
background: -webkit-radial-gradient(right, ellipse cover, rgba(30,87,153,1) 23%,rgba(38,95,159,0) 70%,rgba(125,185,232,0) 100%);
}
#Lgrad
{
text-align:left;
background: -webkit-radial-gradient(Left, ellipse cover, rgba(0,87,153,1) 23%,rgba(38,95,159,0) 70%,rgba(125,185,232,0) 100%);
}
.defaultText {
color: #CACACA;
background: -webkit-radial-gradient(center, ellipse cover, rgba(0,0,0,1) 0%,rgba(0,0,0,1) 50%,rgba(0,0,0,1) 59%,rgba(0,0,0,0.13) 95%,rgba(0,0,0,0.01) 100%);
}
.aria {
background-image:url(fon.jpg) ;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border: 1px solid #CACACA;
}
/*CheckBox*/
.css-checkbox
{
background: -webkit-radial-gradient(center, ellipse cover, rgba(0,0,0,1) 0%,rgba(0,0,0,1) 47%,rgba(0,0,0,0.92) 50%,rgba(0,0,0,0.01) 86%,rgba(0,0,0,0.01) 95%);
width: 20px;
height:20px;
border: none;
color:#fff;
border: 0px inset ThreeDFace ! important;
margin: 0 0 0 5px;
padding: 5px 4px 3px 5px;
color: #CACACA;
}
/*Button*/
.button
{
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(76,76,76,1)), color-stop(12%,rgba(89,89,89,1)), color-stop(25%,rgba(102,102,102,1)), color-stop(39%,rgba(71,71,71,1)), color-stop(50%,rgba(44,44,44,1)), color-stop(51%,rgba(0,0,0,1)), color-stop(60%,rgba(17,17,17,1)), color-stop(76%,rgba(43,43,43,1)), color-stop(91%,rgba(28,28,28,1)), color-stop(100%,rgba(19,19,19,1)));
border: 1px solid #CACACA;
color :#CACACA;
padding: 3px;
outline: none;
width:100px;
}
.button:active /**/
{
color : black;
box-shadow: 0px 0px 8px 4px #FFFFFC, inset 0px 0px 0px rgba(0, 0, 0, 1.2), 0px 5px 5px rgba( 0,0,0,1.15 );
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(128,128,128,1)), color-stop(12%,rgba(137,137,137,1)), color-stop(25%,rgba(146,146,146,1)), color-stop(39%,rgba(124,124,124,1)), color-stop(50%,rgba(105,105,105,1)), color-stop(51%,rgba(74,74,74,1)), color-stop(60%,rgba(86,86,86,1)), color-stop(76%,rgba(104,104,104,1)), color-stop(91%,rgba(94,94,94,1)), color-stop(100%,rgba(87,87,87,1)));
outline: none;
}
.button:hover {
box-shadow: 0px 0px 8px 4px #FFFFFC, inset 0px 0px 0px rgba(0, 0, 0, 1.2), 0px 5px 5px rgba( 0,0,0,1.15 );
outline: none;
width:120px;
}
/*TextBox*/
.inputs {
/*overflow:scroll;*/
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(76,76,76,1)), color-stop(12%,rgba(89,89,89,1)), color-stop(25%,rgba(102,102,102,1)), color-stop(39%,rgba(71,71,71,1)), color-stop(50%,rgba(44,44,44,1)), color-stop(51%,rgba(0,0,0,1)), color-stop(60%,rgba(17,17,17,1)), color-stop(76%,rgba(43,43,43,1)), color-stop(91%,rgba(28,28,28,1)), color-stop(100%,rgba(19,19,19,1)));
border: 1px solid #CACACA;
color :#CACACA;
width:200px;
padding: 3px;
}
.inputs:focus {
color : black;
box-shadow: 0px 0px 8px 4px #FFFFFC, inset 0px 0px 0px rgba(0, 0, 0, 1.2), 0px 5px 5px rgba( 0,0,0,1.15 );
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(128,128,128,1)), color-stop(12%,rgba(137,137,137,1)), color-stop(25%,rgba(146,146,146,1)), color-stop(39%,rgba(124,124,124,1)), color-stop(50%,rgba(105,105,105,1)), color-stop(51%,rgba(74,74,74,1)), color-stop(60%,rgba(86,86,86,1)), color-stop(76%,rgba(104,104,104,1)), color-stop(91%,rgba(94,94,94,1)), color-stop(100%,rgba(87,87,87,1)));
outline: none;
width:250px;
}
.inputs:hover
{
box-shadow: 0px 0px 8px 4px #FFFFFC, inset 0px 0px 0px rgba(0, 0, 0, 1.2), 0px 5px 5px rgba( 0,0,0,1.15 );
width:250px;
}
/*TextArea*/
#TextArea
{
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(76,76,76,1)), color-stop(12%,rgba(89,89,89,1)), color-stop(25%,rgba(102,102,102,1)), color-stop(39%,rgba(71,71,71,1)), color-stop(50%,rgba(44,44,44,1)), color-stop(51%,rgba(0,0,0,1)), color-stop(60%,rgba(17,17,17,1)), color-stop(76%,rgba(43,43,43,1)), color-stop(91%,rgba(28,28,28,1)), color-stop(100%,rgba(19,19,19,1)));
border: 1px solid #CACACA;
color :#CACACA;
padding: 3px;
width :200px;
}
#TextArea:focus
{
color : black;
box-shadow: 0px 0px 8px 4px #FFFFFC, inset 0px 0px 0px rgba(0, 0, 0, 1.2), 0px 5px 5px rgba( 0,0,0,1.15 );
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(128,128,128,1)), color-stop(12%,rgba(137,137,137,1)), color-stop(25%,rgba(146,146,146,1)), color-stop(39%,rgba(124,124,124,1)), color-stop(50%,rgba(105,105,105,1)), color-stop(51%,rgba(74,74,74,1)), color-stop(60%,rgba(86,86,86,1)), color-stop(76%,rgba(104,104,104,1)), color-stop(91%,rgba(94,94,94,1)), color-stop(100%,rgba(87,87,87,1)));
outline: none;
}
TextArea:hover
{
box-shadow: 0px 0px 8px 4px #FFFFFC, inset 0px 0px 0px rgba(0, 0, 0, 1.2), 0px 5px 5px rgba( 0,0,0,1.15 );
}
/*таблица*/
.mGrid {
background-color: #fff;
margin: 5px 0 10px 0;
border: solid 1px #525252;
border-collapse:collapse;
}
.mGrid td {
padding: 2px;
border: solid 1px #c1c1c1;
color: #717171;
}
.mGrid th {
padding: 4px 2px;
color: #fff;
background: #424242 url(../Css/grd_head.png) repeat-x top;
border-left: solid 1px #525252;
font-size: 0.9em;
}
.mGrid .alt { background: #fcfcfc url(../Css/grd_alt.png) repeat-x top; }
.mGrid .pgr { background: #424242 url(../Css/grd_pgr.png) repeat-x top; }
.mGrid .pgr table { margin: 5px 0; }
.mGrid .pgr td {
border-width: 0;
padding: 0 6px;
border-left: solid 1px #666;
font-weight: bold;
color: #fff;
line-height: 12px;
}
.mGrid .pgr a { color: #666; text-decoration: none; }
.mGrid .pgr a:hover { color: #000; text-decoration: none; }
.mGrid .head {
text-decoration:none;
text-decoration-color:white;
text-emphasis-color:white;
}
.mGrid .head {
}
editAuthor.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
UserClass Adm = new UserClass();
Links l = new Links();
protected void Button1_Click(object sender, EventArgs e)
{
try
{
SqlDataSource1.InsertCommand =
"INSERT INTO [author] ([First_Name], [Last_Name], [Patronomyc],[birthdate]) VALUES (N'"+First_Name.Text+"', N'"+Last_Name.Text+"', N'"+Patronomyc.Text+"',N'"+birthdate.Text+"')";
SqlDataSource1.Insert();
SqlDataSource1.DataBind();
GridView1.DataBind();
Err.Text = "";
}
catch (Exception ex) {
Err.Text = ex.Message;
};
}
protected void Button1_Click1(object sender, EventArgs e)
{
try
{
SqlDataSource1.DeleteCommand = "DELETE FROM [author] WHERE [id_author] =N'" + GridView1.Rows[GridView1.SelectedIndex].Cells[1].Text + "'";
SqlDataSource1.Delete();
SqlDataSource1.DataBind();
GridView1.DataBind();
Err.Text = "";
}
catch (Exception ex)
{
Err.Text = ex.Message;
};
}
protected void Back_Click(object sender, EventArgs e)
{
Response.Redirect("HomeAdmin.aspx" + "?Text=" + Adm.Login + ":" + Adm.Pass);
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<h1 class="Rgrad" > Редактирование таблици авторов</h1>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table border="0">
<tr>
<td>
<asp:GridView ID="GridView1" runat="server" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
HeaderStyle-CssClass="head" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowEditButton="True"
ShowSelectButton="True" ShowDeleteButton="false" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\library.mdf;Integrated Security=True"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [id_author], [First_Name], [Last_Name], [Patronomyc], [birthdate] FROM [author]"
InsertCommand="INSERT INTO [author] ([First_Name], [Last_Name], [Patronomyc],[birthdate]) VALUES (@First_Name, @Last_Name, @Patronomyc,@birthdate)"
UpdateCommand="UPDATE [author] SET [First_Name] = @First_Name, [Last_Name] = @Last_Name, [Patronomyc] = @Patronomyc,[birthdate]=@birthdate WHERE [id_author] = @id_author">
</asp:SqlDataSource>
<br>
<asp:Label ID="Err" CssClass="defaultText" runat="server"/>
</td>
<td>
<table>
<tr><td style="width: 300px; text-align: center">
<asp:Button ID="Button1" CssClass ="button" runat="server" Text="add" OnClick="Button1_Click" />
<asp:Button ID="Button2" CssClass="button" runat="server" Text="del" OnClick="Button1_Click1" />
</td>
</tr>
<tr>
<td style="width: 300px; text-align: center">
<asp:TextBox ID="First_Name" CssClass="inputs" placeholder="First_Name" runat="server"></asp:TextBox> </td>
</tr>
<tr>
<td style="width: 300px; text-align: center">
<asp:TextBox ID="Last_Name" CssClass="inputs" placeholder="Last_Name" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 300px; text-align: center">
<asp:TextBox ID="Patronomyc" CssClass="inputs" placeholder="Patronomyc" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 300px; text-align: center">
<asp:TextBox ID="birthdate" CssClass="inputs" placeholder="birthdate" runat="server"></asp:TextBox></td>
</tr>
<tr><td>
<asp:Button ID="Back" CssClass="button" Text="back" runat="server" OnClick="Back_Click" />
</td></tr>
</table>
</td>
</tr>
</table>
</asp:Content>
editDoc_Type.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
UserClass Adm = new UserClass();
Links L = new Links();
protected void Page_Load(object sender, EventArgs e)
{
try
{
Adm = new UserClass(Request.QueryString["Text"]);
}
catch
{
Response.Redirect(L.RetLinks("Login"));
}
}
protected void Add_Click(object sender, EventArgs e)
{
try
{
SqlDataSource1.InsertCommand =
"INSERT INTO [doc_Type] ([name]) VALUES (N'" + NAme.Text + "')";
SqlDataSource1.Insert();
SqlDataSource1.DataBind();
GridView1.DataBind();
Err.Text = "";
}
catch (Exception ex)
{
Err.Text = ex.Message;
};
}
protected void del_Click(object sender, EventArgs e)
{
try
{
SqlDataSource1.DeleteCommand = "DELETE FROM [doc_Type] WHERE [Id_doc_Type] =N'" + GridView1.Rows[GridView1.SelectedIndex].Cells[1].Text + "'";
SqlDataSource1.Delete();
SqlDataSource1.DataBind();
GridView1.DataBind();
Err.Text = "";
}
catch (Exception ex)
{
Err.Text = ex.Message;
};
}
protected void Back_Click(object sender, EventArgs e)
{
Response.Redirect("HomeAdmin.aspx" + "?Text=" + Adm.Login+ ":" + Adm.Pass);
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td>
<asp:GridView ID="GridView1" runat="server" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
HeaderStyle-CssClass="head" DataSourceID="SqlDataSource1"> <Columns>
<asp:CommandField ShowEditButton="True"
ShowSelectButton="True" ShowDeleteButton="false" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\library.mdf;Integrated Security=True"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [id_doc_Type] , [name] FROM [doc_Type]"
InsertCommand="INSERT INTO [doc_Type] ( [name]) VALUES ( @name)"
UpdateCommand="UPDATE [doc_Type] SET [name] = @name where [id_doc_Type] = @Id_doc_Type">
</asp:SqlDataSource>
<br>
<asp:Label ID="Err" CssClass="defaultText" runat="server" />
</td>
<td style="width: 300px; text-align: center">
<asp:Button ID="Add" CssClass="button" Text="Add" runat="server" OnClick="Add_Click" />
<asp:Button ID="del" CssClass="button" Text="del" runat="server" OnClick="del_Click" />
<div>
<asp:TextBox ID="NAme" CssClass="inputs" placeholder="Name" runat="server"></asp:TextBox>
</div>
<div>
<asp:Button ID="Back" CssClass="button" Text="back" runat="server" OnClick="Back_Click" /> </div>
</td>
</tr>
</table>
</asp:Content>
editPubHouse.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
UserClass Adm = new UserClass();
Links L = new Links();
protected void Page_Load(object sender, EventArgs e)
{
try
{
Adm = new UserClass(Request.QueryString["Text"]);
}
catch
{
Response.Redirect(L.RetLinks("Login"));
}
}
protected void Add_Click(object sender, EventArgs e)
{
try
{
SqlDataSource1.InsertCommand =
"INSERT INTO [PubHouse] ([name]) VALUES (N'" + NAme.Text + "')";
SqlDataSource1.Insert();
SqlDataSource1.DataBind();
GridView1.DataBind();
Err.Text = "";
}
catch (Exception ex)
{
Err.Text = ex.Message;
};
}
protected void del_Click(object sender, EventArgs e)
{
try
{
SqlDataSource1.DeleteCommand = "DELETE FROM [PubHouse] WHERE [id_PubHouse] =N'" + GridView1.Rows[GridView1.SelectedIndex].Cells[1].Text + "'";
SqlDataSource1.Delete();
SqlDataSource1.DataBind();
GridView1.DataBind();
Err.Text = "";
}
catch (Exception ex)
{
Err.Text = ex.Message;
};
}
protected void Back_Click(object sender, EventArgs e)
{
Response.Redirect("HomeAdmin.aspx" + "?Text=" + Adm.Login+ ":" + Adm.Pass);
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td>
<asp:GridView ID="GridView1" runat="server" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
HeaderStyle-CssClass="head" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowEditButton="True"
ShowSelectButton="True" ShowDeleteButton="false" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:libraryConnectionString1 %>"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT * FROM [PubHouse]"
InsertCommand="INSERT INTO INTO [PubHouse] ([id_PubHouse], [name]) VALUES (@id_PubHouse, @name)"
UpdateCommand="UPDATE [PubHouse] SET [name] = @name where [id_PubHouse] = @id_PubHouse"></asp:SqlDataSource>
<br>
<asp:Label ID="Err" CssClass="defaultText" runat="server" />
</td>
<td style="width: 300px; text-align: center">
<asp:Button ID="Add" CssClass="button" text="Add" runat="server" OnClick="Add_Click" />
<asp:Button ID="del" CssClass="button" text="del" runat="server" OnClick="del_Click" />
<div>
<asp:TextBox ID="NAme" CssClass="inputs" placeholder="Name" runat="server" ></asp:TextBox>
</div>
<div>
<asp:Button ID="Back" CssClass="button" Text="back" runat="server" OnClick="Back_Click" /></div>
</td>
</tr>
</table>
</asp:Content>
AddFile.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
UserClass Us;
Links l = new Links();
void Page_load()
{
try
{
Us = new UserClass(Request.QueryString["Text"]);
}
catch
{
Response.Redirect("Login.aspx");
}
SqlDataSource1.SelectCommand = "select collaborator.login, status.date_status, documents.name, documents.Adress FROM collaborator INNER JOIN status ON collaborator.id_collaborator = status.id_collaborator INNER JOIN documents ON status.id_document = documents.Id_documents where collaborator.id_collaborator =N'" + Us.SerchInTable("collaborator", "id_collaborator", "login", Us.Login) + "'";
SqlDataSource1.DataBind();
GridView1.DataBind();
}
public string ConvertTodata(string s)
{
string[] data = s.Split('.','-',';',':');
return data[2]+"-"+data[1]+"-"+data[0];
}
protected void Button1_Click(object sender, EventArgs e)
{
if (PowerCB.Checked == true)
{
ChecZhanr.Checked = true;
CheckAuthor.Checked = true;
CheckPHouse.Checked = true;
}
string command = "";
string Phouse = "", zhan = "", Au = "", Strdate = ""; int err = 0;
string folderName =l.R_fname() , fileName = "";
if (FileUpload1.FileName.Length != 0)
{
try
{
fileName = FileUpload1.FileName;
FileUpload1.SaveAs(Server.MapPath(folderName) + fileName);
}
catch (Exception e1)
{ err++; LabFile.Text = "" + e1.Message; LabFile.Visible = true; }
if (TbName.Text == "" && TbName.Text == "Поле ввода не должно быть пустым") { TbName.Text = "Поле ввода не должно быть пустым"; err++; }
if (TbDate.Text != "")
{
Strdate = ConvertTodata(TbDate.Text);
}
else
{
LabDate.Text = "Поле ввода не должно быть пустым"; LabDate.Visible = true;
}
if (TbZhanr.Text != "")
{
zhan = "" + Us.SerchInTable("doc_Type", "id_doc_Type", "name", TbZhanr.Text);
if (zhan == "-1")
{
err++;
LabZhanr.Text = " нету в базе данных,добавить? "; LabZhanr.Visible = true; ChecZhanr.Visible = true;
}
}
else { err++; LabZhanr.Text = "Поле ввода не должно быть пустым"; LabZhanr.Visible = true; }
if (TbPHouse.Text != "")
{
Phouse = "" + Us.SerchInTable("PubHouse", "Id_PubHouse", "name", TbPHouse.Text);
if (Phouse == "-1")
{
err++;
LabPHouse.Text = " нету в базе данных,добавить? "; LabPHouse.Visible = true; CheckPHouse.Visible = true;
}
}
else { err++; LabPHouse.Text = "Поле ввода не должно быть пустым"; LabPHouse.Visible = true; }
if (TbAuthor.Text != "")
{
string[] Author = TbAuthor.Text.Split(' ');
if (Author.Length == 3)
{
Au = Us.MySelect("Select a.id_author from author a where a.First_Name = N'" + Author[0] + "' and a.Last_Name = N'" + Author[1] + "' and Patronomyc = N'" + Author[2] + "'", 0);
}
else
{
Au = Us.MySelect("Select a.id_author from author a where a.First_Name = N'" + Author[0] + "' and a.Last_Name = N'" + Author[1] + "'", 0);
}
if (Au == "")
{
err++;
LabAuthor.Text = " нету в базе данных,добавить? "; LabAuthor.Visible = true; CheckAuthor.Visible = true;
}
}
else { err++; LabAuthor.Text = "Поле ввода не должно быть пустым"; LabAuthor.Visible = true; }
if (CheckPHouse.Checked == true)
{
err--;
LabPHouse.Visible = true;
LabPHouse.Text = Us.addInBase("PubHouse", "name", TbPHouse.Text);
Phouse = "" + Us.SerchInTable("PubHouse", "Id_PubHouse", "name", TbPHouse.Text);
};
if (CheckAuthor.Checked == true)
{
err--;
string[] Author = TbAuthor.Text.Split(' ');
if (Author.Length == 3)
{
LabAuthor.Visible = true;
LabAuthor.Text = Us.addInBase("author", "First_Name,Last_Name,Patronomyc", Author[0] + "," + Author[1] + "," + Author[2]);
Au = Us.MySelect("Select a.id_author from author a where a.First_Name = N'" + Author[0] + "' and a.Last_Name = N'" + Author[1] + "' and Patronomyc = N'" + Author[2] + "'", 0);
}
else
{
LabAuthor.Visible = true;
LabAuthor.Text = Us.addInBase("author", "First_Name,Last_Name", Author[0] + "," + Author[1]);
Au = Us.MySelect("Select a.id_author from author a where a.First_Name = N'" + Author[0] + "' and a.Last_Name = N'" + Author[1] + "'", 0);
}
};
if (ChecZhanr.Checked == true)
{
err--; LabZhanr.Visible = true; LabZhanr.Text = Us.addInBase("doc_Type", "name", TbZhanr.Text); zhan = "" + Us.SerchInTable("doc_Type", "id_doc_Type", "name", TbZhanr.Text);
};
if (err == 0)
{
command = "documents:" + Us.addInBase("documents", "name,Id_doc_Type,date,PubHouse,Adress", TbName.Text + "," + zhan + "," + Strdate + "," + Phouse + "," + folderName + fileName) + "\r\n"; //Запись данных об документе ...
string id_doc = Us.MySelect("Select Id_documents from documents d where d.name = N'" + TbName.Text + "' and d.Id_doc_Type = N'" + zhan + "' and d.date=N'" + Strdate + "' ", 0);
command += "written:" + Us.addInBase("written", "id_document,id_author,w_author", id_doc + "," + Au + ",1") + "\r\n";//Запись информации об авторе, Всегда будет главным автором
command += "Status:" + Us.addInBase("status", "id_document,id_collaborator,transaction_status,date_status", id_doc + "," + Us.SerchInTable("collaborator", "id_collaborator", "login", Us.Login) + ",1," + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day) + "\r\n";
Out.Visible = true; Out.Text = command;
}
GridView1.DataBind();
ChecZhanr.Checked = false;
CheckAuthor.Checked = false;
CheckPHouse.Checked = false;
}
}
protected void Back_Click(object sender, EventArgs e)
{
Response.Redirect("User.aspx" + "?Text=" + Us.Login + ":" + Us.Pass); // работает!
}
protected void TestList_SelectedIndexChanged(object sender, EventArgs e)
{
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<h2 id="Rgrad">Добавление файла</h2>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table border="0">
<tr>
<td style="width:260px ; text-align: center">
<asp:TextBox ID="TbName" CssClass="inputs" placeholder="Введите название книги" runat="server"></asp:TextBox>
</td>
<td> <asp:Button ID="Button1" CssClass="button" runat="server" Text="Add" OnClick="Button1_Click" />
<asp:CheckBox ID="PowerCB" Visible="true" CssClass="css-checkbox" runat="server" Text="Усилено" AutoPostBack="True" />
</td>
<td rowspan ="8">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\library.mdf;Integrated Security=True"
ProviderName="System.Data.SqlClient"
SelectCommand="select distinct c.login,d.name, t.name, d.Adress from collaborator c,documents d,status s, doc_Type t where d.id_doc_Type= t.Id_doc_Type "></asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" PagerStyle-CssClass="pgr"
CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
HeaderStyle-CssClass="head" DataSourceID="SqlDataSource1"></asp:GridView>
</td>
</tr>
<tr>
<td style="text-align: center">
<asp:TextBox ID="TbZhanr" CssClass="inputs" placeholder="Введите Тип файла " runat="server"> </asp:TextBox>
</td>
<td style="text-align: center">
<asp:Label ID="LabZhanr" Visible="false" CssClass="defaultText" runat="server" Text=" "> нету в базе данных,добавить? </asp:Label>
<asp:CheckBox ID="ChecZhanr" Visible="false" CssClass="css-checkbox" runat="server" Text="да" AutoPostBack="True" />
</td>
</tr>
<tr>
<td style="text-align: center">
<asp:TextBox ID="TbDate" CssClass="inputs" placeholder="Введите дату издания DD.MM.YYYY " runat="server"></asp:TextBox>
<asp:Label ID="LabDate" Visible="false" CssClass="defaultText" runat="server" Text=" "> </asp:Label>
</td>
</tr>
<tr>
<td style="text-align: center">
<asp:TextBox ID="TbPHouse" CssClass="inputs" placeholder="Введите издание" runat="server"></asp:TextBox>
</td>
<td>
<asp:Label ID="LabPHouse" Visible="false" CssClass="defaultText" runat="server" Text=" "> нету в базе данных,добавить? </asp:Label>
<asp:CheckBox ID="CheckPHouse" Visible="false" CssClass="css-checkbox" runat="server" Text="да" AutoPostBack="True" />
</td>
</tr>
<tr>
<td style="text-align: center">
<asp:TextBox ID="TbAuthor" CssClass="inputs" placeholder="Введите автора пример (Александр Сергеевич Пушкин)" runat="server"></asp:TextBox>
</td>
<td>
<asp:Label ID="LabAuthor" Visible="false" CssClass="defaultText" runat="server" Text=" "> нету в базе данных,добавить? </asp:Label>
<asp:CheckBox ID="CheckAuthor" Visible="false" CssClass="css-checkbox" runat="server" Text="да" AutoPostBack="True" />
</td>
</tr>
<tr>
<td style="text-align: center">
<asp:FileUpload ID="FileUpload1" runat="server" /> <br />
<asp:Label ID="LabFile" Visible="false" CssClass="defaultText" runat="server" Text=" "> нету в базе данных,добавить? </asp:Label>
</td>
<td>
<%--<asp:TextBox ID="Out" CssClass="inputs" runat="server" Visible="false" />--%>
<asp:TextBox ID="Out" Visible="false" Width="90%" CssClass="inputs" runat="server" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Back" CssClass="button" runat="server" Text="Назад" OnClick="Back_Click" />
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</asp:Content>
Login.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/GuestMasterPage.master" %>
<script runat="server">
Links L = new Links();
UserClass Us = new UserClass();
int err = 0;
protected void Page_Load(object sender, EventArgs e)
{
Us = new UserClass();
}
protected void LoginBt_Click(object sender, EventArgs e)
{
Us = new UserClass(Login.Text, Pass.Text);
if (Us.serchLogin(Us))
{
Response.Redirect(L.RetLinks("User") + "?Text=" + Login.Text + ":" + Pass.Text);
}
else { Label1.Visible = true; Label1.Text = "Логин или пароль неверный. "; err++;
Label1.Text += "Забыли пароль?"; CheckBox1.Visible = true; Cb1Text.Visible = true; }
if (CheckBox1.Checked == true) { HelpTB.Visible = true; HelpTB.Text = "" + Us.SerchInTable("collaborator", "pass", "login", Login.Text); }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<h2 id="Rgrad">Вход на сайт</h2>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width: 100%;">
<tr >
<td style="width: 300px;">
<asp:TextBox ID="Login" CssClass="inputs" runat="server"/>
</td>
<td>
<asp:Button ID="LoginBt" CssClass="button" runat="server" Text="Вход" OnClick="LoginBt_Click" />
</td>
</tr>
<tr>
<td style="width: 300px;">
<asp:TextBox ID="Pass" TextMode="Password" CssClass="inputs" runat="server"/>
</td>
<td>
<asp:Button ID="Button1" Visible="false" CssClass="button" runat="server" Text="Забыл" />
</td>
</tr>
<tr>
<td width ="250">
<asp:Label ID="Label1" CssClass="defaultText" runat="server" Visible="false" Text=""></asp:Label>
<asp:CheckBox ID="CheckBox1" Visible="false" CssClass="css-checkbox lrg" runat="server" AutoPostBack="True" />
<asp:label for="CheckBox1" ID="Cb1Text" style="color: #CACACA;" Visible="false" runat="server" >ДА</asp:label>
</td>
<td>
<asp:TextBox ID="HelpTB" CssClass="inputs" Visible="false" runat="server" ></asp:TextBox>
</td>
</tr>
</table>
</asp:Content>
registration.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/GuestMasterPage.master" %>
<script runat="server">
public Links Link = new Links();
void Page_Load(Object sender, EventArgs e)
{
}
protected void Bt1_Click(object sender, EventArgs e)
{
string s = "INSERT INTO [dbo].[collaborator] ( [First_Name], [Last_Name], [Patronomyc], [login], [pass], [adress], [Home_tel], [Mob_tel]) VALUES (N'" + TextBox1.Text + "',N'" + TextBox2.Text + "',N'" + TextBox3.Text + "',N'" + TextBox4.Text + "',N'" + TextBox5.Text + "',N'" + TextBox6.Text + "',N'" + TextBox7.Text + "',N'" + TextBox8.Text + "')";
try
{
SqlDataSource1.InsertCommand = s;
SqlDataSource1.Insert();
DebText.Visible = true;
DebText.TextMode = TextBoxMode.SingleLine;
DebText.Text = "Пользователь зарегистрирован";
}
catch (Exception ex)
{
DebText.Visible = true;
DebText.Text=s+"\r\n"+ex;
}
}
protected void TextBox5_TextChanged(object sender, EventArgs e)
{
}
protected void Back(object sender, EventArgs e)
{
Response.Redirect(Link.RetLinks("Home"));
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<title>reg</title>
<h2 id="Rgrad" >Регистрация нового сотрудника</h2>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<%-- <div class="aria">--%>
<table border="0" style="width: 100%;">
<tr >
<td wight="300px" style=" width: 300px; text-align: center">
<asp:TextBox ID="TextBox1" CssClass="inputs" placeholder="Введите имя" runat="server"></asp:TextBox>
</td>
<td >
<table>
<tr>
<td style="width: 120px;text-align:center">
<asp:Button ID="Bt1" CssClass="button" runat="server" text="регистрация" OnClientClick="" OnClick="Bt1_Click"/>
</td>
<td style="width: 120px; text-align: center">
<asp:Button ID="Button1" CssClass="button" runat="server" Text="Назад" OnClientClick="" OnClick="Back" />
</td>
</tr>
</table>
</td>
<td>
</td></tr><tr><td>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\library.mdf;Integrated Security=True"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [First_Name], [Last_Name], [Patronomyc], [login], [pass], [adress], [Home_tel], [Mob_tel], [id_collaborator] FROM [collaborator]"
DeleteCommand="DELETE FROM [collaborator] WHERE [id_collaborator] = @id_collaborator"
InsertCommand="INSERT INTO [collaborator] ([First_Name], [Last_Name], [Patronomyc], [login], [pass], [adress], [Home_tel], [Mob_tel]) VALUES (@First_Name, @Last_Name, @Patronomyc, @login, @pass, @adress, @Home_tel, @Mob_tel)"
UpdateCommand="UPDATE [collaborator] SET [First_Name] = @First_Name, [Last_Name] = @Last_Name, [Patronomyc] = @Patronomyc, [login] = @login, [pass] = @pass, [adress] = @adress, [Home_tel] = @Home_tel, [Mob_tel] = @Mob_tel WHERE [id_collaborator] = @id_collaborator">
<DeleteParameters>
<asp:Parameter Name="id_collaborator" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="First_Name" Type="String" />
<asp:Parameter Name="Last_Name" Type="String" />
<asp:Parameter Name="Patronomyc" Type="String" />
<asp:Parameter Name="login" Type="String" />
<asp:Parameter Name="pass" Type="String" />
<asp:Parameter Name="adress" Type="String" />
<asp:Parameter Name="Home_tel" Type="String" />
<asp:Parameter Name="Mob_tel" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="First_Name" Type="String" />
<asp:Parameter Name="Last_Name" Type="String" />
<asp:Parameter Name="Patronomyc" Type="String" />
<asp:Parameter Name="login" Type="String" />
<asp:Parameter Name="pass" Type="String" />
<asp:Parameter Name="adress" Type="String" />
<asp:Parameter Name="Home_tel" Type="String" />
<asp:Parameter Name="Mob_tel" Type="String" />
<asp:Parameter Name="id_collaborator" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</td>
<td rowspan="">
<asp:GridView ID="GridView1" Visible="false" runat="server" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id_collaborator" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="First_Name" HeaderText="First_Name" SortExpression="First_Name" />
<asp:BoundField DataField="Last_Name" HeaderText="Last_Name" SortExpression="Last_Name" />
<asp:BoundField DataField="Patronomyc" HeaderText="Patronomyc" SortExpression="Patronomyc" />
<asp:BoundField DataField="login" HeaderText="login" SortExpression="login" />
<asp:BoundField DataField="pass" HeaderText="pass" SortExpression="pass" />
<asp:BoundField DataField="adress" HeaderText="adress" SortExpression="adress" />
<asp:BoundField DataField="Home_tel" HeaderText="Home_tel" SortExpression="Home_tel" />
<asp:BoundField DataField="Mob_tel" HeaderText="Mob_tel" SortExpression="Mob_tel" />
<asp:BoundField DataField="id_collaborator" HeaderText="id_collaborator" InsertVisible="False" ReadOnly="True" SortExpression="id_collaborator" />
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td wight="300px" style="width: 300px; text-align: center">
<asp:TextBox ID="TextBox2" CssClass="inputs" placeholder="Введите фамилию" runat="server"></asp:TextBox>
</td >
<td>
<asp:TextBox ID="DebText" Visible="false" Width="90%" CssClass="inputs" runat="server" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
<tr>
<td wight="300px" style="width: 300px; text-align: center">
<asp:TextBox ID="TextBox3" CssClass="inputs" placeholder="Введити отчество" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td wight="300px" style="width: 300px; text-align: center">
<asp:TextBox ID="TextBox4" CssClass="inputs" placeholder="Придумайте логин " runat="server"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td wight="300px" style="width: 300px; text-align: center">
<asp:TextBox ID="TextBox5" CssClass="inputs" placeholder="Придумайте пароль" TextMode="Password" runat="server" OnTextChanged="TextBox5_TextChanged"></asp:TextBox>
</td>
</tr>
<tr>
<td wight="300px" style="width: 300px; text-align: center">
<asp:TextBox ID="TextBox6" CssClass="inputs" placeholder="Введите электроный адрес" runat="server"></asp:TextBox>
</td >
</tr>
<tr>
<td wight="300px" style="width: 300px; text-align: center">
<asp:TextBox ID="TextBox7" CssClass="inputs" placeholder="Введите домашний теефон(если есть)" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td wight="300px" style="width: 300px ;text-align:center">
<asp:TextBox ID="TextBox8" CssClass="inputs" placeholder="Введите мобильный (если есть)" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan ="3">
</td>
</tr>
</table>
<%-- </div>--%>
</asp:Content>
Select1.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
}
protected void type_Init(object sender, EventArgs e)
{
}
protected void показать_Click(object sender, EventArgs e)
{
string dateFrom ="";//2013-01-16
dateFrom =""+otYear.Text+"-"+otMonth.Text+"-"+otDay.Text;
string dateTo="";//2013-01-16
dateTo=""+doYear.Text+"-"+doMonth.Text+"-"+doDay.Text;
SqlDataSource s = new SqlDataSource();
s.SelectCommand = "select d.name,dt.name,s.date_status ,d.date,d.PubHouse,d.Adress from documents d , doc_Type dt ,status s where d.id_doc_Type = dt.Id_doc_Type and s.id_document=d.Id_documents and s.date_status > N'" + dateFrom + "' and s.date_status < N'" + dateTo + "' and d.id_doc_Type=(select t.Id_doc_Type from doc_Type t where t.name=N'" + type .SelectedItem.Text+ "')";
s.ConnectionString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\library.mdf;Integrated Security=True";
GridView1.DataSource = s;
GridView1.DataBind();
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr><td>
<asp:GridView ID="GridView1" runat="server" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
HeaderStyle-CssClass="head" DataSourceID=""></asp:GridView>
</td>
<td style="text-align:center" >
<asp:Button ID="показать" CssClass="inputs" Width="100" runat="server" Text="Показать" OnClick="показать_Click" />
<asp:DropDownList CssClass="inputs" DataSourceID="SqlDataSource2" DataValueField="name" runat="server" ID="type" OnInit="type_Init"></asp:DropDownList>
<br />
<table>
<tr>
<td>
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="otYear">2000</asp:TextBox>
</td>
<td> <p class="defaultText"> Год </p> </td>
<td>
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="doYear">2100</asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:TextBox CssClass="inputs" runat="server" Width="100px" ID="otMonth">01</asp:TextBox>
</td>
<td> <p class="defaultText">Месяц</p> </td>
<td>
<asp:TextBox CssClass="inputs" runat="server" Width="100px" ID="doMonth">12</asp:TextBox> </td>
</tr>
<tr>
<td>
<asp:TextBox CssClass="inputs" runat="server" Width="100px" ID="otDay">01</asp:TextBox>
</td>
<td> <p class="defaultText">день</p> </td>
<td>
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="doDay">30</asp:TextBox> </td>
</tr>
</table>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:libraryConnectionString1 %>" SelectCommand="SELECT name FROM [doc_Type]"></asp:SqlDataSource>
</td>
</tr>
</table>
</asp:Content>
Select2.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
string str = "";
void Page_load()
{
if (author.SelectedIndex != -1)
{
str = author.SelectedItem.Text + ' ' + author.SelectedIndex;
}
UserClass Us = new UserClass();
string t = Us.MySelect2("SELECT [First_Name], [Last_Name] FROM [author]", 1);
string[] t2 = t.Split(';');
author.Items.Clear();
for (int i = 0; i < t2.Length; i++)
author.Items.Add(t2[i]);
}
protected void Button1_Click(object sender, EventArgs e)
{
string[] AUthor = str.Split(' ');
string LastName = AUthor[1];
string FirstName = AUthor[0];
int id = Convert.ToInt32(AUthor[2]);
author.SelectedIndex = id;
SqlDataSource s = new SqlDataSource();
s.ConnectionString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\library.mdf;Integrated Security=True";
string dateFrom = "" + otYear.Text + "-" + otMonth.Text + "-" + otDay.Text;
string dateTo = "" + doYear.Text + "-" + doMonth.Text + "-" + doDay.Text;
string comm = "select d.Id_documents, d.name , a.First_Name,a.Last_Name,s.date_status from written w, status s , author a, documents d where w.id_author=a.id_author and w.id_author =(select a.id_author from author a where a.Last_Name=N'" + LastName + "' and a.First_Name=N'" + FirstName + "') and w.id_document=d.Id_documents and s.id_document=d.Id_documents and s.date_status > N'" + dateFrom + "' and s.date_status < N'" + dateTo + "'";
s.SelectCommand = comm;
GridView1.DataSource = s;
GridView1.DataBind();
}
protected void author_SelectedIndexChanged(object sender, EventArgs e)
{
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr><td>
<asp:GridView ID="GridView1" runat="server" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
HeaderStyle-CssClass="head" DataSourceID="">
</asp:GridView>
<td>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:libraryConnectionString1 %>" SelectCommand="SELECT [First_Name], [Last_Name] FROM [author]"></asp:SqlDataSource>
<asp:DropDownList CssClass="inputs" Width="200" runat="server" ID="author" OnSelectedIndexChanged="author_SelectedIndexChanged"> </asp:DropDownList>
<asp:Button ID="Button1" CssClass="button" runat="server" Text="Показать" OnClick="Button1_Click" />
<table>
<tr><td style=" text-align:center">От</td><td></td><td style="text-align:center">до</td></tr>
<tr>
<td >
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="otYear">2000</asp:TextBox>
</td>
<td>
<p class="defaultText">Год </p>
</td>
<td>
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="doYear">2100</asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="otMonth">01</asp:TextBox>
</td>
<td>
<p class="defaultText">Месяц</p>
</td>
<td>
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="doMonth">12</asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="otDay">01</asp:TextBox>
</td>
<td>
<p class="defaultText">день</p>
</td>
<td>
<asp:TextBox CssClass="inputs" Width="100px" runat="server" ID="doDay">30</asp:TextBox>
</td>
</tr>
<asp:TextBox Visible="false" ID="temp" runat="server"></asp:TextBox>
</table>
</td>
</td></tr>
</table>
</asp:Content>
User.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
private UserClass User;
public Links L = new Links();
protected void Page_Load(object sender, EventArgs e)
{
try
{
User = new UserClass(Request.QueryString["Text"]);
L1.Text = User.Login;
}
catch
{
Response.Redirect(L.RetLinks("Login")+"?Text= : ");
}
}
void Myinit()
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
Response.Redirect( L.RetLinks("AddFile") + "?Text=" + User.Login + ":" + User.Pass);
}
protected void Button1_Click2(object sender, EventArgs e)
{
Response.Redirect(L.RetLinks("Select1") + "?Text=" + User.Login + ":" + User.Pass);
}
protected void go_Click(object sender, EventArgs e)
{
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<h2 id="Rgrad" >Приветствуем вас <asp:Label ID="L1" runat="server"></asp:Label> </h2>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td>
<asp:TextBox ID="serch" CssClass="inputs" placeholder="что ищем? " runat="server" ></asp:TextBox> <asp:Button runat="server" ID="go" CssClass="button" Text="Искать" OnClick="go_Click" />
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
HeaderStyle-CssClass="head" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="Имя" HeaderText="Имя" SortExpression="Имя" />
<asp:BoundField DataField="фамилия" HeaderText="фамилия" SortExpression="фамилия" />
<asp:BoundField DataField="отчество" HeaderText="отчество" SortExpression="отчество" />
<asp:BoundField DataField="название_файла" HeaderText="название_файла" SortExpression="название_файла" />
<asp:BoundField DataField="тип_файла" HeaderText="тип_файла" SortExpression="тип_файла" />
<asp:BoundField DataField="Издательство" HeaderText="Издательство" SortExpression="Издательство" />
<asp:BoundField DataField="Имя_автора" HeaderText="Имя_автора" SortExpression="Имя_автора" />
<asp:BoundField DataField="фамилия_автора" HeaderText="фамилия_автора" SortExpression="фамилия_автора" />
<asp:BoundField DataField="отчество_автора" HeaderText="отчество_автора" SortExpression="отчество_автора" />
<asp:BoundField DataField="дата_публикации" HeaderText="дата_публикации" SortExpression="дата_публикации" />
<asp:BoundField DataField="дата_загрузки" HeaderText="дата_загрузки" SortExpression="дата_загрузки" />
<asp:BoundField DataField="Adress" HeaderText="Adress" SortExpression="Adress" Visible="false" />
<asp:TemplateField HeaderText="Adress">
<ItemTemplate>
<asp:HyperLink ID="hlID" runat="server" Text='Скачать' NavigateUrl='<%# Eval("Adress") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:libraryConnectionString1 %>"
SelectCommand="
SELECT
collaborator.First_Name AS Имя,
collaborator.Last_Name AS фамилия,
collaborator.Patronomyc AS отчество,
documents.name AS название_файла,
doc_Type.name AS тип_файла,
PubHouse.name AS Издательство,
author.First_Name AS Имя_автора,
author.Last_Name AS фамилия_автора,
author.Patronomyc AS отчество_автора,
documents.date AS дата_публикации,
status.date_status AS дата_загрузки,
documents.Adress
FROM status INNER JOIN collaborator ON status.id_collaborator = collaborator.id_collaborator INNER JOIN documents ON status.id_document = documents.Id_documents INNER JOIN doc_Type ON documents.id_doc_Type = doc_Type.Id_doc_Type INNER JOIN PubHouse ON documents.PubHouse = PubHouse.id_PubHouse INNER JOIN written ON documents.Id_documents = written.id_document INNER JOIN author ON written.id_author = author.id_author
Подобные документы
Определение понятия и общее описание базы данных как упорядоченной информационной системы на носителе информации. Описание предметной области и разработка приложения базы данных, содержащей информацию о расписании занятий, для преподавателей кафедры.
курсовая работа [1,3 M], добавлен 08.08.2012Описание состава реляционной базы данных как системы связанной информации, сохраняемой в двумерных таблицах. Основные функции CMS и изучение структуры сервера MySQL. Разработка системы выборок данных по товарам для интернет-магазина, таблицы покупателей.
курсовая работа [2,0 M], добавлен 21.04.2015Разработка программного средства в среде MS Access, содержащего функции электронной библиотеки и которое обеспечивает удобное добавление, удаление, редактирование данных. Руководство пользователя и проверка правильности работы разработанной системы.
курсовая работа [4,0 M], добавлен 23.02.2011Определение программного модуля. Принципы использования dll-библиотеки. Преимущества и недостатки использования dll-библиотек. Описание коэффициентов моделей. Разработка структуры классов. Реализация библиотеки классов в среде разработки MS Visual Studio.
дипломная работа [676,6 K], добавлен 16.06.2015Повышение информационной обеспеченности кафедры информационных технологий. Анализ технических требований для развертывания системы управления контентом Joomla. Организация структуры хранилища базы данных. Физическое расположение файлов системы на диске.
презентация [1,6 M], добавлен 19.06.2014Требования к MS Office 2007. Набор средств разработки Visual Studio Tools for Office как альтернатива VBA. Разработка СУБД на базе MS Access. Разработка надстройки "Электронные компоненты" для PowerPoint на языке C# в среде MS Visual Studio 2010.
дипломная работа [5,2 M], добавлен 03.05.2013Использование языка гипертекстовой разметки HTML. Преимущества интернет-хостинга Yutex.ru. Структура базы данных информационной системы "Электронная газета". Структура сайта, описание разделов и страниц. Интерфейс и сценарии администраторского блока.
курсовая работа [2,2 M], добавлен 07.07.2015История развития кафедры информатики и вычислительной техники Тульского педагогического института, его современное состояние. Руководители кафедры и ее педагогический состав. Разработка системы навигации и структура сайта кафедры, его стилевое решение.
курсовая работа [30,0 K], добавлен 22.05.2009Разработка базы данных для информационной системы "Библиотека". Системный анализ, инфологическое, даталогическое и физическое проектирование. Программирование бизнес-логики, разработка клиентского приложения. Создание web-приложения, web-доступ.
курсовая работа [3,3 M], добавлен 15.09.2014Библиотека как элемент образовательной среды. Основные технологии работы библиотеки общеобразовательного учреждения. Описание входных и выходных потоков информации. Выбор системы управления базами данных и создание схемы данных. Тестирование базы данных.
дипломная работа [1,5 M], добавлен 13.10.2015