public void DownCommandExecute(object obj) { try { ShiftsInformation ShiftsInformation = ShiftsSetting.dgShiftsSet.SelectedItem as ShiftsInformation; if (ShiftsInformation != null) { int index = 0; for (int i = 0; i < this.ShiftsInformationList.Count; i++) { if (ShiftsInformation.WorkTime == this.ShiftsInformationList[i].WorkTime) { index = i; } } if (index == this.ShiftsInformationList.Count - 1) { return; } this.ShiftsInformationList.Remove(ShiftsInformation); this.ShiftsInformationList.Insert(index + 1, ShiftsInformation); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void DeleteCommandExecute(object obj) { ShiftsInformation ShiftsInformation = ShiftsSetting.dgShiftsSet.SelectedItem as ShiftsInformation; DeleteRowReminder DeleteRowReminder = new DeleteRowReminder(); DeleteRowReminder.ShowInTaskbar = false; DeleteRowReminder.Owner = ShiftsSetting; DeleteRowReminder.ShowDialog(); if (DeleteRowReminder.DialogResult == true) { var item = this.ShiftsInformationList.SingleOrDefault(x => x.WorkTime == ShiftsInformation.WorkTime); if (item != null) { this.ShiftsInformationList.Remove(item); } } }
public void ChangeShiftB_Click(object sender, EventArgs e) { sqlmgr.Reconnect(); var data = sqlmgr.GetDispetcherHelpers(_currentUser.Id); sqlmgr.Disconnect(); ChangeShiftForm csf = new ChangeShiftForm(); csf.SetHelpersCBDataSource(data); var dr = csf.ShowDialog(); if (dr == DialogResult.OK) { sqlmgr.Reconnect(); _shiftInfo.CurrentShiftId = sqlmgr.ChangeShift(_currentUser.Id, csf.HelperId); _shiftInfo = sqlmgr.GetShiftsInformation(_shiftInfo.CurrentShiftId); _currentUser.LastUserShiftId = _shiftInfo.CurrentShiftId; sqlmgr.Disconnect(); SetFormCaptionByToolStripItem((sender as ToolStripItem)); _cdp.Value = _shiftInfo.CurrentShiftDate; CheckShiftsButtons(); (sender as ToolStripItem).Enabled = false; RefreshGrid(); } }
public void SetShiftInfo(ShiftsInformation shift) { _shift = shift; }
//private DeceasedFormPresenter Presenter; public DeceasedCardForm(string ConnectionString, UserInfo CurrentUser,ShiftsInformation Shift) { _conn_str = ConnectionString; InitializeComponent(); _currentUser = CurrentUser; _shiftInfo = Shift; Presenter = new DeceasedFormPresenter(); (Presenter as DeceasedFormPresenter).SetConnectionString(_conn_str); (Presenter as DeceasedFormPresenter).SetCurrentUserInfo(CurrentUser); (Presenter as DeceasedFormPresenter).SetShiftInfo(_shiftInfo); (Presenter as DeceasedFormPresenter).SetFormControls(AddressEd, FIOEd, AdAddressEd, AgentsLB, /*TransportEd*/TransportCB, AvansEd, SumOfOrderEd, DispetcherCB, SmenaHelperCB, CommentsEd, ResultCB, AddressCB, MicroRaionCB, DocumentsLinkerCB, FuneralTypeCB, KvitanciyaNumEd, ProfitSumEd, IsAvansPayed, PassportCB, OrderCB, OfficeCB, DateLinkPicker, DebtKvitEd , HandsInputCB, LinkCompanyCB, DocLinkerVisibilityCB, TranspCommentsEd); (Presenter as DeceasedFormPresenter).SetListViewControls(RelativesLV, InformatorsLV); Presenter.DoInit(); KvitanciyaNumEd.KeyDown += anvlib.Controls.EventHandlers.KeyboardHandlers.OnlyDigitsTextBox_KeyDownEventHandler; AvansEd.KeyDown += anvlib.Controls.EventHandlers.KeyboardHandlers.FloatDataCommaOnlyTextBox_KeyDownEventHandler; SumOfOrderEd.KeyDown += anvlib.Controls.EventHandlers.KeyboardHandlers.FloatDataCommaOnlyTextBox_KeyDownEventHandler; ProfitSumEd.KeyDown += anvlib.Controls.EventHandlers.KeyboardHandlers.FloatDataCommaOnlyTextBox_KeyDownEventHandler; DebtKvitEd.KeyDown += anvlib.Controls.EventHandlers.KeyboardHandlers.FloatDataCommaOnlyTextBox_KeyDownEventHandler; if (CurrentUser.Role == RoleType.Dipetcher || CurrentUser.Role == RoleType.DipetcherHelper) { DoInvisibleControls(); addr_lab.Visible = true; AddressEd.Visible = true; HandsInputCB.Visible = true; mraion_lab.Visible = true; MicroRaionCB.Visible = true; FIO_lab.Visible = true; FIOEd.Visible = true; informator_lab.Visible = true; InformatorsLV.Visible = true; agent_lab.Visible = true; AgentsLB.Visible = true; Relatives_lab.Visible = true; RelativesLV.Visible = true; office_lab.Visible = true; OfficeCB.Visible = true; office_lab.Top = 270; OfficeCB.Top = 300; additional_addr_lab.Visible = true; AdAddressEd.Visible = true; additional_addr_lab.Top = 480; AdAddressEd.Top = 500; date_link_lab.Visible = true; DateLinkPicker.Visible = true; date_link_lab.Top = 340; DateLinkPicker.Top = 360; transport_lab.Visible = true; TransportCB.Visible = true; avans_lab.Visible = true; AvansEd.Visible = true; IsAvansPayed.Visible = true; PassportCB.Visible = true; OrderCB.Visible = true; avans_lab.Top = 265; avans_lab.Left = 12; AvansEd.Left = 13; AvansEd.Top = 285; PassportCB.Top = AvansEd.Top + 3; PassportCB.Left = 150; OrderCB.Top = AvansEd.Top + 3; OrderCB.Left = 240; IsAvansPayed.Top = 265; IsAvansPayed.Left = 90; transport_lab.Top = RelativesLV.Top; DocLinkerVisibilityCB.Visible = true; DocLinkerVisibilityCB.Top = RelativesLV.Top; TranspCommentsEd.Visible = true; TransportCB.Top = RelativesLV.Top + 25; TranspCommentsEd.Top = RelativesLV.Top + 25; comments_lab.Visible = true; CommentsEd.Visible = true; result_lab.Visible = true; ResultCB.Visible = true; result_lab.Top = 478; ResultCB.Top = 498; comments_lab.Top = 530; CommentsEd.Top = 550; CommentsEd.Height += 58; link_company_lab.Visible = true; LinkCompanyCB.Visible = true; link_company_lab.Left += 1; link_company_lab.Top = DateLinkPicker.Top + 30; LinkCompanyCB.Top = DateLinkPicker.Top + 50; LinkCompanyCB.Left += 1; } if (CurrentUser.Role == RoleType.DocLinker) { AddressEd.Enabled = false; AddressCB.Enabled = false; AgentsLB.Enabled = false; InformatorsLV.Enabled = false; TransportCB.Enabled = false; MicroRaionCB.Enabled = false; DispetcherCB.Enabled = false; SmenaHelperCB.Enabled = false; DocumentsLinkerCB.Enabled = false; DocLinkerVisibilityCB.Enabled = false; } if (CurrentUser.Role == RoleType.Buhgalter) { DoDisableControls(); } }
public ShiftsInformation GetShiftsInformation(int shift_id) { ShiftsInformation res = new ShiftsInformation(); res.SetDefaultValues(); res.CurrentShiftId = shift_id; _cmd = CreateCommand("GetShiftsInformation"); _param = CreateParameter("@shift_id", DbType.Int32, 4); _param.Value = shift_id; _cmd.Parameters.Add(_param); _param = CreateParameter("@shift_date", DbType.DateTime, 0); _param.Direction = ParameterDirection.Output; _cmd.Parameters.Add(_param); _param = CreateParameter("@first_shift_id", DbType.Int32, 4); _param.Direction = ParameterDirection.Output; _cmd.Parameters.Add(_param); _param = CreateParameter("@last_shift_id", DbType.Int32, 4); _param.Direction = ParameterDirection.Output; _cmd.Parameters.Add(_param); _param = CreateParameter("@next_shift_id", DbType.Int32, 4); _param.Direction = ParameterDirection.Output; _cmd.Parameters.Add(_param); _param = CreateParameter("@prev_shift_id", DbType.Int32, 4); _param.Direction = ParameterDirection.Output; _cmd.Parameters.Add(_param); ExecuteCommand(_cmd.ExecuteNonQuery); res.CurrentShiftDate = (DateTime)_cmd.Parameters["@shift_date"].Value; res.FirstShiftId = (int)_cmd.Parameters["@first_shift_id"].Value; res.LastShiftId = (int)_cmd.Parameters["@last_shift_id"].Value; res.NextShiftId = (int)_cmd.Parameters["@next_shift_id"].Value; res.PreviousShiftId = (int)_cmd.Parameters["@prev_shift_id"].Value; return res; }
private void _cdp_ValueChanged(object sender, EventArgs e) { sqlmgr.Reconnect(); var sid = sqlmgr.GetShiftIdByDate(_cdp.Value); if (sid > -1) { _shiftInfo = sqlmgr.GetShiftsInformation(sid); sqlmgr.Disconnect(); DrawTable(); CheckShiftsButtons(); SetFormCaptionByToolStripItem(_prevshiftb); } sqlmgr.Disconnect(); }
private void PrevShiftB_Click(object sender, EventArgs e) { if (_shiftInfo.PreviousShiftId != -1) { sqlmgr.Reconnect(); _shiftInfo = sqlmgr.GetShiftsInformation(_shiftInfo.PreviousShiftId); sqlmgr.Disconnect(); DrawTable(); CheckShiftsButtons(); SetFormCaptionByToolStripItem((sender as ToolStripItem)); _cdp.Value = _shiftInfo.CurrentShiftDate; } }
public override void DoInit() { //_conn_str = anvlib.Base.BaseMSSQLManager.GetConnectionString("ankushin", "", "", "UBureau", true); sqlmgr = new MSSQL_Manager(); sqlmgr.Connect(_conn_str); _currentUser = new UserInfo(); _currentUser = sqlmgr.GetCurrentUserInfo(); _shiftInfo = new ShiftsInformation(); _shiftInfo.CurrentShiftId = sqlmgr.GetShiftIdByUserId(_currentUser.Id); _shiftInfo = sqlmgr.GetShiftsInformation(_shiftInfo.CurrentShiftId); _cdp.Value = _shiftInfo.CurrentShiftDate; _cdp.ValueChanged += _cdp_ValueChanged; sqlmgr.Disconnect(); if (_currentUser.Id == -1) { MessageBox.Show("Отсутствуют права доступа к программе!", "Критическая ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); _is_application_exit = true; if (OnApplicationExit != null) OnApplicationExit(this, new EventArgs()); } if (_currentUser.Role != RoleType.Admin && _main_menu != null) { _main_menu.Items[1].Visible = false; _main_menu.Items[2].Visible = false; } if (_currentUser.Role != RoleType.Buhgalter && _main_menu != null) { //_main_menu.Items[1].Visible = true; _main_menu.Items[2].Visible = true; } if ((_currentUser.Role != RoleType.Dipetcher || _currentUser.Role != RoleType.DipetcherHelper && _main_menu != null) && _currentUser.Role != RoleType.Admin) { _main_menu.Items[1].Visible = true; var dict = (_main_menu.Items[1] as ToolStripMenuItem); dict.DropDownItems[0].Visible = false; dict.DropDownItems[5].Visible = false; dict.DropDownItems[6].Visible = false; } if (_prevshiftb != null && _nextshiftb != null) { CheckShiftsButtons(); _prevshiftb.Click += PrevShiftB_Click; _nextshiftb.Click += NextShiftB_Click; } if (_currentUser.Role != RoleType.Admin && _mainCMS != null) _mainCMS.Items[2].Visible = false; maintabletimer = new Timer(); maintabletimer.Interval = 60000*3; maintabletimer.Tick += MainTableTimerElapsed; maintabletimer.Start(); _isMainTableRefreshNeeded = true; }