Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Выбор ноутбука.doc
Скачиваний:
168
Добавлен:
14.05.2015
Размер:
1.41 Mб
Скачать

Список использованной литературы

  1. «Википедия» свободная энциклопедия http://ru.wikipedia.org

  2. Герберт Шилдт, ИД “Вильямс”, “Полный справочник по C#” , Москва 2004 г.

  3. Уэйт, М. Язык С. Руководство для начинающих. / М. Уэйт, С. Прага, Д. Мартин. - М.: Мир, 1995. - 521с.: ил.

  4. Лахатин, А.С. Языки программирования. Учеб. пособие / А.С. Лахатин, Л.Ю. Искакова. - Екатеринбург, 1998. - 548с.: ил.

  5. «Microsoft Visio 2007 – инструмент ИТ-специалистов и бизнес-пользователей» Автор: Андрей Колесов. 15.12.2007.

Приложение

Приложение 1

ALTER FUNCTION [dbo].[проверить_пароль]

(@hpwd as char(50), @login char(20))

RETURNS bigint

AS

BEGIN

declare @n as bigint

declare @kod as bigint

set @n = (select count(kod) from Users where login=@login and hash_pwd=@hpwd)

if @n <> 1

begin

set @kod = -1

end

else

begin

set @kod = (select top 1 kod from Users where login=@login and hash_pwd=@hpwd order by kod asc)

end

RETURN @kod

END

Приложение 2

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

Haracteristic fr1 = new Haracteristic();

fr1.Show();

}

private void button2_Click(object sender, EventArgs e)

{

Naznachen fr2 = new Naznachen();

fr2.Show();

}

private void button5_Click(object sender, EventArgs e)

{

Opisanie fr3 = new Opisanie();

fr3.Show();

}

private void button4_Click(object sender, EventArgs e)

{

//try

//{

// Process SysInfo = new Process();

// SysInfo.StartInfo.ErrorDialog = true;

// SysInfo.StartInfo.FileName = "help.chm";

// SysInfo.Start();

//}

//catch (Exception ex)

//{

// MessageBox.Show(ex.Message);

//}

Help.ShowHelp(this, "Help.chm");

}

private void label2_Click(object sender, EventArgs e)

{

}

private void button3_Click(object sender, EventArgs e)

{

Password fr4 = new Password();

fr4.Show();

}

private void button6_Click(object sender, EventArgs e)

{

Osobiy frfr = new Osobiy();

frfr.Show();

}

private void Form1_Load(object sender, EventArgs e)

{

}

}

Приложение 3

public partial class Haracteristic : Form

{

public Haracteristic()

{

InitializeComponent();

}

private void label1_Click(object sender, EventArgs e)

{

}

private void button2_Click(object sender, EventArgs e)

{

Proizvodit fr_pr = new Proizvodit();

if (fr_pr.ShowDialog() != DialogResult.OK)

{

textBox3.Text = "";

return;

}

else

{

textBox3.Text = fr_pr.firma;

}

}

private void button4_Click(object sender, EventArgs e)

{

Proc fr_proc = new Proc();

if (fr_proc.ShowDialog() != DialogResult.OK)

{

textBox5.Text = "";

return;

}

else

{

textBox5.Text = fr_proc.proc;

}

}

private void button5_Click(object sender, EventArgs e)

{

Operativ fr_ozy = new Operativ();

if (fr_ozy.ShowDialog() != DialogResult.OK)

{

textBox6.Text = "";

return;

}

else

{

textBox6.Text = fr_ozy.ozy;

}

}

private void button6_Click(object sender, EventArgs e)

{

hdd fr_hdd = new hdd();

if (fr_hdd.ShowDialog() != DialogResult.OK)

{

textBox7.Text = "";

return;

}

else

{

textBox7.Text = fr_hdd.hddisk;

}

}

private void button7_Click(object sender, EventArgs e)

{

Disk fr_disk = new Disk();

if (fr_disk.ShowDialog() != DialogResult.OK)

{

textBox8.Text = "";

return;

}

else

{

textBox8.Text = fr_disk.disk_tip;

}

}

private void button13_Click(object sender, EventArgs e)

{

if (textBox3.Text == "" && textBox5.Text == "" && textBox6.Text == "" && textBox7.Text == "" && textBox8.Text == "")

{

MessageBox.Show("Не выбраны параметры для поиска", "Ошибка");

return;

}

else

{

string f = "";

if (textBox3.Text != "")

f += "(Parameters like '%" + textBox3.Text + "%') And ";

if (textBox5.Text != "")

f += "(Parameters like '%" + textBox5.Text + "%') And ";

if (textBox6.Text != "")

f += "(Parameters like '%" + textBox6.Text + "%') And ";

if (textBox7.Text != "")

f += "(Parameters like '%" + textBox7.Text + "%') And ";

if (textBox8.Text != "")

f += "(Parameters like '%" + textBox8.Text + "%') And ";

f = " \nWHERE " + f.Remove(f.Length - 5);

BindingSource bs = new BindingSource();

sqlCommand1.CommandText = sql + f;

sqlConnection1.Open();

SqlDataReader dr = sqlCommand1.ExecuteReader();

if (dr.HasRows)

bs.DataSource = dr;

dr.Close();

sqlConnection1.Close();

dataGridView1.AutoGenerateColumns = false;

dataGridView1.DataSource = bs;

}

}

string sql;

private void Haracteristic_Load(object sender, EventArgs e)

{

sql = @"SELECT id, Notebook, Price, Parameters

FROM Notebook";

}

}

Приложение 4

public partial class Naznachen : Form

{

public Naznachen()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

Price fr_cena = new Price();

if (fr_cena.ShowDialog() != DialogResult.OK)

{

textBox2.Text = "";

return;

}

else

{

textBox2.Text = fr_cena.diapozon;

}

}

private void button2_Click(object sender, EventArgs e)

{

Ispolz fr_isp = new Ispolz();

if (fr_isp.ShowDialog() != DialogResult.OK)

{

textBox3.Text = "";

return;

}

else

{

textBox3.Text = fr_isp.isp;

}

}

private void button8_Click(object sender, EventArgs e)

{

Diagonal fr_diag = new Diagonal();

if (fr_diag.ShowDialog() != DialogResult.OK)

{

textBox16.Text = "";

return;

}

else

{

textBox16.Text = fr_diag.diag;

}

}

private void button11_Click(object sender, EventArgs e)

{

OS fr_os = new OS();

if (fr_os.ShowDialog() != DialogResult.OK)

{

textBox22.Text = "";

return;

}

else

{

textBox22.Text = fr_os.op_sys;

}

}

private void button10_Click(object sender, EventArgs e)

{

Bluetooth fr_bl = new Bluetooth();

if (fr_bl.ShowDialog() != DialogResult.OK)

{

textBox20.Text = "";

return;

}

else

{

textBox20.Text = fr_bl.bl_podkl;

}

}

private void button13_Click(object sender, EventArgs e)

{

if (textBox2.Text == "" && textBox3.Text == "" && textBox16.Text == "" && textBox22.Text == "" && textBox20.Text == "")

{

MessageBox.Show("Не выбраны параметры для поиска", "Ошибка");

return;

}

else

{

string f = "";

if (textBox2.Text != "")

f += "(Parameters like '%" + textBox2.Text + "%') And ";

if (textBox3.Text != "")

f += "(Parameters like '%" + textBox3.Text + "%') And ";

if (textBox16.Text != "")

f += "(Parameters like '%" + textBox16.Text + "%') And ";

if (textBox22.Text != "")

f += "(Parameters like '%" + textBox22.Text + "%') And ";

if (textBox20.Text != "")

f += "(Parameters like '%" + textBox20.Text + "%') And ";

f = " \nWHERE " + f.Remove(f.Length - 5);

BindingSource bs = new BindingSource();

sqlCommand1.CommandText = sql + f;

sqlConnection1.Open();

SqlDataReader dr = sqlCommand1.ExecuteReader();

if (dr.HasRows)

bs.DataSource = dr;

dr.Close();

sqlConnection1.Close();

dataGridView1.AutoGenerateColumns = false;

dataGridView1.DataSource = bs;

}

}

string sql;

private void Naznachen_Load(object sender, EventArgs e)

{

sql = @"SELECT id, Notebook, Parameters, Price

FROM Notebook";

}

}

Приложение 5

public partial class Password : Form

{

public Password()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

string login1 = this.textBox1.Text;

string pwd = this.textBox2.Text;

sqlConnection1.Open();

sqlCommand1.Parameters["@login"].Value = login1;

sqlCommand1.Parameters["@hpwd"].Value = pwd;

sqlCommand1.ExecuteScalar();

this.sqlCommand1.Parameters["@RETURN_VALUE"].Value;

System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();

byte[] pwdb = Encoding.Unicode.GetBytes(this.textBox1.Text);

// Преобразование строки b64 в массив байт

//Convert.FromBase64String(

byte[] hashb = md5.ComputeHash(pwdb);

string b64hash = Convert.ToBase64String(hashb);

this.textBox2.Text = b64hash;

int n = b64hash.Length;

//MessageBox.Show(string.Format("n={0}, lenHash={1}", n, hashb.Length));

//if (textBox2.Text == "GaKFQUS2Oo92F6byJQGbEg==")

//{

// Close();

// Admin fr1 = new Admin();

// fr1.Show();

// //newMDIChild.MdiParent = Form1.ActiveForm;

// //newMDIChild.Show();

//}

//else

//{

// textBox2.Text = "";

// MessageBox.Show("Введен неверный пароль", "Ошибка");

//}

}

private void Password_Load(object sender, EventArgs e)

{

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

}

private void label1_Click(object sender, EventArgs e)

{

}

}

Приложение 6

public partial class Osobiy : Form

{

public Osobiy()

{

InitializeComponent();

}

string sql;

protected internal string vop;

private void Osobiy_Load(object sender, EventArgs e)

{

// TODO: данная строка кода позволяет загрузить данные в таблицу "iisDataSet5.Vopros". При необходимости она может быть перемещена или удалена.

this.voprosTableAdapter.Fill(this.iisDataSet5.Vopros);

sql = @"SELECT id, Notebook, Parameters, Price

FROM Notebook";

textBox1.Text = dataGridView1.Rows[0].Cells[1].Value.ToString();

textBox2.Text = dataGridView1.Rows[1].Cells[1].Value.ToString();

textBox3.Text = dataGridView1.Rows[2].Cells[1].Value.ToString();

textBox4.Text = dataGridView1.Rows[3].Cells[1].Value.ToString();

textBox5.Text = dataGridView1.Rows[4].Cells[1].Value.ToString();

if (textBox3.Text == "")

{

textBox3.Visible = false;

button5.Visible = false;

button6.Visible = false;

}

else

{

textBox3.Visible = true;

button5.Visible = true;

button6.Visible = true;

}

if (textBox4.Text == "")

{

textBox4.Visible = false;

button7.Visible = false;

button8.Visible = false;

}

else

{

textBox4.Visible = true;

button7.Visible = true;

button8.Visible = true;

}

if (textBox5.Text == "")

{

textBox5.Visible = false;

button9.Visible = false;

button10.Visible = false;

}

else

{

textBox5.Visible = true;

button9.Visible = true;

button10.Visible = true;

}

//textBox6.Visible = false;

//textBox7.Visible = false;

//textBox8.Visible = false;

//textBox9.Visible = false;

//textBox10.Visible = false;

//dataGridView1.Visible = false;

//textBox13.Visible = false;

//button13.Visible = false;

//button14.Visible = false;

//button15.Visible = false;

}

private void button1_Click(object sender, EventArgs e)

{

textBox6.Visible = true;

textBox6.Text = "Пульт_ДУ";

}

private void button2_Click(object sender, EventArgs e)

{

textBox6.Visible = true;

textBox6.Text = "Без_пульта";

}

private void button3_Click(object sender, EventArgs e)

{

textBox7.Visible = true;

textBox7.Text = "Сканер_отпечатка";

}

private void button4_Click(object sender, EventArgs e)

{

textBox7.Visible = true;

textBox7.Text = "Без_сканера_отпечатка";

}

private void button5_Click(object sender, EventArgs e)

{

textBox8.Visible = true;

textBox8.Text = "Опция1";

}

private void button6_Click(object sender, EventArgs e)

{

textBox8.Visible = true;

textBox8.Text = "Без_опции1";

}

private void button7_Click(object sender, EventArgs e)

{

textBox9.Visible = true;

textBox9.Text = "Опция2";

}

private void button8_Click(object sender, EventArgs e)

{

textBox9.Visible = true;

textBox9.Text = "Без_опции2";

}

private void button9_Click(object sender, EventArgs e)

{

textBox10.Visible = true;

textBox10.Text = "Опция3";

}

private void button10_Click(object sender, EventArgs e)

{

textBox10.Visible = true;

textBox10.Text = "Без_опции3";

}

private void button11_Click(object sender, EventArgs e)

{

if (textBox10.Text == "" && textBox6.Text == "" && textBox7.Text == "" && textBox8.Text == "" && textBox9.Text == "")

{

MessageBox.Show("Не выбраны параметры для поиска", "Ошибка");

return;

}

else

{

string f = "";

if (textBox6.Text != "")

f += "(Parameters like '%" + textBox6.Text + "%') And ";

if (textBox7.Text != "")

f += "(Parameters like '%" + textBox7.Text + "%') And ";

if (textBox8.Text != "")

f += "(Parameters like '%" + textBox8.Text + "%') And ";

if (textBox9.Text != "")

f += "(Parameters like '%" + textBox9.Text + "%') And ";

if (textBox10.Text != "")

f += "(Parameters like '%" + textBox10.Text + "%') And ";

f = " \nWHERE " + f.Remove(f.Length - 5);

BindingSource bs = new BindingSource();

sqlCommand1.CommandText = sql + f;

sqlConnection1.Open();

SqlDataReader dr = sqlCommand1.ExecuteReader();

if (dr.HasRows)

bs.DataSource = dr;

dr.Close();

sqlConnection1.Close();

dataGridView2.AutoGenerateColumns = false;

dataGridView2.DataSource = bs;

}

}

private void button12_Click(object sender, EventArgs e)

{

if (textBox11.Text == "admin")

{

dataGridView1.Visible = true;

textBox13.Visible = true;

button13.Visible = true;

button14.Visible = true;

button15.Visible = true;

Osobiy.ActiveForm.Height = 410;

}

else

{

MessageBox.Show("Введен неверный пароль", "Ошибка");

}

textBox11.Text = "";

}

private void dataGridView1_Click(object sender, EventArgs e)

{

textBox13.Text = (string)dataGridView1["voprDataGridViewTextBoxColumn", dataGridView1.CurrentRow.Index].Value;

}

private void button13_Click(object sender, EventArgs e)

{

System.Data.SqlClient.SqlConnection sqlConnection1 =

new System.Data.SqlClient.SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Ксения\\Универ\\4 КУРС\\ИИС\\ЭКСПЕРТКА\\ПРОЕКТ\\WindowsFormsApplication1\\WindowsFormsApplication1\\iis.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");

System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();

cmd.CommandType = System.Data.CommandType.Text;

cmd.CommandText = "INSERT Vopros (Id, vopr) VALUES" +

"(@Id, @vopr)";

cmd.Connection = sqlConnection1;

cmd.Parameters.AddWithValue("@Id", 3);

cmd.Parameters.AddWithValue("@vopr", textBox13.Text);

sqlConnection1.Open();

cmd.ExecuteNonQuery();

sqlConnection1.Close();

MessageBox.Show("Вопрос добален. Данные отобразятся при следующем входе в базу данных.");

}

private void button14_Click(object sender, EventArgs e)

{

if (dataGridView1.CurrentRow == null)

{

MessageBox.Show("Строка для удаления не выбрана");

return;

}

int id = (int)dataGridView1["idDataGridViewTextBoxColumn", dataGridView1.CurrentRow.Index].Value;

if (MessageBox.Show("Вы действительно хотите удалить вопрос " + id + "?", "Удаление сведений",

MessageBoxButtons.OKCancel) == DialogResult.Cancel)

return;

else

{

delCommand.Parameters["@Id"].Value = id;

delCommand.ExecuteNonQuery();

MessageBox.Show("База данных обновлена. Данные отобразятся при следующем входе в базу данных.");

}

}

private void button15_Click(object sender, EventArgs e)

{

button13.PerformClick();

}

}

22