Добавлен: 05.04.2023
Просмотров: 515
Скачиваний: 1
СОДЕРЖАНИЕ
ГЛАВА 1. ТЕОРЕТИЧЕСКИЕ АСПЕКТЫ СРЕДСТВ РАЗРАБОТКИ КЛИЕНТСКИХ ПРОГРАММ
1.1 Раскрытие ключевых понятий
1.2 Элементы бизнес-процессов энергетического менеджмента
1.3 Описание существующих информационных систем
ГЛАВА 2. ПРОЕКТИРОВАНИЕ АРХИТЕКТУРЫ ИНФОРМАЦИОННОЙ СИСТЕМЫ
Глава 3. Разработка прототипа информационной системы
SqlConnection con = new SqlConnection("Data Source=928D\\SQLEXPRESS;Initial Catalog=EMIS;Integrated Security=true");
SqlDataAdapter str = new SqlDataAdapter(@"delete from Counter where id = '" + Convert.ToInt32(id) + "'", con);
DataTable dt = new DataTable();
try
{
con.Open();
str.Fill(dt);
}
finally
{
con.Close();
}
}
private void deleteProduction(string id)
{
SqlConnection con = new SqlConnection("Data Source=928D\\SQLEXPRESS;Initial Catalog=EMIS;Integrated Security=true");
SqlDataAdapter str = new SqlDataAdapter(@"delete from Production where id = '" + Convert.ToInt32(id) + "'", con);
DataTable dt = new DataTable();
try
{
con.Open();
str.Fill(dt);
}
finally
{
con.Close();
}
}
private void deleteRates(string id)
{
SqlConnection con = new SqlConnection("Data Source=928D\\SQLEXPRESS;Initial Catalog=EMIS;Integrated Security=true");
SqlDataAdapter str = new SqlDataAdapter(@"delete from Rates where id = '" + Convert.ToInt32(id) + "'", con);
DataTable dt = new DataTable();
try
{
con.Open();
str.Fill(dt);
}
finally
{
con.Close();
}
}
protected void plan_Click(object sender, EventArgs e)
{
Response.Redirect("monitoring.aspx");
}
protected void exportData_Click(object sender, EventArgs e)
{
Response.Redirect("dataexport.aspx");
}
- Класс просмотра данных.
protected void resourceType_Load(object sender, EventArgs e)
{
SqlConnection sc = new SqlConnection("Data Source=928D\\SQLEXPRESS;Initial Catalog=EMIS;Integrated Security=true");
SqlDataAdapter adap = new SqlDataAdapter(@"select Counter.id, Resource.resourceName, Resource.measure, Counter.place from Resource, Counter where Counter.resource = Resource.id and company LIKE '" + Convert.ToInt32(Session["company_id"].ToString().Split(' ').ToArray()[0]) + "'", sc);
DataTable dt = new DataTable();
try
{
sc.Open();
adap.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
if (resourceType.Items.FindByValue(dt.Rows[i][0].ToString()) == null)
resourceType.Items.Add(new ListItem(dt.Rows[i][1].ToString() + " " + dt.Rows[i][2].ToString() + " " + dt.Rows[i][3].ToString(), dt.Rows[i][0].ToString()));
}
finally
{
sc.Close();
}
}
private void showDataTable(string counterId)
{
Table1.Rows.Clear();
List<TableRow> rows = new List<TableRow>();
List<TableCell> cells = new List<TableCell>();
cells.Add(new TableCell { Text = "Дата" });
cells.Add(new TableCell { Text = "Счетчик" });
cells.Add(new TableCell { Text = "Ресурс" });
cells.Add(new TableCell { Text = "Норма" });
cells.Add(new TableCell { Text = "Факт" });
TableRow row = new TableRow();
foreach (var item in cells)
{
row.Cells.Add(item);
}
rows.Add(row);
SqlConnection sc = new SqlConnection("Data Source=928D\\SQLEXPRESS;Initial Catalog=EMIS;Integrated Security=true");
SqlDataAdapter adap = new SqlDataAdapter(@"select Data.date, Counter.place, resourceName, Resource.measure, Counter.normal, Data.value from Resource, Data, Counter where Data.counter = Counter.id and Counter.resource = Resource.id and Counter.id = '" + counterId + "' and company LIKE '" + Convert.ToInt32(Session["company_id"].ToString().Split(' ').ToArray()[0]) + "' order by date", sc);
DataTable dt = new DataTable();
try
{
sc.Open();
adap.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
cells = new List<TableCell>();
cells.Add(new TableCell { Text = Convert.ToDateTime(dt.Rows[i][0]).ToShortDateString() });
cells.Add(new TableCell { Text = dt.Rows[i][1].ToString() });
cells.Add(new TableCell { Text = dt.Rows[i][2].ToString() + " " + dt.Rows[i][3].ToString() });
cells.Add(new TableCell { Text = dt.Rows[i][4].ToString() });
cells.Add(new TableCell { Text = dt.Rows[i][5].ToString() });
row = new TableRow();
foreach (var item in cells)
row.Cells.Add(item);
rows.Add(row);
}
foreach (var r in rows)
Table1.Rows.Add(r);
Table1.Visible = true;
}
finally
{
sc.Close();
}
Table1.Visible = true;
}
private void showDataChart(string counterId)
{
SqlConnection sc = new SqlConnection("Data Source=928D\\SQLEXPRESS;Initial Catalog=EMIS;Integrated Security=true");
SqlDataAdapter adap = new SqlDataAdapter(@"select Data.date, Counter.place, resourceName, Resource.measure, Counter.normal, Data.value
from Resource, Data, Counter where Data.counter = Counter.id and Counter.resource = Resource.id
and Counter.id = '" + counterId + "' and company LIKE '" +
Convert.ToInt32(Session["company_id"].ToString().Split(' ').ToArray()[0]) + "' order by date", sc);
DataTable dt = new DataTable();
try
{
sc.Open();
adap.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
var series = new Series();
series.Points.AddXY(Convert.ToDateTime(dt.Rows[i][0].ToString()).Day, Convert.ToInt32(dt.Rows[i][5].ToString()));
series.Color = System.Drawing.Color.Black;
Chart1.Series.Add(series);
}
}
finally
{
sc.Close();
}
Chart1.Visible = true;
}
- Класс подсчета потребления.
private void checkDay()
{
List<TableRow> rows = new List<TableRow>();
List<TableCell> cells = new List<TableCell>();
cells.Add(new TableCell{ Text = "Дата" });
cells.Add(new TableCell { Text = "Ресурс" });