public EventReportForm(MainDataContexts dataContexts,EventPlainInfo eventInfo) { InitializeComponent(); _dataSet=new ReportDataSet(); _dataContexts = dataContexts; _eventInfo = eventInfo; }
public EquipmentPortsSelection(MainDataContexts dataContext) { InitializeComponent(); _dataContext = dataContext; gvEquipments.RowHeadersVisible = false; gvPorts.RowHeadersVisible = false; }
public AreaDetailReport(MainDataContexts dataContexts,Area reportedArea) { InitializeComponent(); _dataContexts = dataContexts; _dataSet=new ReportDataSet(); _reportedArea = reportedArea; }
public EmptyNetworkName(MainDataContexts dataContexts,AccountEquipmentMainForm mainForm) { InitializeComponent(); _dataContexts = dataContexts; _mainForm = mainForm; Icon = _mainForm.Icon; }
private void Form1_Shown(object sender, EventArgs e) { OpenFileDialog of = new OpenFileDialog() {Filter = @"Файлы приложений|*.exe"}; if (of.ShowDialog(this) != DialogResult.OK) return; string assemblyName = of.FileName; bool loaded = false; MiniSplash splash=new MiniSplash() { TaskName = "LoadEquipmentDetails", Text = "", Working = (worker) => { worker.ReportProgress(0,"Загрузка объектов с главного приложения"); loaded = LoadMainAssemply(assemblyName); if (!loaded) return; worker.ReportProgress(0, "Загрузка данных"); _dataContext = new MainDataContexts(); Invoke(new Action(RefreshGrid)); } }; splash.ShowDialog(this); if (!loaded) { Application.Exit(); Application.ExitThread(); return; } Text = @"Менеджер пользователей. Приложение: " + AppId.Description; }
public EmergencyPhonesForm(MainDataContexts dataContexts, Expression<Func<Event, bool>> filters=null) { InitializeComponent(); _dataContexts = dataContexts; _contacts=new List<EmergencyContact>(); _filters=new Dictionary<FilterId, object>(); }
public CustomerSidesReport(MainDataContexts dataContexts,CustomerSidesSelection.CustomerInfo reportedCustomer, List<CustomerLink> reportedLinks) { InitializeComponent(); _dataContexts = dataContexts; _reportedLinks = reportedLinks; _dataSet=new ReportDataSet(); _reportedCustomer = reportedCustomer; }
public ListSelectionForm(MainDataContexts dataContext, Equipment managedEquipment, EquipmentListTypes formListType) { InitializeComponent(); _dataContext = dataContext; _managedEquipment = managedEquipment; _formListType = formListType; cbLists.DataSource = _dataContext.AccEquipmentV2Entities.EquipmentLists.Where(l => l.ListState & l.ListType == (int)_formListType).OrderBy(o => o.Description).ThenByDescending(o=>o.CreationDate).ToList(); }
public CustomerSidesSelection(MainDataContexts dataContexts, AccountEquipmentMainForm mainForm) { _dataContexts = dataContexts; InitializeComponent(); Icon = Resources.DGSL_file_type; _mainForm = mainForm; NotifyBox.Visible = false; }
public ENotifyReceivers(MainDataContexts dataContexts, bool readonlyForm = false, List<NotifyReceiversList> readonlyDataSource = null) { _readonlyForm = readonlyForm; InitializeComponent(); cmReceiversEdit.Enabled = !_readonlyForm; _dataContexts = dataContexts; _readonlyDataSource = readonlyDataSource; SetFixedList(Guid.Empty); }
public EquipmentManage(MainDataContexts dataContexts,Area area,Equipment manageEquipment, int buttonTag) { InitializeComponent(); _dataContexts = dataContexts; _manageEquipment = manageEquipment; _buttonTag = buttonTag; _area = area; lbPorts.MultiSelect = true; lbCards.MultiSelect = true; }
public EventEditorForm(MainDataContexts dataContexts, Event managedEvent, RequestAction requestAction, ENotifySenderManager manager) { InitializeComponent(); _dataContexts = dataContexts; _managedEvent = managedEvent; _requestAction = requestAction; _manager = manager; _indexValues = new BindingList<IndexValues>(); _receiversLists = new List<NotifyReceiversList>(); _contacts = new List<string>(); }
private void PortSelectorForm_Shown(object sender, EventArgs e) { MiniSplash splash = new MiniSplash { TaskName = "LoadReportEquipmentTypes", Text = "", Working = (worker) => { try { if (worker == null) throw new Exception("Invalid background worker process"); worker.ReportProgress(0, "Загрузка данных"); _dataContexts = new DataContextAccEq_V2.DataContext.MainDataContexts(); _dataContexts.AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = false; _ports = _dataContexts.AccEquipmentV2Entities.EquipmentPorts.Include(i => i.PortType).Include(i => i.Equipment).Include(i => i.Equipment.Area).Where(port => port.SideLink == null).ToList(); _areas=new List<Area>(); _equipments = new List<Equipment>(); foreach (EquipmentPort equipmentPort in _ports) { if (!_areas.Exists(area=>area.AreaId==equipmentPort.Equipment.Area.AreaId)) _areas.Add(equipmentPort.Equipment.Area); if (!_equipments.Exists(equ => equ.EquipmentId== equipmentPort.Equipment.EquipmentId)) _equipments.Add(equipmentPort.Equipment); } _dataContexts.AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = true; } catch (Exception) { throw; } } }; splash.ShowDialog(this); gvAreas.DataSource = _areas.OrderBy(o=>o.Description).ToList(); }
public void InitDataContext(MainDataContexts dataContext) { _dataContexts = dataContext; }
public CustomerLinkSelectionForm(MainDataContexts dataContexts) { _dataContexts = dataContexts; InitializeComponent(); }
private void AccountEquipmentMainForm_Shown(object sender, EventArgs ee) { List<Access_Users> users = new List<Access_Users>(); bool isRestarting = false; MiniSplash splash1 = new MiniSplash { TaskName = "LoadMainApp_Step1", Text = @"Запуск приложения", Working = (worker) => { #region Stage1 (Update app) worker.ReportProgress(0, "Проверка обновлений для программы"); string message; if (!CheckApplicationUpdateAvailable(out message)) { if (message != string.Empty) throw new Exception(message); } else { ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment; try { worker.ReportProgress(0, @"Обновление приложения"); if (Properties.Settings.Default.UpgradeRequired) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpgradeRequired = false; Properties.Settings.Default.Save(); } ad.Update(); MessageBox.Show(this, @"Обновления приложения прошло успешно, нажмите ОК для перезапуска программы", "", MessageBoxButtons.OK); isRestarting = true; Invoke(new Action(Application.Restart)); } catch (DeploymentDownloadException dde) { MessageBox.Show(this, @"Обновление для приложения завершилась с ошибкой: " + dde.Message); Application.Exit(); } } #endregion #region Detect Debug|Release run #if DEBUG if (!Debugger.IsAttached) { Text += @"Попытка запуска отладочной версии программы без среды разработки! Переустановите приложение!"; //throw new Exception(@"Попытка запуска отладочной версии программы без среды разработки! Переустановите приложение!"); } #else if (Debugger.IsAttached) { throw new Exception(@"Запущена релизная версия программы из среды разработки! Измените платформу на Debug!"); } #endif #endregion #region Stage2 (database connect) worker.ReportProgress(0, "Подключение к базе данных"); _dataContexts = new MainDataContexts(); _dataContexts.AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = false; var tUsers = _dataContexts.AccEquipmentV2Entities.Access_Users.OrderBy(u => u.Description) .Select(u => new { u.Description, u.Id, u.IsAdmin, Password = "" }) .ToList(); tUsers.ForEach(t => users.Add(new Access_Users() {Id = t.Id, Description = t.Description, IsAdmin = t.IsAdmin})); //.Include(i => i.Access_Associations.Where(a => a.AppId.Equals(Program.AppId.Id))) _dataContexts.AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = true; SharedAppData.HistoryStore = new HistoryStore(); #endregion } }; splash1.ShowDialog(this); if (isRestarting) return; #region Stage 3 Authorization if (users == null) { throw new Exception(@"Неизвествная ошибка в программе"); } Access_Users fakeUser = new Access_Users() {Id = Guid.Empty, Description = "--- выберите пользователя для входа в систему---"}; users.Insert(0, fakeUser); InputLogin input = new InputLogin { ComboBox1 = { DisplayMember = "Description", ValueMember = "Id", DataSource = users } }; var selectedUser = ((List<Access_Users>) input.ComboBox1.DataSource).SingleOrDefault(u => u.Id == Settings.Default.LastLoggedId); input.ComboBox1.SelectedItem = selectedUser ?? fakeUser; input.btnOk.Click += (_, __) => { if (input.ComboBox1.SelectedItem == fakeUser) { input.DialogResult = DialogResult.None; return; } var authUser = (Access_Users) input.ComboBox1.SelectedItem; bool? checkResult = _dataContexts.AccEquipmentV2Entities.sp_CheckLogin(authUser.Id, input.InputLine1.Text).SingleOrDefault(); if (checkResult.HasValue && checkResult.Value) { input.DialogResult = DialogResult.OK; } else { MessageBox.Show(@"Неправильные данные для авторизации!"); SharedAppData.HistoryStore.AddHistoryEvent("LoginFailed", "RequestUser: "******"LoginComplete", "RequestUser: "******" [" + SharedAppData.LoggedUser.Description + @"]"; #endregion if (!SharedAppData.IsAccesible(ObjectAccessId)) { MessageBox.Show(@"Отсутсвуют права на использование приложения!"); Application.Exit(); return; } #region Stage 4 Continue startup MiniSplash splash2 = new MiniSplash { TaskName = "LoadMainApp_Step2", Text = @"Запуск приложения", Working = (worker) => { #region Stage4 (fill areas tree) worker.ReportProgress(0, "Загрузка первичных данных"); areaDetails.InitDataContext(_dataContexts); equipmentDetails.InitDataContext(_dataContexts); if (Settings.Default.AreasViewAsList) { areasTree.Model = new AreasTreeModelList(_dataContexts.AccEquipmentV2Entities); } else { areasTree.Model = new AreasTreeModelTree(_dataContexts.AccEquipmentV2Entities); } #endregion } }; splash2.Worker.RunWorkerCompleted += (_, e) => { if (e.Cancelled) { MessageBox.Show(@"Запуск приложения был отменён"); } else if (e.Error != null) { throw e.Error; } else { Enabled = true; } }; splash2.ShowDialog(this); FormatAreasTreeViewToolBox(Settings.Default.AreasViewAsList); Version version = ApplicationDeployment.IsNetworkDeployed ? ApplicationDeployment.CurrentDeployment.CurrentVersion : System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; VersionLabel.Text = string.Format("Версия:{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision); VersionLabel.Visible = true; StatusLabel1.Text = @"Подготовка данных с базы нарядов"; ProgressBar.Visible = true; Task.Factory.StartNew(() => _dataContexts.RefreshSideLinkInfos(), TaskCreationOptions.LongRunning).ContinueWith(_ => { StatusLabel1.Text = @"Подготовка данных завершена"; ProgressBar.Visible = false; }, TaskScheduler.FromCurrentSynchronizationContext()); miEmptyNetworkName.Visible = SharedAppData.LoggedUser.IsAdmin; #endregion }
public AreaDetailSelection(MainDataContexts dataContexts) { InitializeComponent(); _dataContexts = dataContexts; }
public AreasReport(MainDataContexts dataContexts) { InitializeComponent(); _dataSet=new ReportDataSet(); _dataContexts = dataContexts; }
private void EventsMainForm_Shown(object sender, EventArgs e) { _uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); bool isRestarting = false; List<Access_Users> users = new List<Access_Users>(); MiniSplash_TF sp0 = new MiniSplash_TF(Resources.load4) {Text = @"Запуск приложения"}; sp0.WorkingFunction = () => { #region Stage1 (Update app) sp0.StatusText = "Проверка обновлений для программы"; string message; if (!CheckApplicationUpdateAvailable(out message)) { if (message != string.Empty) throw new Exception(message); } else { try { ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment; sp0.StatusText = @"Обновление приложения"; Properties.Settings.Default.FirstUse = true; Properties.Settings.Default.Save(); if (Properties.Settings.Default.UpgradeRequired) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpgradeRequired = false; Properties.Settings.Default.Save(); } ad.Update(); MessageBox.Show(this, @"Обновления приложения прошло успешно, нажмите ОК для перезапуска программы", "", MessageBoxButtons.OK); isRestarting = true; Invoke(new Action(Application.Restart)); } catch (DeploymentDownloadException dde) { MessageBox.Show(this, @"Обновление для приложения завершилась с ошибкой: " + dde.Message); Application.Exit(); } } #endregion #region Detect Debug|Release run #if DEBUG if (!Debugger.IsAttached) { Text += @"Попытка запуска отладочной версии программы без среды разработки! Переустановите приложение!"; //throw new Exception(@"Попытка запуска отладочной версии программы без среды разработки! Переустановите приложение!"); } #else //if (Debugger.IsAttached) //{ // throw new Exception(@"Запущена релизная версия программы из среды разработки! Измените платформу на Debug!"); //} #endif #endregion #region Stage2 (database connect) sp0.StatusText = "Подключение к базе данных"; _dataContexts = new MainDataContexts(DataConsumers.Events_V2); _dataContexts.AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = false; _dataContexts.AccEquipmentV2Entities.Configuration.LazyLoadingEnabled = false; var tUsers = _dataContexts.AccEquipmentV2Entities.Access_Users.OrderBy(u => u.Description) .Include(i => i.Department) .Select(u => new { u.Description, u.Id, u.IsAdmin, u.DepartmentId, Password = "", u.Email }) .ToList(); tUsers.ForEach(t => users.Add(new Access_Users() {Id = t.Id, Description = t.Description, IsAdmin = t.IsAdmin, DepartmentId = t.DepartmentId, Email = t.Email})); _dataContexts.AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = true; _dataContexts.AccEquipmentV2Entities.Configuration.LazyLoadingEnabled = true; SharedAppData.HistoryStore = new HistoryStore(); //TODO:implement history! #endregion }; sp0.ShowDialog(this); if (isRestarting) return; #region Stage 3 Authorization if (users == null) { throw new Exception(@"Неизвествная ошибка в программе"); } Access_Users fakeUser = new Access_Users() {Id = Guid.Empty, Description = "--- выберите пользователя для входа в систему ---"}; users.Insert(0, fakeUser); InputLogin input = new InputLogin { ComboBox1 = { DisplayMember = "Description", ValueMember = "Id", DataSource = users } }; var selectedUser = ((List<Access_Users>) input.ComboBox1.DataSource).SingleOrDefault(u => u.Id == Properties.Settings.Default.LastLoggedId); input.ComboBox1.SelectedItem = selectedUser ?? fakeUser; input.btnOk.Click += (_, __) => { if (input.ComboBox1.SelectedItem == fakeUser) { input.DialogResult = DialogResult.None; return; } var authUser = (Access_Users) input.ComboBox1.SelectedItem; bool? checkResult = _dataContexts.AccEquipmentV2Entities.sp_CheckLogin(authUser.Id, input.InputLine1.Text).SingleOrDefault(); if (checkResult.HasValue && checkResult.Value) { input.DialogResult = DialogResult.OK; } else { MessageBox.Show(@"Неправильные данные для авторизации!"); SharedAppData.HistoryStore.AddHistoryEvent("LoginFailed", "RequestUser: "******"A0E4686D-9CFD-4868-8759-8C3EBEAA40E3".ToLower()); _dataContexts.AccEquipmentV2Entities.Access_Users.Attach(SharedAppData.LoggedUser); _dataContexts.AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = false; _dataContexts.AccEquipmentV2Entities.Configuration.LazyLoadingEnabled = false; _dataContexts.AccEquipmentV2Entities.Entry(SharedAppData.LoggedUser).Collection(r => r.Access_Associations).Load(); _dataContexts.AccEquipmentV2Entities.Entry(SharedAppData.LoggedUser).Reference(r => r.Department).Load(); _dataContexts.AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = true; _dataContexts.AccEquipmentV2Entities.Configuration.LazyLoadingEnabled = true; SharedAppData.HistoryStore.AddHistoryEvent("LoginComplete", "RequestUser: "******" [" + SharedAppData.LoggedUser.Description + @"]"; btEReceivers.Visible = SharedAppData.LoggedUser.IsAdmin; if (!SharedAppData.IsAccesible(ObjectAccessId)) { MessageBox.Show(@"Отсутсвуют права на использование приложения!"); Application.Exit(); return; } #endregion #region Stage 4 Continue startup MiniSplash_TF sp = new MiniSplash_TF(Resources.load4) { Text = @"Запуск приложения", StatusText = "Загрузка дополнительных данных", WorkingFunction = () => { _dataContexts.RefreshSideLinkInfos(); _manager = new ENotifySenderManager(_dataContexts,this); } }; sp.ShowDialog(); #endregion #region NotifyServiceClient init _clientProcessor = new ClientProcessor(); _clientProcessor.OnServerOnline += (message, icon) => RunActionInGUIThread(() => { btNotifyDisconnect.Enabled = true; btNotifyConnect.Enabled = false; notifyIcon.ShowBalloonTip(5, @"Уведомление", message, icon); }); _clientProcessor.OnMessageShow += (message, icon) => RunActionInGUIThread(() => { if (icon == ToolTipIcon.Error) { btNotifyDisconnect.Enabled = false; btNotifyConnect.Enabled = true; notifyIcon.ShowBalloonTip(10, @"Ошибка", message, icon); } else { notifyIcon.ShowBalloonTip(5, @"Уведомление", message, icon); } }); _clientProcessor.OnServerOffline += (message, icon) => RunActionInGUIThread(() => { btNotifyDisconnect.Enabled = false; btNotifyConnect.Enabled = true; notifyIcon.ShowBalloonTip(5, @"Уведомление", message, icon); }); _clientProcessor.OnReceiveNotifyApp += (data) => RunActionInGUIThread(() => { Guid eventId; NotifyData notifyData = new NotifyData(data); if (!Guid.TryParse(notifyData.Data, out eventId)) { notifyIcon.ShowBalloonTip(5, @"Уведомление", @"Получены неправильные данные о обновленной заявке!", ToolTipIcon.Info); return; } else { string message = "Данные о заявках обновились"; if (!_dataHandlerLoading) { _dataHandlerLoading = true; RefreshCurrentPage(); _dataHandlerLoading = false; } var eventRefreshed = _dataContexts.AccEquipmentV2Entities.Events.SingleOrDefault(ev => ev.Id == eventId); if (eventRefreshed != null) { int customerId = eventRefreshed.CustomerId.HasValue ? eventRefreshed.CustomerId.Value : 0; int firmId = eventRefreshed.FirmId.HasValue ? eventRefreshed.FirmId.Value : 0; string[] customerInfo = _dataContexts.GetCustomerDescription2(firmId, customerId); message = string.Format("Заявка №{0} {1}, {2} - данные обновились!", eventRefreshed.Number, customerInfo[0], customerInfo[1]); } notifyIcon.ShowBalloonTip(5, @"Уведомление", message, ToolTipIcon.Error); } }); _clientProcessor.ConnectService(); #endregion #region Visual elements init Cursor = Cursors.WaitCursor; Version version = ApplicationDeployment.IsNetworkDeployed ? ApplicationDeployment.CurrentDeployment.CurrentVersion : System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; VersionLabel.Text = string.Format("Версия:{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision); VersionLabel.Visible = true; List<Department> deps = _dataContexts.AccEquipmentV2Entities.Departments.OrderBy(o => o.Description).ToList(); deps.Insert(0, new Department() {Id = Guid.Empty, Description = @"Все подразделения"}); deps.Insert(1, new Department() {Id = _customSelfGuidValue, Description = @"Только свои заявки"}); deps.Insert(2, new Department() {Id = _customSelfDepartmentGuidValue, Description = @"Только заявки своего департамента"}); cbDepartmentFilter.DataSource = deps; List<KeyValuePair<string, int>> data1 = Enum.GetValues(typeof (EventState)) .Cast<EventState>() .Select(c => new KeyValuePair<string, int>(c.GetAttributeValue<DescriptionAttribute, string>(x => x.Description), (int) c)) .Where(k => !string.IsNullOrEmpty(k.Key)) .ToList(); data1.Insert(0, new KeyValuePair<string, int>("Все заявки", -100)); cbEventStateFilter.DataSource = data1; List<KeyValuePair<string, int>> data2 = Enum.GetValues(typeof (EventType)) .Cast<EventType>() .Select(c => new KeyValuePair<string, int>(c.GetAttributeValue<DescriptionAttribute, string>(x => x.Description), (int) c)) .Where(k => !string.IsNullOrEmpty(k.Key)) .ToList(); data2.Insert(0, new KeyValuePair<string, int>("Все заявки", -100)); cbEventTypeFilter.DataSource = data2; if (Settings.Default.SelectedDepartmentId != Guid.Empty) { ChangeDepartmentBox(Settings.Default.SelectedDepartmentId); cbDepartmentFilter.SelectedValue = Settings.Default.SelectedDepartmentId; } if (Settings.Default.SelectedEventState != -100) { UpdateFilterValue(FilterId.EventState, Settings.Default.SelectedEventState); cbEventStateFilter.SelectedValue = Settings.Default.SelectedEventState; } if (Settings.Default.SelectedEventType != -100) { UpdateFilterValue(FilterId.EventType, Settings.Default.SelectedEventType); cbEventTypeFilter.SelectedValue = Settings.Default.SelectedEventType; } navigationBar.InitSetting(Properties.Settings.Default.NB_SortOrder, Properties.Settings.Default.NB_RowsOnPage, Properties.Settings.Default.NB_OptionsVisible); navigationBar.OnSettingChanged += (s1, s2, s3) => { bool change = false; if (Properties.Settings.Default.NB_SortOrder != s1) { Properties.Settings.Default.NB_SortOrder = s1; change = true; } if (Properties.Settings.Default.NB_RowsOnPage != s2) { Properties.Settings.Default.NB_RowsOnPage = s2; change = true; } if (Properties.Settings.Default.NB_OptionsVisible != s3) { Properties.Settings.Default.NB_OptionsVisible = s3; change = true; } if (change) Properties.Settings.Default.Save(); }; navigationBar.SetDataSouce(_dataContexts.AccEquipmentV2Entities.Events); navigationBar.OnNavigationChanged += RefreshCurrentPage; navigationBar.Visible = true; navigationBar.SortProperty = dcIndex.DataPropertyName; gvEvents.ColumnHeadersVisible = true; ucNumberFilter.OnFilterKeyDown += (_, __) => { if (__.KeyCode == Keys.Return) { UpdateFilterValue(FilterId.Number, ucNumberFilter.FilterText != string.Empty ? ucNumberFilter.FilterText : null); RefreshCurrentPage(); __.Handled = (__.SuppressKeyPress = true); } }; ucNumberFilter.OnClearButtonDown += (_, __) => { UpdateFilterValue(FilterId.Number, null); RefreshCurrentPage(); }; ucCustomerIdFilter.OnFilterKeyDown += (_, __) => { if (__.KeyCode == Keys.Return) { UpdateFilterValue(FilterId.CustomerId, ucCustomerIdFilter.FilterText != string.Empty ? ucCustomerIdFilter.FilterText : null); RefreshCurrentPage(); __.Handled = (__.SuppressKeyPress = true); } }; ucCustomerIdFilter.OnClearButtonDown += (_, __) => { UpdateFilterValue(FilterId.CustomerId, null); RefreshCurrentPage(); }; ucCustomerSideFilter.tbFilterText.Width = 180; ucCustomerSideFilter.OnFilterKeyDown += (_, __) => { if (__.KeyCode == Keys.Return) { UpdateFilterValue(FilterId.CustomerSide, ucCustomerSideFilter.FilterText != string.Empty ? ucCustomerSideFilter.FilterText : null); RefreshCurrentPage(); __.Handled = (__.SuppressKeyPress = true); } }; ucCustomerSideFilter.OnClearButtonDown += (_, __) => { UpdateFilterValue(FilterId.CustomerSide, null); RefreshCurrentPage(); }; ucEquipmentPort.tbFilterText.Width = 180; ucEquipmentPort.OnFilterKeyDown += (_, __) => { if (__.KeyCode == Keys.Return) { UpdateFilterValue(FilterId.EquipmentPort, ucEquipmentPort.FilterText != string.Empty ? ucEquipmentPort.FilterText : null); RefreshCurrentPage(); __.Handled = (__.SuppressKeyPress = true); } }; ucEquipmentPort.OnClearButtonDown += (_, __) => { UpdateFilterValue(FilterId.EquipmentPort, null); RefreshCurrentPage(); }; miMainToolBar.Enabled = true; Cursor = Cursors.Default; #endregion #region First run if (Properties.Settings.Default.FirstUse) { Properties.Settings.Default.FirstUse = false; Properties.Settings.Default.Save(); if (FirstUseData.NeedShow) MessageBox.Show(FirstUseData.FirstUseText, FirstUseData.FirstUseCaption, MessageBoxButtons.OK); } #endregion #if !DEBUG Task.Factory.StartNew(() => { while (_chekingRun) { Thread.Sleep(10000); if (btNotifyConnect.Enabled) { #region scrolling text :) //if (!_startedScrolling) //{ // _startedScrolling = true; // RunActionInGUIThread(() => toolStripStatusLabel1.Text = NotConnectScrolltext); // Task.Factory.StartNew(() => // { // while (_startedScrolling) // { // var size = TextRenderer.MeasureText(toolStripStatusLabel1.Text, toolStripStatusLabel1.Font); // string movingText = toolStripStatusLabel1.Text; // if (size.Width+10 > toolStripStatusLabel1.Width) // { // movingText = movingText.Substring(1) + movingText[0]; // } // else // { // movingText = " " + movingText; // } // RunActionInGUIThread(() => toolStripStatusLabel1.Text = movingText); // Thread.Sleep(50); // } // }); //} #endregion RunActionInGUIThread(() => notifyIcon.ShowBalloonTip(5, @"Уведомление", NotConnectScrolltext, ToolTipIcon.Warning)); } else { //_startedScrolling = false; //RunActionInGUIThread(() => toolStripStatusLabel1.Text = ""); } } }, TaskCreationOptions.LongRunning); #endif }
public CustomersSideSelectionForm(MainDataContexts dataContexts) { InitializeComponent(); _dataContexts = dataContexts; Rectangle rect = gvSides.GetCellDisplayRectangle(dcAddress.Index, -1, true); rect.Y = 2; rect.X = rect.Location.X; using (Graphics lGraphics = CreateGraphics()) { const string data = @"Добавить площадку абонента"; SizeF lSize = lGraphics.MeasureString(data, gvSides.Font); Button headerButton = new Button { Text = data, AutoSize = true, Size = new Size(Convert.ToInt32(lSize.Width), Convert.ToInt32(lSize.Height)), Location = rect.Location, Enabled = true//TODO:implement right SharedAppData.IsFlagSet(ObjectAccessId, RightsFlags.Add) }; headerButton.Top = headerButton.Top + 2; headerButton.Left = gvSides.Width - headerButton.Size.Width - 13; headerButton.TextAlign = ContentAlignment.TopCenter; headerButton.Click += (s, e) => { InputSingleLineComboBox inp=new InputSingleLineComboBox { Text = @"Добавление адреса площадки абонента", Label2 = {Text = @"Географический адрес:"}, Label1 = {Text = @"Дополнительные данные:"}, ComboBox1 = { ValueMember = "streetID", DisplayMember = "streetNameUkr", AutoCompleteSource = AutoCompleteSource.ListItems, DropDownStyle = ComboBoxStyle.DropDown, AutoCompleteMode = AutoCompleteMode.Suggest } }; inp.tlMain.SetRow(inp.tlTextBox, 1); inp.tlMain.SetRow(inp.tlComboBox, 0); Cursor = Cursors.WaitCursor; List<Street> comboData = _dataContexts.NumEquipmentEntities.Streets.OrderBy(item => item.streetNameUkr).Where(item => !string.IsNullOrEmpty(item.streetNameUkr)).ToList(); inp.ComboBox1.DataSource = comboData; inp.ActiveControl = inp.ComboBox1; inp.RequireComboBoxValue = true; Cursor = Cursors.Default; if (inp.ShowDialog(this) == DialogResult.OK) { var street = inp.ComboBox1.SelectedItem as Street; string address; if (street != null) { address = street.streetNameUkr + ", " + inp.InputLine1.Text; } else { address = inp.InputLine1.Text; } var currentCustomer = ((Customer)gvCustomers.SelectedRows[0].DataBoundItem); CustomerSide newSide = new CustomerSide() { Id = Guid.NewGuid(), Description = address, Firmid = ((Firm) cbFirms.SelectedItem).FirmId, CustomerId = Convert.ToInt32(currentCustomer.Customer_id.Trim()) }; _dataContexts.AccEquipmentV2Entities.CustomerSides.Add(newSide); _dataContexts.AccEquipmentV2Entities.SaveChanges(); _cachedCustomerSides = _dataContexts.AccEquipmentV2Entities.CustomerSides.ToList(); //_dataContexts.RefreshSideLinkInfos(); gvCustomers_SelectionChanged(gvCustomers, new EventArgs()); OnHistoryEvent(new HistoryEventArgs("Add CustomerSide", string.Format("{0} {1} {2}", newSide.Firmid, newSide.CustomerId, newSide.Description))); Cursor = Cursors.Default; } }; gvSides.Controls.Add(headerButton); gvSides.ColumnHeadersHeight = headerButton.Height + 6; gvCustomers.ColumnHeadersHeight = headerButton.Height + 6; } }
public EquipmentTypesSelection(MainDataContexts dataContexts) { InitializeComponent(); _dataContexts = dataContexts; }
public string GetSideLinkDescription2(SideLink link, bool addressOnly = false,bool titleOnly=false,MainDataContexts context=null) { if (link == null) return ""; if (_isLoadData) return @"Данные загружаются, попробуйте позже"; string desc = ""; int tpl = link.LinkType.HasValue ? link.LinkType.Value : -1; switch ((SideLinkType)tpl) { case SideLinkType.toEquipmentPort: //AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = false; //EquipmentPort port = AccEquipmentV2Entities.EquipmentPorts.Where(ports => ports.PortId == link.LinkEquipmentPortId).Include(i => i.Equipment).SingleOrDefault(); //AccEquipmentV2Entities.Configuration.ProxyCreationEnabled = true; EquipmentPort port = link.EquipmentPort; if (port == null & link.LinkEquipmentPortId != null) { if (context != null) { port = context.AccEquipmentV2Entities.EquipmentPorts.SingleOrDefault(portl=>portl.PortId== link.LinkEquipmentPortId); } } if (port == null) throw new Exception("Invalid data structure in sidelinks LinkId: " + link.LinkId + " PortId: " + link.LinkEquipmentPortId); Equipment equipment = port.Equipment; if (equipment == null) throw new Exception("Invalid data structure in sidelinks"); Area area = equipment.Area; if (area == null) throw new Exception("Invalid data structure in sidelinks"); desc = string.Format("{0}, {1}{3}, {2}", area.Description, equipment.Description, port.Description, !string.IsNullOrEmpty(equipment.NetworkDescription) ? " [" + equipment.NetworkDescription + "]" : string.Empty); break; case SideLinkType.toCustomerSide: if (addressOnly) { desc = link.CustomerSide.Description; break; } var customerSide = link.CustomerSide; if (customerSide == null & link.LinkCustomerSideId != null) { if (context != null) { customerSide = context.AccEquipmentV2Entities.CustomerSides.SingleOrDefault(sidel=>sidel.Id==link.LinkCustomerSideId); } } if (customerSide == null) throw new Exception("Invalid data structure in sidelinks"); var ca = _cahcedCustomerSideLinkInfos.SingleOrDefault(i => i.CustomerId == customerSide.CustomerId & i.FirmId == customerSide.Firmid); if (ca == null) { desc = string.Format("{0}, Абонент удален", customerSide.CustomerId); break; } if (titleOnly) { desc = ca.Title; break; } desc = string.Format("{0}, {1}, {2}", customerSide.CustomerId, ca.Title, customerSide.Description); break; case SideLinkType.toCustomData: desc = link.CustomData; break; default: desc = ""; break; } return desc; }
public ENotifySenderManager(MainDataContexts dataContexts,Form parentForm) { _dataContexts = dataContexts; ClearHeaders(); _parentForm = parentForm; }
public EmergencyPhoneEditorForm(MainDataContexts dataContexts) { InitializeComponent(); _dataContexts = dataContexts; }
public AllEventsReportForm(MainDataContexts dataContexts) { InitializeComponent(); _dataContexts = dataContexts; _dataSet = new ReportDataSet(); }
public CustomerSidesSelection(MainDataContexts dataContexts) { _dataContexts = dataContexts; InitializeComponent(); }