Дипломная работа: Автоматизация процесса приема техники на ремонтные работы в ООО "Сервисный центр Samsung"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
76
Триггер для расчета общей стоимости заказа:
CREATE TRIGGER ОбщаяСтоимость
ON Zakaz
AFTER INSERT, UPDATE
AS
BEGIN
DECLARE @x INT, @y DECIMAL,@z DECIMAL, @f INT
SELECT @x=id_zak, @y=stoim_rab, @z=stoim_det, @f=skidka
FROM inserted
BEGIN
UPDATE Zakaz
SET ob_stoim=(@y+@Z)-(@y+@z)/100*@f
WHERE id_zak=@x
END
END
77
Приложение 2. Листинг.
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace SRemont
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Vhod());
if (Vhod.status == "running")
Application.Run(new Form1(Vhod.userName, Vhod.dostup));
}
}
}
Vhos.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SRemont
{
public partial class Vhod : Form
{
DataClasses1DataContext db = new DataClasses1DataContext();
static public string status;
static public string userName;
static public string dostup;
public Vhod()
{
InitializeComponent();
textBox1.Text = "1";
textBox2.Text = "1";
}
//проверка логина и пароля
private bool Verifying(string log, string pas)
{
bool param = false;
var q = (from a in db.Sotrudnik
78
where a.login == log
select a).SingleOrDefault();
if (q != null)
{
if (q.pass == pas)
{
param = true;
userName = q.fio_sotr;
dostup = q.dost;
return param;
}
else return param;
}
else return param;
}
//нажатие кнопки ок
private void button1_Click(object sender, EventArgs e)
{
if (Verifying(textBox1.Text, textBox2.Text))
{
status = "running";
this.Close();
}
else
MessageBox.Show("Неверный логин или пароль", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
//нажатие кнопки отмена
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SRemont
{
public partial class Form1 : Form
{
DataClasses1DataContext db = new DataClasses1DataContext();
static public string userName;
static public string dostup;
private string cellval;
private string cellval1;
private string cellval2;
private double sum = 0;
public Form1(string u, string d)
{
InitializeComponent();
79
SelfRef = this;
userName = u;
dostup = d;
toolStripStatusLabel1.Text = d + ": " + u;
}
//свойство для вызова методов из другой формы
public static Form1 SelfRef
{
get;
set;
}
//построение сетки
public void ViewData()
{
var q1 = from a in db.View_4
select a;
dataGridView1.DataSource = q1;
GetDet();
GetRab();
}
//загрузка формы
private void Form1_Load(object sender, EventArgs e)
{
if (dostup == "Администратор")
сотрудникиToolStripMenuItem.Enabled = true;
else if (dostup == "Пользователь")
сотрудникиToolStripMenuItem.Enabled = false;
this.comboBox1.DataSource = from a in db.TipUstr
select new
{
pID = a.id_tu,
pName = a.naim_tu
};
this.comboBox1.DisplayMember = "pName";
this.comboBox1.ValueMember = "pID";
this.comboBox1.Text = "";
this.comboBox2.DataSource = from a in db.ModelUstr
select new
{
pID = a.id_mu,
pName = a.naim_mu
};
this.comboBox2.DisplayMember = "pName";
this.comboBox2.ValueMember = "pID";
this.comboBox2.Text = "";
this.comboBox3.DataSource = from a in db.Klient
select new
{
pID = a.id_kl,
pName = a.fio_kl
};
this.comboBox3.DisplayMember = "pName";
this.comboBox3.ValueMember = "pID";
this.comboBox3.Text = "";
this.comboBox4.DataSource = from a in db.Sotrudnik
select new
{
pID = a.id_sotr,
pName = a.fio_sotr
};
this.comboBox4.DisplayMember = "pName";
80
this.comboBox4.ValueMember = "pID";
this.comboBox4.Text = "";
textBox1.Text = "";
textBox2.Text = "";
dateTimePicker1.Checked = false;
dateTimePicker2.Checked = false;
dateTimePicker3.Checked = false;
dateTimePicker4.Checked = false;
checkBox1.Checked = false;
ViewData();
}
//вызов формы Клиенты
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
{
Kli form;
form = Kli.GetInstance();
form.Show();
}
//вызов формы Детали
private void деталиToolStripMenuItem_Click(object sender, EventArgs e)
{
Det form;
form = Det.GetInstance();
form.Show();
}
//вызов формы Работы
private void работыToolStripMenuItem_Click(object sender, EventArgs e)
{
Rab form;
form = Rab.GetInstance();
form.Show();
}
//вызов справочника Группы деталей
private void группыДеталейToolStripMenuItem_Click(object sender, EventArgs e)
{
GT form;
form = GT.GetInstance();
form.Show();
}
//вызов справочника Типы устройств
private void типыУстройствToolStripMenuItem_Click(object sender, EventArgs e)
{
TU form;
form = TU.GetInstance();
form.Show();
}
//вызов справочника Модели устройств
private void моделиУстройствToolStripMenuItem_Click(object sender, EventArgs e)
{
MU form;
form = MU.GetInstance();
form.Show();
}
//вызов справочника Сотрудники
private void сотрудникиToolStripMenuItem_Click(object sender, EventArgs e)
{
Sotr form;
Источник: https://baza.diplomsite.ru/previewfile/2121