Программное средство автоматизации учёта операций обменного пункта валют

Проектирование программного средства по навигации и сортировке операций по заданным критериям. Разработка логической модели для физической реализации базы данных. Схематичный план формы для добавления сотрудников. Результаты выполнения тестовых заданий.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 21.12.2016
Размер файла 750,9 K

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

}

privatevoid button10_Click(object sender, EventArgs e)

{

string f = textBox10.Text;

string i = textBox11.Text;

string o = textBox12.Text;

string n = textBox9.Text;

string s = textBox8.Text;

string com = "insert into pasport (nomer, seria) values(" + n + ", \"" + s + "\"); ";

GetComments(com);

dataGridView4.DataSource = GetComments("SELECT id_pasporta from pasport");

string id = dataGridView4.Rows[dataGridView4.RowCount - 1].Cells[0].Value.ToString();

com = "insert into pokupatel(familia,ima,otchestvo,id_pasporta) values (\"" + f + "\",\"" + i + "\",\"" + o + "\"," + id + ");";

GetComments(com);

dataGridView5.DataSource = GetComments(@"SELECT familia,ima,otchestvo, seria,nomer FROM pokupatel,pasport WHERE pokupatel.id_pasporta=pasport.id_pasporta;");

Razmer(dataGridView5);

}

int nom2;

privatevoid dataGridView6_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)

{

nom2 = dataGridView6.CurrentRow.Index;

textBox14.Text = dataGridView6.Rows[nom2].Cells[2].Value.ToString();

textBox15.Text = dataGridView6.Rows[nom2].Cells[3].Value.ToString();

}

privatevoid button11_Click(object sender, EventArgs e)

{

string pok = textBox14.Text;

string prod = textBox15.Text;

string id = dataGridView6.Rows[nom2].Cells[0].Value.ToString();

string com = "update pokupka_prodacha set pokupak=" + pok + ", prodacha=" + prod + " where id_pokupki =" + id + ";";

GetComments(com);

dataGridView6.DataSource = GetComments(@"SELECT id_pokupki,nazvanie, pokupak,prodacha FROM pokupka_prodacha, valuta where pokupka_prodacha.id_valuti=valuta.id_valuti;");

Razmer(dataGridView6);

dataGridView6.Columns[0].Visible = false;

}privatevoid button12_Click(object sender, EventArgs e)

{

dataGridView9.DataSource = GetComments(@"SELECT sotrudnik.familia, pokupatel.familia,tip_operacii.operacia, data,summa_vvoda,itog FROM tip_operacii, kassa, operacia o,sotrudnik,pokupatel where o.id_sotrudika=sotrudnik.id_sotrudika AND o.id_pokupatela=pokupatel.id_pokupatela AND o.id_tipa=tip_operacii.id_tipa AND o.id_kassi=kassa.id_kassi

ORDER BY data;");

Razmer(dataGridView9);

}

privatevoid button13_Click(object sender, EventArgs e)

{

dataGridView9.DataSource = GetComments(@"SELECT sotrudnik.familia, pokupatel.familia,tip_operacii.operacia, data,summa_vvoda,itog FROM tip_operacii, kassa, operacia o,sotrudnik,pokupatel where o.id_sotrudika=sotrudnik.id_sotrudika AND o.id_pokupatela=pokupatel.id_pokupatela AND o.id_tipa=tip_operacii.id_tipa AND o.id_kassi=kassa.id_kassi

ORDER BY summa_vvoda;");

Razmer(dataGridView9);

}

privatevoid button14_Click(object sender, EventArgs e)

{

Добавление f = newДобавление();

f.ShowDialog();

dataGridView9.DataSource = GetComments(@"SELECT sotrudnik.familia, pokupatel.familia,tip_operacii.operacia, data,summa_vvoda,itog

FROM tip_operacii, kassa, operacia o,sotrudnik,pokupatel

where o.id_sotrudika=sotrudnik.id_sotrudika AND o.id_pokupatela=pokupatel.id_pokupatela AND o.id_tipa=tip_operacii.id_tipa AND o.id_kassi=kassa.id_kassi;");

dataGridView9.Columns[0].HeaderText = "Фамилиясотрудника";

dataGridView9.Columns[1].HeaderText = "Фамилияпокупателя";

Razmer(dataGridView9);

}

}

}

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;

using MySql.Data.MySqlClient;

namespaceБД_и_СУБД

{

publicpartialclassДобавление : Form

{

publicДобавление()

{

InitializeComponent();

}

MySqlConnectionStringBuilder mysqlCSB;

privateDataTable GetComments(string queryString)

{

DataTable dt = newDataTable();

using (MySqlConnection con = newMySqlConnection())

{

con.ConnectionString = mysqlCSB.ConnectionString;

MySqlCommand com = newMySqlCommand(queryString, con);

try

{

con.Open();

using (MySqlDataReader dr = com.ExecuteReader())

{

if (dr.HasRows)

{

dt.Load(dr);

}

}

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

}

return dt;

}

privatevoidДобавление_Load(object sender, EventArgs e)

{

mysqlCSB = newMySqlConnectionStringBuilder();

mysqlCSB.Server = "localhost";

mysqlCSB.Database = "obmen";

mysqlCSB.UserID = "root";

mysqlCSB.Password = "qwerty8511";

dataGridView1.DataSource = GetComments("SELECT id_sotrudika,familia,ima,otchestvo FROM sotrudnik;");

dataGridView1.Columns[0].Visible = false;

dataGridView2.DataSource = GetComments("SELECT id_pokupatela,familia,ima,otchestvo FROM pokupatel;");

dataGridView2.Columns[0].Visible = false;

}

privatevoid button1_Click(object sender, EventArgs e)

{

try

{

string id_s = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString();

string id_p = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[0].Value.ToString();

string sum = textBox1.Text;

string id_v = comboBox1.SelectedIndex.ToString();

string itog = textBox2.Text;

string id_t = comboBox2.SelectedIndex.ToString();

string com = "insert into kassa (summa_vvoda, itog, id_pokupki) values (" + sum + ", " + itog + "," + id_v + "); ";

GetComments(com);

dataGridView3.DataSource = GetComments("SELECT id_kassi from kassa;");

string id_k = dataGridView3.Rows[dataGridView3.RowCount - 1].Cells[0].Value.ToString();

com = "insert into operacia (id_sotrudika, id_tipa,id_kassi, id_pokupatela, data) values (" + id_s + "," + id_t + "," + id_k + "," + id_p + ", NOW())";

GetComments(com);

}

catch { MessageBox.Show("Ошибка! Проверьтевведённыеданные!"); }

}

}

}

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БД_и_СУБД

{

publicpartialclassAdmin : Form

{

public Admin()

{

InitializeComponent();

}

privatevoid button1_Click(object sender, EventArgs e)

{

if (textBox1.Text == "admin"&& textBox2.Text == "admin")

{

Form1 f = this.Owner asForm1;

f.ADM = true;

}

else

{

}

Close();

}

}

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.IO;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.Reflection;

using iTextSharp.text.pdf;

using iTextSharp.text;

namespaceБД_и_СУБД

{

publicpartialclassВывод_результата : Form

{

publicВывод_результата()

{

InitializeComponent();

}

privateDataTable dt;

publicDataTable DT

{

set { dt = value; }

}

privateDataGridView Razmer(DataGridView dg)

{

dg.Width = dg.ColumnCount * 100 + 45;

if (dg.RowCount > 5)

{

dg.Height = 150;

}

else

dg.Height = dg.RowCount * 50;

return dg;

}

privatevoidВывод_результата_Load(object sender, EventArgs e)

{

dataGridView1.DataSource = dt;

Razmer(dataGridView1);

if (this.Width < dataGridView1.Width)

{

this.Width = dataGridView1.Width + 100;

}

}

privatevoid button1_Click(object sender, EventArgs e)

{

BaseFont bs = BaseFont.CreateFont(Application.StartupPath + @"\Times New Roman.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);

iTextSharp.text.Font f = new iTextSharp.text.Font(bs);

PdfPTable pdfTable = newPdfPTable(dataGridView1.ColumnCount);

pdfTable.DefaultCell.Padding = 3;

pdfTable.WidthPercentage = 30;

pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;

pdfTable.DefaultCell.BorderWidth = 1;

//Adding Header row

foreach (DataGridViewColumn column in dataGridView1.Columns)

{

PdfPCell cell = newPdfPCell(newPhrase(column.HeaderText,f));

cell.BackgroundColor = new iTextSharp.text.Color(240, 240, 240);

pdfTable.AddCell(cell);

}

//Adding DataRow

foreach (DataGridViewRow row in dataGridView1.Rows)

{

foreach (DataGridViewCell cell in row.Cells)

{

string c = cell.Value.ToString();

PdfPCell col = newPdfPCell(newPhrase(c,f));

pdfTable.AddCell(col);

}

}

//Exporting to PDF

saveFileDialog1.Filter = "PDF файлы(.pdf)|*.pdf|Всефайлы|*.*";

saveFileDialog1.FilterIndex = 1;

saveFileDialog1.RestoreDirectory = true;

saveFileDialog1.ShowDialog();

string s = saveFileDialog1.FileName;

using (FileStream stream = newFileStream(s, FileMode.Create))

{

Document pdfDoc = newDocument(PageSize.A2, 10f, 10f, 10f, 0f);

PdfWriter.GetInstance(pdfDoc, stream);

pdfDoc.Open();

pdfDoc.Add(pdfTable);

pdfDoc.Close();

stream.Close();

}

}

}

}

Размещено на Allbest.ru


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.