Файл: Технико-экономическая характеристика предметной области и предприятия.pdf

ВУЗ: Не указан

Категория: Курсовая работа

Дисциплина: Не указана

Добавлен: 17.06.2023

Просмотров: 122

Скачиваний: 2

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

connection.Open();

OleDbDataReader reader = command.ExecuteReader();

while (reader.Read())

{

zaavka zad = new zaavka();

zad.Id = Convert.ToInt32(reader["Id"].ToString());

zad.Id_admin = Convert.ToInt32(reader["Id_admin"].ToString());

zad.Id_klient = Convert.ToInt32(reader["Id_klient"].ToString());

zad.Id_otdel = Convert.ToInt32(reader["Id_otdel"].ToString());

zad.Data = reader["Data"].ToString();

zad.Prichina = reader["Prichina"].ToString();

spisok.Add(zad);

}

return spisok;

}

catch (Exception)

{

throw;

}

finally

{

if (connection != null) { connection.Close(); } } } }}

Приложение В

Форма заявки на обслуживание

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Drawing.Drawing2D;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace Nag

{

public partial class Form_zaavka : Form

{

public Form_zaavka()

{

InitializeComponent();

}

private void выходToolStripMenuItem_Click(object sender, EventArgs e)

{

this.Close();

}

private void Form_nag_Load(object sender, EventArgs e)

{

GraphicsPath gPath = new GraphicsPath();

Rectangle rect = new Rectangle(0, 0, 900, 600);

gPath.AddRectangle(rect);

this.Region = new Region(gPath);

textBox_dataa.Text = DateTime.Now.ToString("dd/MM");

//extBox_nn.Text = DateTime.Now.ToString("dd/MM");

textBox_dataaa.Text = DateTime.Now.ToString("dd/MM");

// textBox_dataa_ocon.Text = DateTime.Now.ToString("dd/MM");

next();

klient_sp();

admin_sp();

ot_sp();

}

private void next()

{

BD bd = new BD();

List<zaavka> spisok = new List<zaavka>();

spisok = bd.Fill_zaavka();

spisok.Sort(delegate(zaavka us1, zaavka us2) { return us1.Data.CompareTo(us2.Data); });

dataGridView1.DataSource = spisok;

dataGridView1.Columns[0].HeaderText = "Номер";

dataGridView1.Columns[1].HeaderText = "Оператор";

dataGridView1.Columns[2].HeaderText = "Клиент";

dataGridView1.Columns[3].HeaderText = "Отдел";

dataGridView1.Columns[4].HeaderText = "Дата";

dataGridView1.Columns[5].HeaderText = "Причина";

}

private void admin_sp()

{

BD bd = new BD();

List<admin> spisok = new List<admin>();

spisok = bd.Fill_admin();

foreach (admin kot in spisok)

{

comboBox_op.Items.Add(kot.Name);

comboBox_opp.Items.Add(kot.Name);

}

}

private void klient_sp()

{

BD bd = new BD();

List<klient> spisok = new List<klient>();

spisok = bd.Fill_klient();

foreach (klient kot in spisok)

{

comboBox_klient.Items.Add(kot.Name);

comboBox_klientt.Items.Add(kot.Name);

}

}

private void ot_sp()

{

BD bd = new BD();

List<otdel> spisok = new List<otdel>();

spisok = bd.Fill_otdel();

foreach (otdel kot in spisok)

{

comboBox_ot.Items.Add(kot.Name);

comboBox_ott.Items.Add(kot.Name);

}

}

private void button2_Click(object sender, EventArgs e)

{

Form_admin inf = new Form_admin();

this.Hide();

inf.ShowDialog();

this.Show();

comboBox_op.Items.Clear();

comboBox_opp.Items.Clear();

admin_sp();

}

private void button5_Click(object sender, EventArgs e)

{

Form_klient inf = new Form_klient();

this.Hide();

inf.ShowDialog();

this.Show();

comboBox_klient.Items.Clear();

comboBox_klientt.Items.Clear();

klient_sp();

}

private void button3_Click(object sender, EventArgs e)

{

Form_otdel inf = new Form_otdel();

this.Hide();

inf.ShowDialog();

this.Show();

comboBox_ot.Items.Clear();


comboBox_ott.Items.Clear();

ot_sp();

}

private void button4_Click(object sender, EventArgs e)

{

if (comboBox_op.Text == "" || comboBox_klient.Text == "" || comboBox_ot.Text == "" || textBox_dataa.Text == "" || textBox_prr.Text == "")

{

MessageBox.Show("Заполните поля данных!!!");

}

else

{

BD bd = new BD();

zaavka z = new zaavka();

z.Id_admin = bd.Get_admin_name(comboBox_op.Text).Id;

z.Id_klient = bd.Get_klient_name(comboBox_klient.Text).Id;

z.Id_otdel = bd.Get_otdel_Name(comboBox_ot.Text).Id;

z.Data = textBox_dataa.Text;

z.Prichina = textBox_prr.Text;

try

{

bd.Inser_zaavka(z);

textBox_prr.Text = "";

next();

MessageBox.Show("Успешно!!!");

}

catch (FormatException)

{ MessageBox.Show("Ошибка!"); }

}

}

private void button_delete_Click(object sender, EventArgs e)

{

if (textBox_id.Text == "")

{

MessageBox.Show("Заполните поля!!!");

}

else

{

BD bd = new BD();

bd.Delete(textBox_id.Text, "zaavka");

next();

}

}

private void button10_Click(object sender, EventArgs e)

{

Form_admin inf = new Form_admin();

this.Hide();

inf.ShowDialog();

this.Show();

comboBox_op.Items.Clear();

comboBox_opp.Items.Clear();

admin_sp();

}

private void button8_Click(object sender, EventArgs e)

{

Form_klient inf = new Form_klient();

this.Hide();

inf.ShowDialog();

this.Show();

comboBox_klient.Items.Clear();

comboBox_klientt.Items.Clear();

klient_sp();

}

private void button9_Click(object sender, EventArgs e)

{

Form_otdel inf = new Form_otdel();

this.Hide();

inf.ShowDialog();

this.Show();

comboBox_ot.Items.Clear();

comboBox_ott.Items.Clear();

ot_sp();

}

private void button1_Click(object sender, EventArgs e)

{

if (textBox_FIO.Text == "")

{

MessageBox.Show("Заполните поля поиска!!!");

}

else

{

if (radioButton1.Checked == true)

{

BD bd = new BD();

admin spisok= new admin();

spisok = bd.Get_admin_name(textBox_FIO.Text);

List<zaavka> sp = new List<zaavka>();

sp = bd.Fill_zaavka_idadmin(spisok.Id.ToString());

dataGridView1.DataSource = sp;

}

if (radioButton2.Checked == true)

{

BD bd = new BD();

klient spisok = new klient();

spisok = bd.Get_klient_name(textBox_FIO.Text);

List<zaavka> sp = new List<zaavka>();

sp = bd.Fill_zaavka_idklient(spisok.Id.ToString());

dataGridView1.DataSource = sp;

}

if (radioButton3.Checked == true)

{

BD bd = new BD();

otdel spisok = new otdel();

spisok = bd.Get_otdel_Name(textBox_FIO.Text);

List<zaavka> sp = new List<zaavka>();

sp = bd.Fill_zaavka_id_otdel(spisok.Id.ToString());

dataGridView1.DataSource = sp;

}

if (radioButton4.Checked == true)

{

BD bd = new BD();

List<zaavka> sp = new List<zaavka>();

sp = bd.Fill_zaavka_data(textBox_FIO.Text);

dataGridView1.DataSource = sp;

}

}

}

private void dataGridView1_SelectionChanged(object sender, EventArgs e)

{

textBox_id.Text = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString();

textBox_idd.Text = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString();

BD bd = new BD();

textBox_op.Text = bd.Get_admin_id(dataGridView1[1, dataGridView1.CurrentRow.Index].Value.ToString()).Name;

textBox_klient.Text = bd.Get_klient_id(dataGridView1[2, dataGridView1.CurrentRow.Index].Value.ToString()).Name;

textBox_ot.Text = bd.Get_otdel_Id(dataGridView1[3, dataGridView1.CurrentRow.Index].Value.ToString()).Name.ToString();

textBox_data.Text = (dataGridView1[4, dataGridView1.CurrentRow.Index]).Value.ToString();

textBox_pr.Text = (dataGridView1[5, dataGridView1.CurrentRow.Index]).Value.ToString();

textBox_prrr.Text = (dataGridView1[5, dataGridView1.CurrentRow.Index]).Value.ToString();