Вход

Информационные системы

Рекомендуемая категория для самостоятельной подготовки:
Курсовая работа*
Код 190504
Дата создания 2015
Страниц 33
Источников 4
Мы сможем обработать ваш заказ (!) 29 марта в 12:00 [мск]
Файлы будут доступны для скачивания только после обработки заказа.
1 700руб.
КУПИТЬ

Содержание

1. Постановка задачи 3
2. Средства реализации 4
3. Требования к аппаратному и программному обеспечению 7
4.Соединение с базой данных при помощи MS SQL Server 8
4.1.Создание запроса 10
4.2. Получение данных 12
5. Интерфейс пользователя 14
6. Структура данных 30
6.1.Концептуальная модель БД. 30
6.2. Физическая модель БД 30
Заключение 32
СПИСОК ЛИТЕРАТУРЫ 33
Приложение 34

Фрагмент работы для ознакомления

mode)
{
case 1:
string insertstring = "INSERT INTO [SSDB].[dbo].[sotr] ([fam],[name],[surname],[code_podr],[dolgn],[tel],[ruk]) VALUES (@fam,@name,@surname,@code_podr,@dolgn,@tel,@ruk)";
EmployeeForm.connection.Open();
SqlCommand commandinsert = new SqlCommand(insertstring, EmployeeForm.connection);
commandinsert.Parameters.Add(@"fam", SqlDbType.VarChar).Value = famTextBox.Text;
commandinsert.Parameters.Add(@"name", SqlDbType.VarChar).Value = nameTextBox.Text;
commandinsert.Parameters.Add(@"surname", SqlDbType.VarChar).Value = surnameTextBox.Text;
commandinsert.Parameters.Add(@"dolgn", SqlDbType.VarChar).Value = dolgnTextBox.Text;
commandinsert.Parameters.Add(@"code_podr", SqlDbType.Int).Value = Convert.ToInt32(podrComboBox.SelectedValue);
commandinsert.Parameters.Add(@"tel", SqlDbType.VarChar).Value = telTextBox.Text;
if (rukСheckBox.Checked)
commandinsert.Parameters.Add(@"ruk", SqlDbType.Int).Value = 1;
else
commandinsert.Parameters.Add(@"ruk", SqlDbType.Int).Value = 0;
commandinsert.ExecuteNonQuery();
EmployeeForm.connection.Close();
break;
case 2:
string updatestring = "UPDATE [SSDB].[dbo].[sotr] SET [fam] = @fam,[name] = @name,[surname] =@surname,[code_podr] = @code_podr,[dolgn] = @dolgn,[tel] = @tel,[ruk] = @ruk WHERE [code_sotr] = @id";

EmployeeForm.connection.Open();
SqlCommand commandupdate = new SqlCommand(updatestring, EmployeeForm.connection);
commandupdate.Parameters.Add(@"id", SqlDbType.Int).Value = id;
commandupdate.Parameters.Add(@"fam", SqlDbType.VarChar).Value = famTextBox.Text;
commandupdate.Parameters.Add(@"name", SqlDbType.VarChar).Value = nameTextBox.Text;
commandupdate.Parameters.Add(@"surname", SqlDbType.VarChar).Value = surnameTextBox.Text;
commandupdate.Parameters.Add(@"dolgn", SqlDbType.VarChar).Value = dolgnTextBox.Text;
commandupdate.Parameters.Add(@"code_podr", SqlDbType.Int).Value = Convert.ToInt32(podrComboBox.SelectedValue);
commandupdate.Parameters.Add(@"tel", SqlDbType.VarChar).Value = telTextBox.Text;
if (rukСheckBox.Checked)
commandupdate.Parameters.Add(@"ruk", SqlDbType.Int).Value = 1;
else
commandupdate.Parameters.Add(@"ruk", SqlDbType.Int).Value = 0;
commandupdate.ExecuteNonQuery();
EmployeeForm.connection.Close();
break;
}
this.Close();
}
private void EmployeeEditForm_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'depDataSet.podr' table. You can move, or remove it, as needed.
this.podrTableAdapter.Fill(this.depDataSet.podr);
if (EmployeeForm.mode == 2)
{
this.famTextBox.Text = fam;
this.nameTextBox.Text = name;
this.surnameTextBox.Text = surname;
this.dolgnTextBox.Text = dolgn;
this.telTextBox.Text = tel;
this.podrComboBox.SelectedValue = code_podr;
if (ruk == 1)
this.rukСheckBox.Checked = true;
else
this.rukСheckBox.Checked = false;
}
}
}
}
EmployeeForm.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 SupportSystem
{
public partial class EmployeeForm : Form
{
public EmployeeForm()
{
InitializeComponent();
}
static public SqlConnection connection = new SqlConnection("Data Source=DEV1176;Initial Catalog=SSDB;Integrated Security=True");
static public int mode; // 1 - создание нового
// 2 - редактирование
private void EmployeeForm_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'empDataSet.sotr' table. You can move, or remove it, as needed.
this.sotrTableAdapter.Fill(this.empDataSet.sotr);
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
/// <summary>
/// Вызов окна создания нового сотрудника
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
mode = 1;
EmployeeEditForm eef = new EmployeeEditForm();
eef.Text = "Новый сотрудник";
eef.ShowDialog();
this.sotrTableAdapter.Fill(this.empDataSet.sotr);
dataGridView1.Refresh();
}
/// <summary>
/// Вызов окна редактирования сотрудника
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
mode = 2;
EmployeeEditForm eef = new EmployeeEditForm();
eef.Text = "Редактирование сотрудника";
eef.id = Convert.ToInt32(dataGridView1["id", dataGridView1.CurrentRow.Index].Value);
eef.fam = Convert.ToString(dataGridView1["fam", dataGridView1.CurrentRow.Index].Value);
eef.name = Convert.ToString(dataGridView1["name", dataGridView1.CurrentRow.Index].Value);
eef.surname = Convert.ToString(dataGridView1["surname", dataGridView1.CurrentRow.Index].Value);
eef.dolgn = Convert.ToString(dataGridView1["dolgn", dataGridView1.CurrentRow.Index].Value);
eef.tel = Convert.ToString(dataGridView1["tel", dataGridView1.CurrentRow.Index].Value);
eef.code_podr = Convert.ToInt32(dataGridView1["code_podr", dataGridView1.CurrentRow.Index].Value);
eef.ruk = Convert.ToInt32(dataGridView1["ruk", dataGridView1.CurrentRow.Index].Value);
eef.ShowDialog();
this.sotrTableAdapter.Fill(this.empDataSet.sotr);
dataGridView1.Refresh();
}
/// <summary>
/// Удаление сотрудника
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button3_Click(object sender, EventArgs e)
{
string deletestring = "DELETE FROM [SSDB].[dbo].[sotr] WHERE [code_sotr] = @id";
int id = Convert.ToInt32(dataGridView1["id", dataGridView1.CurrentRow.Index].Value);
connection.Open();
SqlCommand commanddelete = new SqlCommand(deletestring, connection);
commanddelete.Parameters.Add(@"id", SqlDbType.Int).Value = id;
commanddelete.ExecuteNonQuery();
connection.Close();
this.sotrTableAdapter.Fill(this.empDataSet.sotr);
dataGridView1.Refresh();
}
}
}
Form1.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 SupportSystem
{
public partial class AutoForm : Form
{
public AutoForm()
{
InitializeComponent();
}
public int rol;
public int code_cli;
public int ruk;
public int code_sotr;
private void Form1_Load(object sender, EventArgs e)
{
}
private void ApplyButton_Click(object sender, EventArgs e)
{
this.Visible = false;
if (UserNameText.Text== "admin")
{
AdminForm af = new AdminForm();
af.ShowDialog();
}
else
{
rol = 0;
string querystring = "SELECT rol FROM avt WHERE (login = @login) and (pass = @pass)";
EmployeeForm.connection.Open();
SqlCommand commandquery = new SqlCommand(querystring, EmployeeForm.connection);
commandquery.Parameters.Add(@"login", SqlDbType.VarChar).Value = UserNameText.Text;
commandquery.Parameters.Add(@"pass", SqlDbType.VarChar).Value = UserPassText.Text;
rol = (int)commandquery.ExecuteScalar();
EmployeeForm.connection.Close();
switch (rol)
{
case 1:
string querystring2 = "SELECT code_cli FROM avt WHERE (login = @login) and (pass = @pass) and (rol = 1)";
EmployeeForm.connection.Open();
SqlCommand commandquery2 = new SqlCommand(querystring2, EmployeeForm.connection);
commandquery2.Parameters.Add(@"login", SqlDbType.VarChar).Value = UserNameText.Text;
commandquery2.Parameters.Add(@"pass", SqlDbType.VarChar).Value = UserPassText.Text;
code_cli = (int)commandquery2.ExecuteScalar();
EmployeeForm.connection.Close();
RequestForm rf = new RequestForm();
rf.code_cli = code_cli;
rf.ShowDialog();
break;
case 2:
string querystring3 = "SELECT code_sotr FROM avt WHERE (login = @login) and (pass = @pass)";
EmployeeForm.connection.Open();
SqlCommand commandquery3 = new SqlCommand(querystring3, EmployeeForm.connection);
commandquery3.Parameters.Add(@"login", SqlDbType.VarChar).Value = UserNameText.Text;
commandquery3.Parameters.Add(@"pass", SqlDbType.VarChar).Value = UserPassText.Text;
code_sotr = (int)commandquery3.ExecuteScalar();
EmployeeForm.connection.Close();
string querystring4 = "SELECT s.ruk FROM avt a, sotr s WHERE (a.login = @login) and (a.pass = @pass) and (a.code_sotr = s.code_sotr)";
EmployeeForm.connection.Open();
SqlCommand commandquery4 = new SqlCommand(querystring4, EmployeeForm.connection);
commandquery4.Parameters.Add(@"login", SqlDbType.VarChar).Value = UserNameText.Text;
commandquery4.Parameters.Add(@"pass", SqlDbType.VarChar).Value = UserPassText.Text;
ruk = (int)commandquery4.ExecuteScalar();
EmployeeForm.connection.Close();
SupportForm sf = new SupportForm();
sf.code_sotr = code_sotr;
sf.ruk = ruk;
sf.ShowDialog();
break;
}
}

this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
RequestEditForm.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 SupportSystem
{
public partial class RequestEditForm : Form
{
public RequestEditForm()
{
InitializeComponent();
}
public int ruk;
public int id;
public int code_cli;
public string cli_fam;
public string zagol;
public string text;
public int sost;
public string sost_name;
public string comment;
public int code_sotr;
private void button1_Click(object sender, EventArgs e)
{
switch (ruk)
{
case 0:
string updatestring = "UPDATE [SSDB].[dbo].[sotr] SET [sost] = @sost,[comment] = @comment WHERE [code_obr] = @id";
EmployeeForm.connection.Open();
SqlCommand commandupdate = new SqlCommand(updatestring, EmployeeForm.connection);
commandupdate.Parameters.Add(@"id", SqlDbType.Int).Value = id;
commandupdate.Parameters.Add(@"comment", SqlDbType.VarChar).Value = commentTextBox.Text;
commandupdate.Parameters.Add(@"sost", SqlDbType.Int).Value = Convert.ToInt32(stateComboBox.SelectedIndex);
commandupdate.ExecuteNonQuery();
EmployeeForm.connection.Close();
break;
case 1:
string updatestring1 = "UPDATE [SSDB].[dbo].[obr] SET [code_sotr] = @code_sotr,[sost] = @sost,[comment] = @comment WHERE [code_obr] = @id";
EmployeeForm.connection.Open();
SqlCommand commandupdate1 = new SqlCommand(updatestring1, EmployeeForm.connection);
commandupdate1.Parameters.Add(@"id", SqlDbType.Int).Value = id;
commandupdate1.Parameters.Add(@"comment", SqlDbType.VarChar).Value = commentTextBox.Text;
commandupdate1.Parameters.Add(@"sost", SqlDbType.Int).Value = Convert.ToInt32(stateComboBox.SelectedIndex);
commandupdate1.Parameters.Add(@"code_sotr", SqlDbType.Int).Value = Convert.ToInt32(sotrComboBox.SelectedValue);
commandupdate1.ExecuteNonQuery();
EmployeeForm.connection.Close();
break;
}
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void RequestEditForm_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'thisLeadSubsDataSet.sotr' table. You can move, or remove it, as needed.
this.sotrTableAdapter.Fill(this.thisLeadSubsDataSet.sotr,code_sotr);
stateComboBox.Items.Add("В работе");
stateComboBox.Items.Add("Закрыта");
stateComboBox.SelectedIndex = sost;
zagolTextBox.Text = zagol;
cliTextBox.Text = cli_fam;
textTextBox.Text = text;
commentTextBox.Text = comment;
switch (ruk)
{
case 0:
sotrLlabel.Visible = false;
sotrComboBox.Visible = false;
//commentTextBox.Size.Height = 100;
break;
case 1:
sotrLlabel.Visible = true;
sotrComboBox.Visible = true;
//commentTextBox.Size.Height = 67;
break;
}
}
}
}
RequestForm.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 SupportSystem
{
public partial class RequestForm : Form
{
public RequestForm()
{
InitializeComponent();
}
public int code_cli;
private void ClientForm_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'depDataSet.podr' table. You can move, or remove it, as needed.
this.podrTableAdapter.Fill(this.depDataSet.podr);
}
private void button1_Click(object sender, EventArgs e)
{
string insertstring = "INSERT INTO [SSDB].[dbo].[obr] ([zagol],[text],[sost],[code_cli],[code_sotr],[day]) VALUES (@zagol,@text,@sost,@code_cli,@code_sotr,@day)";
EmployeeForm.connection.Open();
SqlCommand commandinsert = new SqlCommand(insertstring, EmployeeForm.connection);
commandinsert.Parameters.Add(@"zagol", SqlDbType.VarChar).Value = zagolTextBox.Text;
commandinsert.Parameters.Add(@"text", SqlDbType.VarChar).Value = textTextBox.Text;
commandinsert.Parameters.Add(@"sost", SqlDbType.Int).Value = 0;
commandinsert.Parameters.Add(@"code_cli", SqlDbType.Int).Value = code_cli;
commandinsert.Parameters.Add(@"code_sotr", SqlDbType.Int).Value = Convert.ToInt32(depComboBox.SelectedValue);
commandinsert.Parameters.Add(@"day", SqlDbType.Date).Value = DateTime.Today;
commandinsert.ExecuteNonQuery();
EmployeeForm.connection.Close();
MessageBox.Show("Заявка создана");
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
SupportForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SupportSystem
{
public partial class SupportForm : Form
{
public int ruk;
public int code_sotr;
public SupportForm()
{
InitializeComponent();
}
private void SupportForm_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'reqDataSet.obr' table. You can move, or remove it, as needed.
this.obrTableAdapter.Fill(this.reqDataSet.obr,code_sotr);
}
/// <summary>
/// Вызов формы редактирования заявки
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{

RequestEditForm reqef = new RequestEditForm();
reqef.text = "Редактирование заявки";
reqef.id =Convert.ToInt32(dataGridView1["id", dataGridView1.CurrentRow.Index].Value);
reqef.cli_fam = Convert.ToString(dataGridView1["fam", dataGridView1.CurrentRow.Index].Value);
reqef.code_sotr = Convert.ToInt32(dataGridView1["code_sotr1", dataGridView1.CurrentRow.Index].Value);
reqef.zagol = Convert.ToString(dataGridView1["zagol", dataGridView1.CurrentRow.Index].Value);
reqef.text = Convert.ToString(dataGridView1["text", dataGridView1.CurrentRow.Index].Value);
reqef.sost = Convert.ToInt32(dataGridView1["sost", dataGridView1.CurrentRow.Index].Value);
reqef.comment = Convert.ToString(dataGridView1["comment", dataGridView1.CurrentRow.Index].Value);

reqef.ruk = ruk;
reqef.ShowDialog();
this.obrTableAdapter.Fill(this.reqDataSet.obr, code_sotr);
dataGridView1.Refresh();
}
}
}
30

Список литературы [ всего 4]

1. Астахова И. Ф. , Толстобров А. П. , Мельников В. М. SQL в примерах и задачах. - Воронеж, ВГУ, 1999. – 104с.
2. Дейт, К. Дж. Введение в системы баз данных. : Пер. с англ. - 6-е изд. - К.: Диалектика, 1998. – 784 с.: ил.
3. Конноллин Т. , Бегг К. , Страчан А. Базы данных: проектирование, реализация и сопровождение, теория и практика, 2-е изд. Пер. с англ. : Ул. Пос. – М.: Изд. Дом «Вильямс», 2000. - 1120 с.: ил.
4. Герсиа – Молина, Гектор, Ульман, Джеффри Д., Уидом, Дженнифер, Системы баз данных. Полный курс.: Пер. с англ. – М.: Изд. Дом «Вильямс», 2003. - 1088 с.: ил.
Очень похожие работы
Пожалуйста, внимательно изучайте содержание и фрагменты работы. Деньги за приобретённые готовые работы по причине несоответствия данной работы вашим требованиям или её уникальности не возвращаются.
* Категория работы носит оценочный характер в соответствии с качественными и количественными параметрами предоставляемого материала. Данный материал ни целиком, ни любая из его частей не является готовым научным трудом, выпускной квалификационной работой, научным докладом или иной работой, предусмотренной государственной системой научной аттестации или необходимой для прохождения промежуточной или итоговой аттестации. Данный материал представляет собой субъективный результат обработки, структурирования и форматирования собранной его автором информации и предназначен, прежде всего, для использования в качестве источника для самостоятельной подготовки работы указанной тематики.
bmt: 0.00608
© Рефератбанк, 2002 - 2024