- •Обоснование выбора языка программирования
- •Система управления базами данных Microsoft sql Server
- •Описание предметной области
- •2 Создание приложения
- •2.1 Постановка задачи (выбор темы по вариантам)
- •2.2 Этапы проектирования базы данных
- •2.3 Логическая модель базы данных
- •2.4 Физическая модель бд
- •2.5 Разработка алгоритма программного модуля
- •2.6 Описание Microsoft Visual Studio
- •2.7 Средства разработки приложений баз данных
- •2.8 Разработка экранных форм: главной формы и рабочих форм
- •2.9 Структура программы
- •Заключение
- •Библиографический список
- •Приложение 2 – Листинг программы
Приложение 2 – Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace UchetObj
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
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 UchetObj
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void оПрограммеToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox1 tables = new AboutBox1();
tables.Show();
}
private void выходToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void материалыToolStripMenuItem_Click(object sender, EventArgs e)
{
Материалы tables = new Материалы();
tables.Show();
}
private void объектыToolStripMenuItem_Click(object sender, EventArgs e)
{
Объекты tables = new Объекты();
tables.Show();
}
private void бригадыToolStripMenuItem_Click(object sender, EventArgs e)
{
Бригады tables = new Бригады();
tables.Show();
}
private void потребностиToolStripMenuItem_Click(object sender, EventArgs e)
{
Потребности_объектов tables = new Потребности_объектов();
tables.Show();
}
private void группыТоваровToolStripMenuItem_Click(object sender, EventArgs e)
{
Группы_товаров tables = new Группы_товаров();
tables.Show();
}
private void производителиToolStripMenuItem_Click(object sender, EventArgs e)
{
Производители_товаров tables = new Производители_товаров();
tables.Show();
}
private void типыОбъектовToolStripMenuItem_Click(object sender, EventArgs e)
{
Типы_объектов tables = new Типы_объектов();
tables.Show();
}
private void суммаToolStripMenuItem_Click(object sender, EventArgs e)
{
Сумма tables = new Сумма();
tables.Show();
}
private void среднееToolStripMenuItem_Click(object sender, EventArgs e)
{
Среднее tables = new Среднее();
tables.Show();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
namespace UchetObj
{
partial class AboutBox1 : Form
{
public AboutBox1()
{
InitializeComponent();
this.Text = String.Format("About {0}", AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text = AssemblyCompany;
this.textBoxDescription.Text = AssemblyDescription;
}
#region Assembly Attribute Accessors
public string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}
public string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
public string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
public string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
public string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
public string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
#endregion
private void okButton_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
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 UchetObj
{
public partial class Бригады : Form
{
public Бригады()
{
InitializeComponent();
}
private void Бригады_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Бригады' table. You can move, or remove it, as needed.
this.бригадыTableAdapter.Fill(this.uchetobjDataSet.Бригады);
}
private void button2_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить запись?", "Учет объектов",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
бригадыBindingSource.RemoveCurrent();
this.бригадыTableAdapter.Update(this.uchetobjDataSet.Бригады);
}
}
private void button1_Click(object sender, EventArgs e)
{
this.бригадыTableAdapter.Update(this.uchetobjDataSet.Бригады);
}
}
}
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 UchetObj
{
public partial class Группы_товаров : Form
{
public Группы_товаров()
{
InitializeComponent();
}
private void Группы_товаров_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Группы_материалов' table. You can move, or remove it, as needed.
this.группы_материаловTableAdapter.Fill(this.uchetobjDataSet.Группы_материалов);
}
private void button2_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить запись?", "Учет объектов",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
группыМатериаловBindingSource.RemoveCurrent();
this.группы_материаловTableAdapter.Update(this.uchetobjDataSet.Группы_материалов);
}
}
private void button1_Click(object sender, EventArgs e)
{
this.группы_материаловTableAdapter.Update(this.uchetobjDataSet.Группы_материалов);
}
}
}
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 UchetObj
{
public partial class Материалы : Form
{
public Материалы()
{
InitializeComponent();
}
private void Материалы_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Материалы' table. You can move, or remove it, as needed.
this.материалыTableAdapter.Fill(this.uchetobjDataSet.Материалы);
}
private void button2_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить запись?", "Учет объектов",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
материалыBindingSource.RemoveCurrent();
this.материалыTableAdapter.Update(this.uchetobjDataSet.Материалы);
}
}
private void button1_Click(object sender, EventArgs e)
{
this.материалыTableAdapter.Update(this.uchetobjDataSet.Материалы);
}
}
}
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 UchetObj
{
public partial class Объекты : Form
{
public Объекты()
{
InitializeComponent();
}
private void Объекты_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Объекты' table. You can move, or remove it, as needed.
this.объектыTableAdapter.Fill(this.uchetobjDataSet.Объекты);
}
private void button2_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить запись?", "Учет объектов",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
объектыBindingSource.RemoveCurrent();
this.объектыTableAdapter.Update(this.uchetobjDataSet.Объекты);
}
}
private void button1_Click(object sender, EventArgs e)
{
this.объектыTableAdapter.Update(this.uchetobjDataSet.Объекты);
}
}
}
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 UchetObj
{
public partial class Потребности_объектов : Form
{
public Потребности_объектов()
{
InitializeComponent();
}
private void Потребности_объектов_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Потребности' table. You can move, or remove it, as needed.
this.потребностиTableAdapter.Fill(this.uchetobjDataSet.Потребности);
}
private void button2_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить запись?", "Учет объектов",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
потребностиBindingSource.RemoveCurrent();
this.потребностиTableAdapter.Update(this.uchetobjDataSet.Потребности);
}
}
}
}
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 UchetObj
{
public partial class Производители_товаров : Form
{
public Производители_товаров()
{
InitializeComponent();
}
private void Производители_товаров_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Производители' table. You can move, or remove it, as needed.
this.производителиTableAdapter.Fill(this.uchetobjDataSet.Производители);
}
private void button2_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить запись?", "Учет объектов",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
производителиBindingSource.RemoveCurrent();
this.производителиTableAdapter.Update(this.uchetobjDataSet.Производители);
}
}
private void button1_Click(object sender, EventArgs e)
{
this.производителиTableAdapter.Update(this.uchetobjDataSet.Производители);
}
}
}
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 UchetObj
{
public partial class Среднее : Form
{
public Среднее()
{
InitializeComponent();
}
private void Среднее_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Sred' table. You can move, or remove it, as needed.
this.SredTableAdapter.Fill(this.uchetobjDataSet.Sred,1,1);
this.reportViewer1.RefreshReport();
}
}
}
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 UchetObj
{
public partial class Сумма : Form
{
public Сумма()
{
InitializeComponent();
}
private void Сумма_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Cost' table. You can move, or remove it, as needed.
this.CostTableAdapter.Fill(this.uchetobjDataSet.Cost,1,1);
this.reportViewer1.RefreshReport();
}
}
}
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 UchetObj
{
public partial class Типы_объектов : Form
{
public Типы_объектов()
{
InitializeComponent();
}
private void Типы_объектов_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'uchetobjDataSet.Типы_объектов' table. You can move, or remove it, as needed.
this.типы_объектовTableAdapter.Fill(this.uchetobjDataSet.Типы_объектов);
}
private void button2_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить запись?", "Учет объектов",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
типыОбъектовBindingSource.RemoveCurrent();
this.типы_объектовTableAdapter.Update(this.uchetobjDataSet.Типы_объектов);
}
}
private void button1_Click(object sender, EventArgs e)
{
this.типы_объектовTableAdapter.Update(this.uchetobjDataSet.Типы_объектов);
}
}
}
