курсовая. Тауберт_БД_курсовая. Проектирование базы данных информационной системы для арм продавца компьютерной техники
Скачать 1.39 Mb.
|
Приложение А- Заявка на технику
Приложение Б - ЗапросПриложение В - СчетПриложение Г –Отчет об открытии сменыПриложение Д –Товарная накладнаяПриложение Е - ЧекПриложение Ж –Гарантийный талон
Дата продажи___________ Продавец________ М.П._________________ Срок гарантии … месяцев с момента покупки. Изделие проверено, претензий по качеству и внешнему виду не имеется. С условиями гарантии знакомлен____________ Тел.: +375-(44)-775-99-55 Время работы: 8:00-22:00, без выходных Приложение З – Form1namespace Trade { publicpartialclassForm1 : Form { public Form1() { InitializeComponent(); } privatevoid Form1_Load(object sender, EventArgs e) { // TODO: данная строка кода позволяет загрузить данные в таблицу "tradeDataSet.Suppliers". При необходимости она может быть перемещена или удалена. this.suppliersTableAdapter.Fill(this.tradeDataSet.Suppliers); // TODO: данная строка кода позволяет загрузить данные в таблицу "tradeDataSet.Stockroom". При необходимости она может быть перемещена или удалена. this.stockroomTableAdapter.Fill(this.tradeDataSet.Stockroom); // TODO: данная строка кода позволяет загрузить данные в таблицу "tradeDataSet.Purchase". При необходимости она может быть перемещена или удалена. this.purchaseTableAdapter.Fill(this.tradeDataSet.Purchase); // TODO: данная строка кода позволяет загрузить данные в таблицу "tradeDataSet.Product". При необходимости она может быть перемещена или удалена. this.productTableAdapter.Fill(this.tradeDataSet.Product); // TODO: данная строка кода позволяет загрузить данные в таблицу "tradeDataSet.Seller". При необходимости она может быть перемещена или удалена. this.sellerTableAdapter.Fill(this.tradeDataSet.Seller); // TODO: данная строка кода позволяет загрузить данные в таблицу "tradeDataSet.Employee". При необходимости она может быть перемещена или удалена. this.employeeTableAdapter.Fill(this.tradeDataSet.Employee); } privatevoid button1_Click(object sender, EventArgs e){ FormEmployee employee = new FormEmployee(); employee.Show();} privatevoid button2_Click(object sender, EventArgs e){ FormSeller seller = new FormSeller(); seller.Show();} privatevoid button3_Click(object sender, EventArgs e){ FormProduct product = new FormProduct(); product.Show();} privatevoid button4_Click(object sender, EventArgs e){ FormStockroom stockroom = new FormStockroom(); stockroom.Show();} privatevoid button5_Click(object sender, EventArgs e) { FormPurchase purchase = new FormPurchase(); purchase.Show(); } privatevoid button6_Click(object sender, EventArgs e) { FormSuppliers suppliers = new FormSuppliers(); suppliers.Show(); } } } Приложение И – FormProductpublicpartialclassFormProduct : Form { SqlConnection sqlConnection; public FormProduct() { InitializeComponent(); } privateasyncvoid FormProduct_Load(object sender, EventArgs e) { string connectionString = @"Data Source=LAPTOP-TTGL17LE\SQLEXPRESS;Initial Catalog=Trade;Integrated Security=True"; sqlConnection = new SqlConnection(connectionString); await sqlConnection.OpenAsync(); SqlDataReader sqlReader = null; SqlCommand command = new SqlCommand("SELECT * FROM[Product]", sqlConnection); try { sqlReader = await command.ExecuteReaderAsync(); listBox1.Items.Add("Code_product" + " " + "Code_suppliers" + " " + "Name" + " " + "Article" + " " + "Price"); while (await sqlReader.ReadAsync()) { listBox1.Items.Add(Convert.ToString(sqlReader["Code_product"]) + " " + Convert.ToString(sqlReader["Code_suppliers"]) + " " + Convert.ToString(sqlReader["Name"]) + " " + Convert.ToString(sqlReader["Article"]) + " " + Convert.ToString(sqlReader["Price"])); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), ex.Source.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (sqlReader != null) sqlReader.Close(); } } privatevoidвыходToolStripMenuItem_Click(object sender, EventArgs e) { if (sqlConnection != null&& sqlConnection.State != ConnectionState.Closed) sqlConnection.Close(); } privateasyncvoid button1_Click(object sender, EventArgs e) { SqlCommand command = new SqlCommand("INSERT INTO [Product] (Code_suppliers, Name, Article, Price)VALUES(@Code_suppliers, @Name, @Article, @Price)", sqlConnection); //command.Parameters.AddWithValue("Code_product", textBox2.Text); command.Parameters.AddWithValue("Code_suppliers", textBox3.Text); command.Parameters.AddWithValue("Name", textBox4.Text); command.Parameters.AddWithValue("Article", textBox5.Text); command.Parameters.AddWithValue("Price", textBox6.Text); await command.ExecuteNonQueryAsync(); } privateasyncvoidобновитьToolStripMenuItem_Click(object sender, EventArgs e) { listBox1.Items.Clear(); SqlDataReader sqlReader = null; SqlCommand command = new SqlCommand("SELECT * FROM[Product]", sqlConnection); try { sqlReader = await command.ExecuteReaderAsync(); listBox1.Items.Add("Code_product" + " " + "Code_suppliers" + " " + "Name" + " " + "Article" + " " + "Price"); while (await sqlReader.ReadAsync()) { listBox1.Items.Add(Convert.ToString(sqlReader["Code_product"]) + " " + Convert.ToString(sqlReader["Code_suppliers"]) + " " + Convert.ToString(sqlReader["Name"]) + " " + Convert.ToString(sqlReader["Article"]) + " " + Convert.ToString(sqlReader["Price"])); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), ex.Source.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (sqlReader != null) sqlReader.Close(); } } privatevoid label2_Click(object sender, EventArgs e) { } privateasyncvoid button2_Click(object sender, EventArgs e) { } } Приложение К – FormPurchasepublicpartialclassFormPurchase : Form { SqlConnection sqlConnection; public FormPurchase() { InitializeComponent(); } privateasyncvoid FormPurchase_Load(object sender, EventArgs e) { // TODO: данная строка кода позволяет загрузить данные в таблицу "tradeDataSet.Purchase". При необходимости она может быть перемещена или удалена. this.purchaseTableAdapter.Fill(this.tradeDataSet.Purchase); string connectionString = @"Data Source=LAPTOP-TTGL17LE\SQLEXPRESS;Initial Catalog=Trade;Integrated Security=True"; sqlConnection = new SqlConnection(connectionString); await sqlConnection.OpenAsync(); SqlDataReader sqlReader = null; SqlCommand command = new SqlCommand("SELECT * FROM[Purchase]", sqlConnection); try { sqlReader = await command.ExecuteReaderAsync(); listBox1.Items.Add("Code_purchase" + " " + "Code_seller" + " " + "Code_product" + " " + "Amount" + " " + "Final_cost" + " "+ "Date_purchase" + " " + "Paid"); while (await sqlReader.ReadAsync()) { listBox1.Items.Add(Convert.ToString(sqlReader["Code_purchase"]) + " " + Convert.ToString(sqlReader["Code_seller"]) + " " + Convert.ToString(sqlReader["Code_product"]) + " " + Convert.ToString(sqlReader["Amount"]) + " " + Convert.ToString(sqlReader["Final_cost"])+ " " + Convert.ToString(sqlReader["Date_purchase"]) + " "+ Convert.ToString(sqlReader["Paid"])); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), ex.Source.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (sqlReader != null) sqlReader.Close(); } } privatevoid button1_Click(object sender, EventArgs e) { this.Validate(); this.purchaseBindingSource.EndEdit(); this.purchaseTableAdapter.Update(this.tradeDataSet.Purchase); } privatevoidвыходToolStripMenuItem_Click(object sender, EventArgs e) { if (sqlConnection != null&& sqlConnection.State != ConnectionState.Closed) sqlConnection.Close(); } privateasyncvoid button1_Click_1(object sender, EventArgs e) { SqlCommand command = new SqlCommand("INSERT INTO [Purchase] (Code_seller, Code_product, Amount, Final_cost, Date_purchase,Paid)VALUES(@Code_seller, @Code_product, @Amount, @Final_cost, @Date_purchase, @Paid)", sqlConnection); //command.Parameters.AddWithValue("Code_purchase", textBox1.Text); command.Parameters.AddWithValue("Code_seller", textBox2.Text); command.Parameters.AddWithValue("Code_product", textBox3.Text); command.Parameters.AddWithValue("Amount", textBox4.Text); command.Parameters.AddWithValue("Final_cost", textBox5.Text); command.Parameters.AddWithValue("Date_purchase", textBox6.Text); command.Parameters.AddWithValue("Paid", textBox7.Text); await command.ExecuteNonQueryAsync(); } privateasyncvoidобновитьToolStripMenuItem_Click(object sender, EventArgs e) { listBox1.Items.Clear(); SqlDataReader sqlReader = null; SqlCommand command = new SqlCommand("SELECT * FROM[Purchase]", sqlConnection); try {sqlReader = await command.ExecuteReaderAsync(); listBox1.Items.Add("Code_purchase" + " " + "Code_seller" + " " + "Code_product" + " " + "Amount" + " " + "Final_cost" + " " + "Date_purchase" + " " + "Paid"); while (await sqlReader.ReadAsync()) {listBox1.Items.Add(Convert.ToString(sqlReader["Code_purchase"]) + " " + Convert.ToString(sqlReader["Code_seller"]) + " " + Convert.ToString(sqlReader["Code_product"]) + " " + Convert.ToString(sqlReader["Amount"]) + " " + Convert.ToString(sqlReader["Final_cost"]) + " " + Convert.ToString(sqlReader["Date_purchase"]) + " " + Convert.ToString(sqlReader["Paid"]));} } catch (Exception ex) {MessageBox.Show(ex.Message.ToString(), ex.Source.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);} Finally { if (sqlReader != null) sqlReader.Close();} } } Приложение Л – FormStockroompublicpartialclassFormStockroom : Form { SqlConnection sqlConnection; public FormStockroom() { InitializeComponent(); } privateasyncvoid FormSuppliers_Load(object sender, EventArgs e) { string connectionString = @"Data Source=LAPTOP-TTGL17LE\SQLEXPRESS;Initial Catalog=Trade;Integrated Security=True"; sqlConnection = new SqlConnection(connectionString); await sqlConnection.OpenAsync(); SqlDataReader sqlReader = null; SqlCommand command = new SqlCommand("SELECT * FROM[Stockroom]", sqlConnection); try {sqlReader = await command.ExecuteReaderAsync(); listBox1.Items.Add("Code_product" + " " + "Amount_product"); while (await sqlReader.ReadAsync()) { listBox1.Items.Add(Convert.ToString(sqlReader["Code_product"]) + " " + Convert.ToString(sqlReader["Amount_product"])); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), ex.Source.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (sqlReader != null) sqlReader.Close(); } } privatevoidвыходToolStripMenuItem_Click(object sender, EventArgs e) { if (sqlConnection != null&& sqlConnection.State != ConnectionState.Closed) sqlConnection.Close(); } privateasyncvoid button1_Click(object sender, EventArgs e) { SqlCommand command = new SqlCommand("INSERT INTO [Stockroom] (Code_product, Amount_product)VALUES(@Code_product, @Amount_product)", sqlConnection); command.Parameters.AddWithValue("Code_product", textBox3.Text); command.Parameters.AddWithValue("Amount_product", textBox4.Text); await command.ExecuteNonQueryAsync(); } privateasyncvoidобновитьToolStripMenuItem_Click(object sender, EventArgs e) { listBox1.Items.Clear(); SqlDataReader sqlReader = null; SqlCommand command = new SqlCommand("SELECT * FROM[Stockroom]", sqlConnection); try { sqlReader = await command.ExecuteReaderAsync(); listBox1.Items.Add("Code_product" + " " + "Amount_product"); while (await sqlReader.ReadAsync()) { listBox1.Items.Add(Convert.ToString(sqlReader["Code_product"]) + " " + Convert.ToString(sqlReader["Amount_product"])); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), ex.Source.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (sqlReader != null) sqlReader.Close(); } } } Приложение М – FormEmployeeПриложение Н – FormSellerПриложение О – FormSuppliers |