Exemplo n.º 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            AppFuncs.WriteLogTraceMessage(" - press button 'Зберегти'");

            if (isValidInput())
            {
                if (_isNew || isUpdate())
                {
                    if (_phone == null)
                    {
                        _phone = new PhoneModel();
                    }
                    _phone.Department = Convert.ToInt32(cbxFormPhoneDepartment.SelectedValue);
                    _phone.FIO        = tbxFio.Text;
                    _phone.Positions  = tbxPosition.Text;
                    _phone.DepName    = cbxFormPhoneDepartment.Text;
                    _phone.Dect       = tbxDect.Text;
                    _phone.Phone      = tbxPhone.Text;
                    _phone.Mobile     = tbxMobile.Text;
                    _phone.Mail       = tbxFormPhoneMail.Text;

                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            else
            {
                _phone = null;
            }
        }
Exemplo n.º 2
0
        public override void EditObject()
        {
            if (base.AllowEdit == false)
            {
                base.notAllowEditAction();
                return;
            }

            DataGridViewRow dgvRow = base.getSelectedDataRow();

            if (dgvRow != null)
            {
                int  editId = (int)dgvRow.Cells["Id"].Value;
                Note note   = new Note(editId);

                NewNote      frm    = new NewNote(note);
                DialogResult result = frm.ShowDialog();
                AppFuncs.dialogCloseResult(frm.GetType().Name, result);
                if (result == DialogResult.OK)
                {
                    bool dbResult = DBContext.UpdateNotes(note);
                    if (dbResult)
                    {
                        this.LoadDataToGrid();
                        base.selectGridRowById(editId);
                        MessageBox.Show("Службова оновлена", "Оновлення службової", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    AppFuncs.saveToDBResult(dbResult);
                }
                base.EditObject();
            }
        }
Exemplo n.º 3
0
        public override void CreateNewObject()
        {
            if (base.AllowEdit == false)
            {
                base.notAllowEditAction(); return;
            }

            NewNote      frm    = new NewNote(null);
            DialogResult result = frm.ShowDialog();

            AppFuncs.dialogCloseResult(frm.GetType().Name, result);
            if ((result == DialogResult.OK) && (frm.Note != null))
            {
                bool dbResult = DBContext.InsertNotes(frm.Note);
                if (dbResult)
                {
                    this.LoadDataToGrid();
                    base.selectGridRowById(frm.Note.Id);
                    MessageBox.Show("Створена нова службова за № " + frm.Note.Id.ToString(), "Строверення службової", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                AppFuncs.saveToDBResult(dbResult);
            }
            frm.Dispose();

            base.CreateNewObject();
        }
Exemplo n.º 4
0
        public override void EditObject()
        {
            DataGridViewRow dgvRow = base.getSelectedDataRow();

            if (dgvRow != null)
            {
                int  editId = (int)dgvRow.Cells["Id"].Value;
                User user   = new User(editId);

                UserForm     frm    = new UserForm(user);
                DialogResult result = frm.ShowDialog();
                AppFuncs.dialogCloseResult(frm.GetType().Name, result);
                if (result == DialogResult.OK)
                {
                    bool dbResult = DBContext.UpdateEntity(user);
                    if (dbResult)
                    {
                        this.LoadDataToGrid();
                        base.selectGridRowById(editId);
                    }
                    AppFuncs.saveToDBResult(dbResult);
                }
                base.EditObject();
            }
        }
Exemplo n.º 5
0
        private void findPIBStartWith()
        {
            string value = "";

inputFindText:
            if (AppFuncs.InputBox("Пошук", "Введiть текст", ref value) == DialogResult.OK)
            {
                if (value.IsNull())
                {
                    MessageBox.Show("Введiть прiзвище.", "Пошук", MessageBoxButtons.OK);
                    goto inputFindText;
                }

                bool isFind = false;
                for (int i = 0; i < dgvPhonebook.Rows.Count; i++)
                {
                    if (dgvPhonebook.Rows[i].Cells["П.І.Б."].Value.ToString().ToUpper().StartsWith(value.ToUpper()))
                    {
                        dgvPhonebook.Rows[i].Selected = true;
                        dgvPhonebook.CurrentCell      = dgvPhonebook.Rows[i].Cells["П.І.Б."];
                        dgvPhonebook.FirstDisplayedScrollingRowIndex = i;
                        isFind = true;
                        break;
                    }
                }
                if (!isFind)
                {
                    MessageBox.Show($"Прiзвище '{value}' не знайдено. Спробуйте ще раз.", "Пошук", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    goto inputFindText;
                }
            }
        }
Exemplo n.º 6
0
 private static void dbBeforeCallAction(string sqlText)
 {
     if (AppFuncs.LogEnable)
     {
         AppFuncs.WriteLogTraceMessage("DBContext call: " + sqlText);
     }
 }
Exemplo n.º 7
0
        public override void DeleteObject()
        {
            int id = getSelectedId();

            if (id != -1)
            {
                DialogResult result = MessageBox.Show("Ви впевнені що хочете видалити поточний відділ?", "Видалення відділу", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    DataGridViewRow dgvRow = base.getSelectedDataRow();
                    string          name   = dgvRow.Cells["Name"].ToString();
                    string          logMsg = $"Видалення вiддiлу {id}";
                    AppFuncs.WriteLogTraceMessage(logMsg + "...");

                    bool dbResult = DBContext.DeleteEntityById(Department._dbTableName, id);
                    if (dbResult)
                    {
                        base.DeleteObject();
                    }
                    AppFuncs.deleteFromDBResult(logMsg, dbResult);
                }
            }
            else
            {
                MessageBox.Show("Виберіть рядок для видалення");
            }
        }
Exemplo n.º 8
0
        public override void EditObject()
        {
            DataGridViewRow dgvRow = base.getSelectedDataRow();

            if (dgvRow != null)
            {
                int        editId = (int)dgvRow.Cells["Id"].Value;
                Department dep    = new Department()
                {
                    Id = editId, Name = (string)dgvRow.Cells["Name"].Value
                };
                DepartmentForm frm    = new DepartmentForm(dep);
                DialogResult   result = frm.ShowDialog();
                AppFuncs.dialogCloseResult(frm.GetType().Name, result);
                if (result == DialogResult.OK)
                {
                    bool dbResult = DBContext.UpdateEntity(frm.Department);
                    if (dbResult)
                    {
                        this.LoadDataToGrid();
                        base.selectGridRowById(frm.Department.Id);
                    }
                    AppFuncs.saveToDBResult(dbResult);
                }
                base.EditObject();
            }
        }
Exemplo n.º 9
0
        public override void EditObject()
        {
            DataGridViewRow dgvRow = base.getSelectedDataRow();

            if (dgvRow != null)
            {
                int           editId = (int)dgvRow.Cells["Id"].Value;
                ScheduleModel sched  = new ScheduleModel()
                {
                    Id             = editId,
                    DepartmentName = Convert.ToString(dgvRow.Cells["Відділ"].Value),
                    DepartmentId   = Convert.ToInt32(dgvRow.Cells["DepartmentId"].Value),
                    Approved       = Convert.ToBoolean(dgvRow.Cells["Затверджений"].Value),
                    Date           = Convert.ToDateTime(dgvRow.Cells["Дата"].Value),
                    Dir            = Convert.ToString(dgvRow.Cells["Ким"].Value)
                };
                Schedule     frm    = new Schedule(sched);
                DialogResult result = frm.ShowDialog();
                AppFuncs.dialogCloseResult(frm.GetType().Name, result);
                if (result == DialogResult.OK)
                {
                    bool dbResult = DBContext.UpdateSchedule(sched);
                    if (dbResult)
                    {
                        this.LoadDataToGrid();
                        base.selectGridRowById(editId);
                    }
                    AppFuncs.saveToDBResult(dbResult);
                }
                base.EditObject();
            }
        }
Exemplo n.º 10
0
        public NewPhone(PhoneModel phone)
        {
            _isNew = (phone == null);
            AppFuncs.openEditForm(this.GetType().Name, _isNew);

            InitializeComponent();

            FormsHelper.SetDepartmentsComboBox(cbxFormPhoneDepartment);

            FormsHelper.SetFocusEventHandlers(this, Color.Yellow, Color.White);

            if (_isNew)
            {
                this.Text = "Створення нового комнтакта";
            }
            else
            {
                this.Text        = "Редагування контакта";
                _phone           = phone;
                tbxFio.Text      = _phone.FIO;
                tbxPosition.Text = _phone.Positions;
                cbxFormPhoneDepartment.SelectedValue = _phone.Department;
                tbxDect.Text          = _phone.Dect;
                tbxMobile.Text        = _phone.Mobile;
                tbxPhone.Text         = _phone.Phone;
                tbxFormPhoneMail.Text = _phone.Mail;
            }
            //
        }
Exemplo n.º 11
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            AppFuncs.WriteLogTraceMessage(" - press button 'Зберегти'");

            if (isValidInput())
            {
                if (_isNew || isUpdate())
                {
                    if (_currentDep == null)
                    {
                        _currentDep = new Department();
                    }
                    _currentDep.Id    = int.Parse(tbxId.Text);
                    _currentDep.Name  = tbxName.Text;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            else
            {
                _currentDep = null;
            }
        }
Exemplo n.º 12
0
        public override void DeleteObject()
        {
            int id = getSelectedId();

            if (id != -1)
            {
                DialogResult result = MessageBox.Show("Ви впевнені що хочете видалити поточний графік?", "Видалення графіка", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    string logMsg = $"Видалення поточний графіку, id {id}";
                    AppFuncs.WriteLogTraceMessage(logMsg + "...");

                    bool dbResult = DBContext.DeleteSchedule(id);
                    if (dbResult)
                    {
                        base.DeleteObject();
                    }
                    AppFuncs.deleteFromDBResult(logMsg, dbResult);
                }
            }
            else
            {
                MessageBox.Show("Виберіть рядок для видалення");
            }
        }
Exemplo n.º 13
0
        public override void EditObject()
        {
            if (base.AllowEdit == false)
            {
                base.notAllowEditAction(); return;
            }

            DataGridViewRow dgvRow = base.getSelectedDataRow();

            if (dgvRow != null)
            {
                int        editId = (int)dgvRow.Cells["Id"].Value;
                PhoneModel phone  = new PhoneModel(editId);

                NewPhone     frm    = new NewPhone(phone);
                DialogResult result = frm.ShowDialog();
                AppFuncs.dialogCloseResult(frm.GetType().Name, result);
                if (result == DialogResult.OK)
                {
                    bool dbResult = DBContext.UpdateEntity(phone);
                    if (dbResult)
                    {
                        this.LoadDataToGrid();
                        base.selectGridRowById(editId);
                    }
                    AppFuncs.saveToDBResult(dbResult);
                }
                base.EditObject();
            }
        }//Edit
Exemplo n.º 14
0
        public override void DeleteObject()
        {
            if (base.AllowEdit == false)
            {
                base.notAllowEditAction(); return;
            }

            int id = getSelectedId();

            if (id != -1)
            {
                DialogResult result = MessageBox.Show("Ви впевнені що хочете видалити поточний телефон?", "Видалення телефона", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    string logMsg = $"Видалення з телефоного довiдника, id {id}";
                    AppFuncs.WriteLogTraceMessage(logMsg + "...");

                    bool dbResult = DBContext.DeleteEntityById(PhoneModel._dbTableName, id);
                    if (dbResult)
                    {
                        base.DeleteObject();
                    }
                    AppFuncs.deleteFromDBResult(logMsg, dbResult);
                }
            }
            else
            {
                MessageBox.Show("Виберіть рядок для видалення");
            }
        }
Exemplo n.º 15
0
        }//Edit

        public override void CreateNewObject()
        {
            if (base.AllowEdit == false)
            {
                base.notAllowEditAction(); return;
            }

            NewPhone     frm    = new NewPhone(null);
            DialogResult result = frm.ShowDialog();

            AppFuncs.dialogCloseResult(frm.GetType().Name, result);
            if ((result == DialogResult.OK) && (frm.PhoneModel != null))
            {
                bool dbResult = DBContext.InsertEntity(frm.PhoneModel);
                if (dbResult)
                {
                    this.LoadDataToGrid();
                    base.selectGridRowById(frm.PhoneModel.Id);
                }
                AppFuncs.saveToDBResult(dbResult);
            }
            frm.Dispose();

            base.CreateNewObject();
        }
Exemplo n.º 16
0
        public override void DeleteObject()
        {
            int id = getSelectedId();

            if (id != -1)
            {
                DataGridViewRow dgvRow  = base.getSelectedDataRow();
                string          nameTpl = dgvRow.Cells["Name"].ToString();

                DialogResult result = MessageBox.Show($"Ви впевнені що хочете видалити шаблон службової '{nameTpl}' ?", "Видалення шаблону службової", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    string logMsg = $"Видалення шаблон службової '{nameTpl}'";
                    AppFuncs.WriteLogTraceMessage(logMsg + "...");
                    bool dbResult = DBContext.DeleteEntityById(NoteTemplate._dbTableName, id);
                    if (dbResult)
                    {
                        base.DeleteObject();
                    }
                    AppFuncs.deleteFromDBResult(logMsg, dbResult);
                }
            }
            else
            {
                MessageBox.Show("Виберіть рядок для видалення");
            }
        }
Exemplo n.º 17
0
        public override void EditObject()
        {
            DataGridViewRow dgvRow = base.getSelectedDataRow();

            if (dgvRow != null)
            {
                int          editId = (int)dgvRow.Cells["Id"].Value;
                NoteTemplate note   = new NoteTemplate(editId);

                NoteTemplateForm frm    = new NoteTemplateForm(note);
                DialogResult     result = frm.ShowDialog();
                AppFuncs.dialogCloseResult(frm.GetType().Name, result);
                if (result == DialogResult.OK)
                {
                    bool dbResult = DBContext.UpdateEntity(note);
                    if (dbResult)
                    {
                        this.LoadDataToGrid();
                        base.selectGridRowById(editId);
                        MessageBox.Show("Шаблон службової оновлен", "Оновлення шаблону службової", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    AppFuncs.saveToDBResult(dbResult);
                }
                base.EditObject();
            }
        }
Exemplo n.º 18
0
        private static void dbErrorAction(string errMsg)
        {
            AppFuncs.WriteLogErrorMessage(errMsg);

            MessageBox.Show(errMsg, "Ошибка доступа к данным", MessageBoxButtons.OK, MessageBoxIcon.Error);

            FlyDoc.Forms.MainForm.SendMail(@"*****@*****.**", "Error!", "Упс, помилка!\nНа комп'ютері: " + System.Environment.MachineName + " З користувачем: " + System.Environment.UserName + " сталася наступна помилка:\n\n" + errMsg);
        }
Exemplo n.º 19
0
        private void btnWrite_Click(object sender, EventArgs e)
        {
            AppFuncs.WriteLogTraceMessage(" - press button 'Зберегти'");

            DateTime dt = dateTimePicker.Value.Date;

            MessageBox.Show(dt.ToString());
        }
Exemplo n.º 20
0
        private void clickPhoneButton(bool isLog = true)
        {
            if (isLog)
            {
                AppFuncs.WriteLogInfoMessage($"Нажата кнопка ТЕЛЕФОНИ");
            }

            tabControlMain.SelectTab("tpgPhoneBook");
        }
Exemplo n.º 21
0
        public override void LoadDataToGrid()
        {
            AppFuncs.WriteLogTraceMessage($" - {this.GetType().Name}.LoadDataToGrid()");

            _dataTable = DBContext.GetNoteTemplates();  // чтение данных о шаблонах сл.зап.
            base.LoadDataToGrid();

            AppFuncs.SetDGVColumnsFromDescr(_dataGrid, AppNoteTemplates.dgvColDescr);
        }
Exemplo n.º 22
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            AppFuncs.WriteLogTraceMessage("   - press button 'Зберегти'");

            if (isValidInput())
            {
                if (_isNew || isUpdate())
                {
                    if (_currentTemplate == null)
                    {
                        _currentTemplate = new NoteTemplate();
                    }

                    _currentTemplate.Name     = tbxTplName.Text;
                    _currentTemplate.Help     = tbxHelp.Text;
                    _currentTemplate.HeadDir  = tbxHeadDir.Text;
                    _currentTemplate.HeadNach = tbxTableColums.Text;
                    _currentTemplate.BodyUp   = tbxBodyUp.Text;
                    _currentTemplate.BodyDown = tbxBodyDown.Text;

                    _currentTemplate.TableColums  = tbxTableColums.Text.ToInt();
                    _currentTemplate.ColumName1   = tbxColumnName1.Text;
                    _currentTemplate.ColumName2   = tbxColumnName2.Text;
                    _currentTemplate.ColumName3   = tbxColumnName3.Text;
                    _currentTemplate.ColumName4   = tbxColumnName4.Text;
                    _currentTemplate.ColumName5   = tbxColumnName5.Text;
                    _currentTemplate.ColumName6   = tbxColumnName6.Text;
                    _currentTemplate.ColumName7   = tbxColumnName7.Text;
                    _currentTemplate.ColumName8   = tbxColumnName8.Text;
                    _currentTemplate.ColumName9   = tbxColumnName9.Text;
                    _currentTemplate.ColumName10  = tbxColumnName10.Text;
                    _currentTemplate.ApprASU      = cbxApprASU.Checked;
                    _currentTemplate.ApprBuh      = cbxApprBuh.Checked;
                    _currentTemplate.ApprComdir   = cbxApprComdir.Checked;
                    _currentTemplate.ApprDir      = cbxApprDir.Checked;
                    _currentTemplate.ApprDostavka = cbxApprDostavka.Checked;
                    _currentTemplate.ApprEnerg    = cbxApprEnerg.Checked;
                    _currentTemplate.ApprFin      = cbxApprFin.Checked;
                    _currentTemplate.ApprKasa     = cbxApprKasa.Checked;
                    _currentTemplate.ApprNach     = cbxApprNach.Checked;
                    _currentTemplate.ApprSB       = cbxApprSB.Checked;
                    _currentTemplate.ApprSBNach   = cbxApprSBNach.Checked;
                    _currentTemplate.ApprSklad    = cbxApprSklad.Checked;

                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            else
            {
                _currentTemplate = null;
            }
        }
Exemplo n.º 23
0
        private void gridDelete()
        {
            if (_currentModel == null)
            {
                return;
            }

            AppFuncs.WriteLogTraceMessage($" - {_currentModel.GetType().Name}.Delete()");
            _currentModel.DeleteObject();
        }
Exemplo n.º 24
0
        private void clickConfigButton()
        {
            AppFuncs.WriteLogInfoMessage($"Нажата кнопка КОНФIГУРАЦIЯ");

            _userModel.LoadDataToGrid();
            _noteTemplateModel.LoadDataToGrid();
            _departmentModel.LoadDataToGrid();

            tabControlMain.SelectTab("tpgConfig");
        }
Exemplo n.º 25
0
        private void clickNoteButton()
        {
            AppFuncs.WriteLogInfoMessage($"Нажата кнопка СЛУЖБОВI");

            _dgvNoteRowChangedEnable = false;
            _noteModel.LoadDataToGrid();
            _dgvNoteRowChangedEnable = true;

            tabControlMain.SelectTab("tpgNotes");
        }
Exemplo n.º 26
0
        public override void LoadDataToGrid()
        {
            AppFuncs.WriteLogTraceMessage($" - {this.GetType().Name}.LoadDataToGrid()");

            _dataTable = DBContext.GetDepartments();
            base.LoadDataToGrid();

            // show Id
            _dataGrid.Columns[0].Visible    = true;
            _dataGrid.Columns[0].FillWeight = 25;
        }
Exemplo n.º 27
0
        public NoteTemplateForm(NoteTemplate pTemplate)
        {
            _isNew = (pTemplate == null);
            AppFuncs.openEditForm(this.GetType().Name, _isNew);

            InitializeComponent();

            // подписаться на события фокуса
            //FormsHelper.SetFocusEventHandlers(this, Color.Yellow, Color.White);
            if (_isNew)
            {
                this.Text = "Створення нового шаблону службової записки";
            }
            else
            {
                this.Text        = "Редагування існуючого шаблону";
                _currentTemplate = pTemplate;
                #region заполнение полей
                tbxTplName.Text         = _currentTemplate.Name;
                tbxHelp.Text            = _currentTemplate.Help;
                tbxHeadDir.Text         = _currentTemplate.HeadDir;
                tbxBodyUp.Text          = _currentTemplate.BodyUp;
                tbxHeadNach.Text        = _currentTemplate.HeadNach;
                tbxTableColums.Text     = _currentTemplate.TableColums.ToString();
                tbxColumnName1.Text     = _currentTemplate.ColumName1;
                tbxColumnName2.Text     = _currentTemplate.ColumName2;
                tbxColumnName3.Text     = _currentTemplate.ColumName3;
                tbxColumnName4.Text     = _currentTemplate.ColumName4;
                tbxColumnName5.Text     = _currentTemplate.ColumName5;
                tbxColumnName6.Text     = _currentTemplate.ColumName6;
                tbxColumnName7.Text     = _currentTemplate.ColumName7;
                tbxColumnName8.Text     = _currentTemplate.ColumName8;
                tbxColumnName9.Text     = _currentTemplate.ColumName9;
                tbxColumnName10.Text    = _currentTemplate.ColumName10;
                tbxBodyDown.Text        = _currentTemplate.BodyDown;
                cbxApprASU.Checked      = _currentTemplate.ApprASU;
                cbxApprBuh.Checked      = _currentTemplate.ApprBuh;
                cbxApprComdir.Checked   = _currentTemplate.ApprComdir;
                cbxApprDir.Checked      = _currentTemplate.ApprDir;
                cbxApprDostavka.Checked = _currentTemplate.ApprDostavka;
                cbxApprEnerg.Checked    = _currentTemplate.ApprEnerg;
                cbxApprFin.Checked      = _currentTemplate.ApprFin;
                cbxApprKasa.Checked     = _currentTemplate.ApprKasa;
                cbxApprNach.Checked     = _currentTemplate.ApprNach;
                cbxApprSB.Checked       = _currentTemplate.ApprSB;
                cbxApprSBNach.Checked   = _currentTemplate.ApprSBNach;
                cbxApprSklad.Checked    = _currentTemplate.ApprSklad;
                #endregion
            }
        }
Exemplo n.º 28
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            AppFuncs.WriteLogTraceMessage(" - press button 'Зберегти'");

            if (isValidInput())
            {
                if (_isNew || isUpdate())
                {
                    if (_currentUser == null)
                    {
                        _currentUser = new User();
                    }
                    _currentUser.PC           = tbxPC.Text;
                    _currentUser.UserName     = tbxUserName.Text;
                    _currentUser.Department   = (int)cbxDepartment.SelectedValue;
                    _currentUser.Notes        = checkBoxNote.Checked;
                    _currentUser.Schedule     = checkBoxSchedule.Checked;
                    _currentUser.Phone        = checkBoxPhonebook.Checked;
                    _currentUser.Config       = checkBoxConfig.Checked;
                    _currentUser.ApprNach     = checkBoxApprovedN.Checked;
                    _currentUser.ApprSB       = checkBoxApprovedSB.Checked;
                    _currentUser.ApprDir      = checkBoxApprovedDir.Checked;
                    _currentUser.Mail         = tbxMail.Text;
                    _currentUser.ApprAvtor    = checkBoxApprAvtor.Checked;
                    _currentUser.ApprComdir   = checkBoxApprComdir.Checked;
                    _currentUser.ApprSBNach   = checkBoxApprSBN.Checked;
                    _currentUser.ApprKasa     = checkBoxApprKasa.Checked;
                    _currentUser.ApprFin      = checkBoxApprFin.Checked;
                    _currentUser.ApprDostavka = checkBoxApprDastavka.Checked;
                    _currentUser.ApprEnerg    = checkBoxApprEnerg.Checked;
                    _currentUser.ApprSklad    = checkBoxApprSklad.Checked;
                    _currentUser.ApprBuh      = checkBoxApprBun.Checked;
                    _currentUser.ApprASU      = checkBoxApprASU.Checked;
                    _currentUser.Name         = tbxName.Text;
                    _currentUser.HeadNach     = tbxHeadNach.Text;

                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            else
            {
                _currentUser = null;
            }
        }
Exemplo n.º 29
0
        public UserForm(User pUser)
        {
            _isNew = (pUser == null);
            AppFuncs.openEditForm(this.GetType().Name, _isNew);

            InitializeComponent();

            // получить данные и настроить комбобокс отделов
            FormsHelper.SetDepartmentsComboBox(cbxDepartment);

            // подписаться на события фокуса
            FormsHelper.SetFocusEventHandlers(this, Color.Yellow, Color.White);

            if (_isNew)
            {
                this.Text = "Створення нового користувача";
            }
            else
            {
                this.Text                    = "Редагування користувача";
                _currentUser                 = pUser;
                tbxPC.Text                   = _currentUser.PC;
                tbxUserName.Text             = _currentUser.UserName;
                cbxDepartment.SelectedValue  = _currentUser.Department;
                checkBoxNote.Checked         = _currentUser.Notes;
                checkBoxSchedule.Checked     = _currentUser.Schedule;
                checkBoxPhonebook.Checked    = _currentUser.Phone;
                checkBoxConfig.Checked       = _currentUser.Config;
                checkBoxApprovedN.Checked    = _currentUser.ApprNach;
                checkBoxApprovedSB.Checked   = _currentUser.ApprSB;
                checkBoxApprovedDir.Checked  = _currentUser.ApprDir;
                checkBoxApprAvtor.Checked    = _currentUser.ApprAvtor;
                checkBoxApprComdir.Checked   = _currentUser.ApprComdir;
                checkBoxApprSBN.Checked      = _currentUser.ApprSBNach;
                checkBoxApprKasa.Checked     = _currentUser.ApprKasa;
                checkBoxApprFin.Checked      = _currentUser.ApprFin;
                checkBoxApprDastavka.Checked = _currentUser.ApprDostavka;
                checkBoxApprEnerg.Checked    = _currentUser.ApprEnerg;
                checkBoxApprSklad.Checked    = _currentUser.ApprSklad;
                checkBoxApprBun.Checked      = _currentUser.ApprBuh;
                checkBoxApprASU.Checked      = _currentUser.ApprASU;
                tbxName.Text                 = _currentUser.Name;
                tbxHeadNach.Text             = _currentUser.HeadNach;
                tbxMail.Text                 = _currentUser.Mail;
            }
        }
Exemplo n.º 30
0
 static void Main(string[] args)
 {
     try
     {
         AppFuncs.Listener();
     }
     catch (Exception exception)
     {
         Misc.ConsoleLog(ConsoleColor.Green, exception.ToString());
         Misc.WriteDataToFile(@"..\..\Log.txt", exception.ToString());
     }
     finally
     {
         Console.Write("Press any key to quit: ");
         Console.ReadKey();
     }
 }