- •Дипломная работа
- •Реферат
- •Содержание
- •Введение
- •Описание предметной области
- •Модель бизнес-процессов
- •Обзор ис «эпос»
- •Обзор аналогов
- •Подсистема оповещений и уведомлений системы «Дело»
- •Програм Лайн: Уведомления о событиях
- •Подсистема «Выписка Онлайн» в дбо bs-Clientx64
- •Сравнительная таблица аналогов
- •Постановка задачи
- •Контур Подсистемы
- •Инфологическая модель предметной области
- •Виды обеспечения
- •Информационное обеспечение
- •Описание атрибутов таблицы notify_list_wells
- •Описание атрибутов таблицыQuality_day_rec
- •Описание атрибутов таблицы well
- •Описание атрибутов таблицы notify_events
- •Описание атрибутов таблицы notify_active_events
- •Описание атрибутов таблицы notify_request_data
- •Математическое обеспечение
- •Программное обеспечение
- •Подсистема связи с субд
- •Описание модулей подсистемы связи с субд
- •Api субд
- •Описание хранимых процедур
- •Модуль опроса базы данных
- •Модуль оперативного оповещения
- •Модуль формирования заявок
- •Модуль формирования подписок
- •Техническое обеспечение
- •Описание интерфейса
- •Оповещение по событиям
- •Оповещение о запросах
- •Контроль ввода данных
- •Технико-эксплутационные характеристики
- •Заключение
- •Список использованных источников
- •Приложение 1
- •Приложение 2
Приложение 1
Листинг класса EventNotifications
class EventNotifications
{
private static TimeSpan minRefreshPeriod = new TimeSpan(0, 1, 0);
private UI.Main.FormMain formMain_;
private string connectionString_;
private string schema_;
private int notificationsRefreshPeriod_;
private DateTime nextRefreshTime_;
private TimeSpan refreshPeriod_;
private System.Windows.Forms.NotifyIcon notifyIcon_;
System.Drawing.Icon[] icons_ = null;
public IdleHandler_EventNotifications(
UI.Main.FormMain formMain,
string server,
string sid,
string schema,
string user,
string password)
{
formMain_ = formMain;
{
int indexOfColon = server.IndexOf(':');
string optionalPort = ((indexOfColon >= 0) ? string.Format(@"Port={0};", server.Substring(indexOfColon + 1)) : "");
connectionString_ = string.Format(
"Server={0};Sid={1};User Id={2};Password={3};Pooling=False;Direct=True;{4}",
((indexOfColon >= 0) ? server.Substring(0, indexOfColon) : server),
sid, user, password, optionalPort);
}
schema_ = schema;
notificationsRefreshPeriod_ = 0;
nextRefreshTime_ = DateTime.Now;
notifyIcon_ = null;
icons_ = null;
if (formMain_ != null) formMain_.setRefreshEventNotifyIconDelegate(refreshNotifyIcon);
}
public bool onIdle()
{
if (formMain_ != null)
{
if (DateTime.Now >= nextRefreshTime_)
{
int notificationsRefreshPeriod = formMain_.eventNotificationsRefreshPeriod();
if (notificationsRefreshPeriod_ != notificationsRefreshPeriod)
{
notificationsRefreshPeriod_ = notificationsRefreshPeriod;
refreshPeriod_ = new TimeSpan(
notificationsRefreshPeriod / 60,
notificationsRefreshPeriod % 60,
0);
if (notifyIcon_ == null)
{
notifyIcon_ = new System.Windows.Forms.NotifyIcon();
notifyIcon_.Text = @"ЭПОС: Оповещения о событиях";
}
if (icons_ == null)
{
icons_ = new System.Drawing.Icon[]
{
new System.Drawing.Icon("Resources/notify_round_00.ico"),
new System.Drawing.Icon("Resources/notify_round_01.ico"),
new System.Drawing.Icon("Resources/notify_round_02.ico"),
new System.Drawing.Icon("Resources/notify_round_03.ico"),
new System.Drawing.Icon("Resources/notify_round_04.ico"),
new System.Drawing.Icon("Resources/notify_round_05.ico"),
new System.Drawing.Icon("Resources/notify_round_06.ico"),
new System.Drawing.Icon("Resources/notify_round_07.ico"),
new System.Drawing.Icon("Resources/notify_round_08.ico"),
new System.Drawing.Icon("Resources/notify_round_09.ico"),
new System.Drawing.Icon("Resources/notify_round_10.ico"),
};
}
}
refreshNotifyIcon();
}
return true;
}
return false;
}
Приложение 2
Листинг класса RequestNotifications
class RequestNotifications
{
private UI.Main.FormMain formMain_;
private string connectionString_;
private string schema_;
private int notificationsRefreshPeriod_;
private DateTime nextRefreshTime_;
private TimeSpan refreshPeriod_;
private System.Windows.Forms.NotifyIcon notifyIcon_;
System.Drawing.Icon[] icons_ = null;
public IdleHandler_RequestNotifications(
UI.Main.FormMain formMain,
string server,
string sid,
string schema,
string user,
string password)
{
formMain_ = formMain;
{
int indexOfColon = server.IndexOf(':');
string optionalPort = ((indexOfColon >= 0) ? string.Format(@"Port={0};", server.Substring(indexOfColon + 1)) : "");
connectionString_ = string.Format(
"Server={0};Sid={1};User Id={2};Password={3};Pooling=False;Direct=True;{4}",
((indexOfColon >= 0) ? server.Substring(0, indexOfColon) : server),
sid, user, password, optionalPort);
}
schema_ = schema;
notificationsRefreshPeriod_ = 0;
nextRefreshTime_ = DateTime.Now;
notifyIcon_ = null;
icons_ = null;
if (formMain_ != null) formMain_.setRefreshRequestNotifyIconDelegate(refreshNotifyIcon);
}
public bool onIdle()
{
if (formMain_ != null)
{
if (DateTime.Now >= nextRefreshTime_)
{
int notificationsRefreshPeriod = formMain_.requestNotificationsRefreshPeriod();
if (notificationsRefreshPeriod_ != notificationsRefreshPeriod)
{
notificationsRefreshPeriod_ = notificationsRefreshPeriod;
if (notifyIcon_ == null)
{
notifyIcon_ = new System.Windows.Forms.NotifyIcon();
notifyIcon_.Text = @"ЭПОС: Оповещения о запросах";
}
if (icons_ == null)
{
icons_ = new System.Drawing.Icon[]
{
new System.Drawing.Icon("Resources/notify_square_00.ico"),
new System.Drawing.Icon("Resources/notify_square_01.ico"),
new System.Drawing.Icon("Resources/notify_square_02.ico"),
new System.Drawing.Icon("Resources/notify_square_03.ico"),
new System.Drawing.Icon("Resources/notify_square_04.ico"),
new System.Drawing.Icon("Resources/notify_square_05.ico"),
new System.Drawing.Icon("Resources/notify_square_06.ico"),
new System.Drawing.Icon("Resources/notify_square_07.ico"),
new System.Drawing.Icon("Resources/notify_square_08.ico"),
new System.Drawing.Icon("Resources/notify_square_09.ico"),
new System.Drawing.Icon("Resources/notify_square_10.ico"),
};
}
refreshNotifyIcon();
}
}
return true;
}
return false;
}
private bool refreshData(ref int requestsCount)
{
bool isDataRefreshed = false;
using (Devart.Data.Oracle.OracleConnection connection = new Devart.Data.Oracle.OracleConnection(connectionString_))
{
connection.Open();
isDataRefreshed = refreshData(connection, ref requestsCount);
connection.Close();
}
return isDataRefreshed;
}
private bool refreshData(Devart.Data.Oracle.OracleConnection connection, ref int requestsCount)
{
bool isDataRefreshed = false;
using (Devart.Data.Oracle.OracleCommand oracleCommand = new Devart.Data.Oracle.OracleCommand(schema_ + ".notification.get_data_requests_count", connection))
{
oracleCommand.CommandType = System.Data.CommandType.StoredProcedure;
try
{
oracleCommand.Parameters.Add(new Devart.Data.Oracle.OracleParameter("CNT", Devart.Data.Oracle.OracleDbType.Number, System.Data.ParameterDirection.Output));
oracleCommand.ExecuteNonQuery();
object objRequestsCount = oracleCommand.Parameters[0].Value;
if ((objRequestsCount != null) && !(objRequestsCount is DBNull))
requestsCount = Convert.ToInt32(objRequestsCount);
isDataRefreshed = true;
}
catch (Devart.Data.Oracle.OracleException ex)
{
if (ex.Code != 4068)
{
System.Windows.Forms.MessageBox.Show(Sys.Utils.textOracleUserExc(ex), "Ошибка",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Exclamation);
if (ex.Code == 6550) {
requestsCount = 0; isDataRefreshed = true;
}
}
}
}
return isDataRefreshed;
}
public void refreshNotifyIcon()
{
int requestsCount = 0;
Devart.Data.Oracle.OracleConnection connection = Sys.DB.DBManager.getConnection();
bool isDataRefreshed = ((connection != null) && refreshData(connection, ref requestsCount));
if (!isDataRefreshed) isDataRefreshed = refreshData(ref requestsCount);
if (isDataRefreshed)
{
if ((refreshPeriod_ == null) || (refreshPeriod_ < minRefreshPeriod))
if (notifyIcon_ != null)
{
bool showNotifyIcon = ((notificationsRefreshPeriod_ > 0) && (refreshPeriod_ != null));
if (notifyIcon_.Visible != showNotifyIcon) notifyIcon_.Visible = showNotifyIcon;
if (showNotifyIcon)
{
if ((icons_ != null) && (icons_.Length > 0))
{
System.Drawing.Icon icon = icons_[Math.Min(requestsCount, icons_.Length - 1)];
if ((icon != null) && (icon != notifyIcon_.Icon)) notifyIcon_.Icon = icon;
}
}
}
}
}
public void hide()
{
if ((notifyIcon_ != null) && notifyIcon_.Visible) notifyIcon_.Visible = false;
}
}