private bool TrySave() { try { if (!IsHaveChanges()) { return(true); } if (!CopyFields()) { return(false); } _organization.Save(); History.Save(_organization, UserLogged.Get()); ShowHistory(); return(true); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private bool TrySave() { try { CopyFields(); _organization.Save(); History.Save(_organization, UserLogged.Get()); ShowHistory(); return(true); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message, "Обязательное поле", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (NotImplementedException ex) { MessageBox.Show(ex.Message, "Ошибка создания", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(false); }
private void LoadFirstTable() { dgvLpuRR.DataSource = _lpuRRList.ToDataTable(UserLogged.Get()); dgvLpuRR.Columns[0].Width = 70; dgvLpuRR.Columns[1].Width = 200; dgvLpuRR.Columns[2].Width = 370; dgvLpuRR.Columns[3].Width = 100; }
private void LoadDictionaries() { if (UserLogged.Get().RoleSF == RolesSF.Пользователь) { ClassForForm.LoadDictionary(cbRealRegion, _realRegionList.ToDataTable(UserLogged.Get())); } else { ClassForForm.LoadDictionary(cbRealRegion, _realRegionList.ToDataTable()); } }
public bool DeletePerson() { if (MessageBox.Show("Вы действительно хотите удалить персону?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { Person person = GetPerson(); person.Delete(); History.Save(person, UserLogged.Get(), HistoryAction.Удалил); return(true); } return(false); }
public bool DeleteOrganization() { Organization organization = GetOrganization(); if ((organization != null) && (ClassForForm.DeleteOrganization(organization))) { History.Save(organization, UserLogged.Get(), HistoryAction.Удалил); return(true); } return(false); }
private void GetSettings() { Settings settings = new Settings(); if (UserLogged.Get().RoleSF == RolesSF.Администратор) { SetEditMode(true); } else { SetEditMode(settings.GetEditMode()); } }
public PersonListController(DataGridView dgv, Organization organization) : base(dgv) { _organization = organization; _dgv = dgv; _seacher = new SearchInDgv(_dgv); _personList = PersonList.GetUniqueInstance(); _user = UserLogged.Get(); _filtredDGV = new FilteredDGV(dgv); _sortDGV = new SortDGV(dgv); }
private void btnOK_Click(object sender, EventArgs e) { CopyFields(); string res = _userLPU.Save(UserLogged.Get()); if (res == "1") { DialogResult = System.Windows.Forms.DialogResult.OK; } else { MessageBox.Show("Перемещение не возможно, так как " + res, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadSecondTable() { DataTable dt = _lpuCompetitorsList.ToDataTable(UserLogged.Get()); dgvLPUCompetitors.DataSource = dt; if (dt != null) { dgvLPUCompetitors.Columns[0].Visible = false; dgvLPUCompetitors.CurrentCell = dgvLPUCompetitors.Rows[0].Cells[1]; dgvLPUCompetitors.Columns[2].Width = 150; dgvLPUCompetitors.Columns[3].Width = 100; ResizeDGV(); } }
private void btnAddUserLPU_Click(object sender, EventArgs e) { LpuRR lpuRR = GetLpuRR(); if (lpuRR.StatusLPU == StatusLPU.Неактивен) { MessageBox.Show("Невозможно прикрепить ЛПУ к пользователю, ЛПУ имеет статус \"Неактивен\"", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } User user = GetUser(); SDiv sdiv = GetSDiv(); UserLpuRR userLpuRR = new UserLpuRR(user, lpuRR, sdiv); userLpuRR.Save(UserLogged.Get()); loadData2(); }
private async void LoadDictionaries() { ClassForForm.LoadDictionary(cbTypeLpu, _typeLPUList.ToDataTable()); ClassForForm.LoadDictionary(cbOwnership, _ownershipList.ToDataTable()); ClassForForm.LoadDictionary(cbAdmLevel, _admLevelList.ToDataTable()); ClassForForm.LoadDictionary(cbMainSpec, _mainSpecList.ToDataTable()); ClassForForm.LoadDictionary(cbTypeFin, _typeFinList.ToDataTable()); _isLoad = false; if (UserLogged.Get().RoleSF == RolesSF.Пользователь) { ClassForForm.LoadDictionary(cbRealRegion, _realRegionList.ToDataTable(UserLogged.Get())); } else { ClassForForm.LoadDictionary(cbRealRegion, _realRegionList.ToDataTable()); } _isLoad = true; DataTable dtLpuRR = await _lpuRRList.ToDataTableAsync(_lpu.LpuRR); DataTable dtLpuRR2 = await _lpuRRList.ToDataTableAsync(_lpu.LpuRR2); ClassForForm.LoadDictionary(cbLpuRR, dtLpuRR, false); ClassForForm.LoadDictionary(cbLpuRR2, dtLpuRR2, false); if (_lpu.LpuRR != null) { cbLpuRR.SelectedValue = _lpu.LpuRR.ID; lbRegionRR.Text = _lpu.LpuRR.RegionRR.Name; } if (_lpu.LpuRR2 != null) { cbLpuRR2.SelectedValue = _lpu.LpuRR2.ID; lbRegionRR2.Text = _lpu.LpuRR2.RegionRR.Name; } }
private void LoadData() { cbLpuRR.Enabled = (UserLogged.Get().RoleSF == RolesSF.Администратор); cbLpuRR2.Enabled = (UserLogged.Get().RoleSF == RolesSF.Администратор); this.Text = (_parentLPU == null) ? "Карточка Организации \"ЛПУ\"" : "Карточка Организации \"Филиал ЛПУ\""; lbKPP.Text = (_parentLPU == null) ? "КПП:" : "КПП*:"; lbCrmID.Text = (_lpu.CrmID == string.Empty) ? "не присвоен" : _lpu.CrmID; lbNumberLpuID.Text = (_lpu.ID == 0) ? "не присвоен" : _lpu.ID.ToString(); lbLpuRRId.Text = (_lpu.LpuRR == null) ? "не присвоен" : _lpu.LpuRR.ID.ToString(); lbTypeOrg.Text = _lpu.TypeOrg.ToString(); if (_lpu.TypeLPU != null) { cbTypeLpu.SelectedValue = _lpu.TypeLPU.ID; } if (_lpu.Ownership != null) { cbOwnership.SelectedValue = _lpu.Ownership.ID; } if (_lpu.AdmLevel != null) { cbAdmLevel.SelectedValue = _lpu.AdmLevel.ID; } if (_lpu.MainSpec != null) { cbMainSpec.SelectedValue = _lpu.MainSpec.ID; } if (_lpu.TypeFin != null) { cbTypeFin.SelectedValue = _lpu.TypeFin.ID; } tbName.Text = _lpu.Name; tbShortName.Text = _lpu.ShortName; if (_lpu.ShortName == string.Empty) { lbBranchName.Text = string.Empty; lbLPUName.Text = string.Empty; } if (_lpu.LpuRR != null) { cbLpuRR.SelectedValue = _lpu.LpuRR.ID; lbRegionRR.Text = _lpu.LpuRR.RegionRR.Name; } if (_lpu.LpuRR2 != null) { cbLpuRR2.SelectedValue = _lpu.LpuRR2.ID; lbRegionRR2.Text = _lpu.LpuRR2.RegionRR.Name; } tbKPP.Text = _lpu.KPP; tbPostIndex.Text = _lpu.PostIndex; tbEmail.Text = _lpu.Email; tbWebSite.Text = _lpu.Website; tbPhone.Text = _lpu.Phone; tbCity.Text = _lpu.City; if (_lpu.RealRegion != null) { cbRealRegion.SelectedValue = _lpu.RealRegion.ID; } if (_parentLPU == null) { tbINN.Text = _lpu.INN; } else { tbINN.Text = _parentLPU.INN; tbINN.ReadOnly = true; } tbSubRegion.Text = _lpu.SubRegion; tbStreet.Text = _lpu.Street; tbBedsTotal.Text = _lpu.BedsTotal; tbBedsIC.Text = _lpu.BedsIC; tbBedsSurgical.Text = _lpu.BedsSurgical; tbOperating.Text = _lpu.Operating; SetReadOnlyAvitum(); if (_lpu.IsHaveDepartment()) { OrganizationList organizationoList = OrganizationList.GetUniqueInstance(); var childList = from item in organizationoList.GetChildList(_lpu) where item.TypeOrg == TypeOrg.Отделение select new { MachineGD = string.IsNullOrEmpty(item.MachineGD) ? 0 : Convert.ToInt32(item.MachineGD), MachineGDF = string.IsNullOrEmpty(item.MachineGDF) ? 0 : Convert.ToInt32(item.MachineGDF), MachineCRRT = string.IsNullOrEmpty(item.MachineCRRT) ? 0 : Convert.ToInt32(item.MachineCRRT), Shift = string.IsNullOrEmpty(item.Shift) ? 0 : Convert.ToInt32(item.Shift), PatientGD = string.IsNullOrEmpty(item.PatientGD) ? 0 : Convert.ToInt32(item.PatientGD), PatientPD = string.IsNullOrEmpty(item.PatientPD) ? 0 : Convert.ToInt32(item.PatientPD), PatientCRRT = string.IsNullOrEmpty(item.PatientCRRT) ? 0 : Convert.ToInt32(item.PatientCRRT) }; tbMachineGD.Text = childList.Sum(item => item.MachineGD).ToString(); tbMachineGDF.Text = childList.Sum(item => item.MachineGDF).ToString(); tbMachineCRRT.Text = childList.Sum(item => item.MachineCRRT).ToString(); tbShift.Text = childList.Sum(item => item.Shift).ToString(); tbPatientGD.Text = childList.Sum(item => item.PatientGD).ToString(); tbPatientPD.Text = childList.Sum(item => item.PatientPD).ToString(); tbPatientCRRT.Text = childList.Sum(item => item.PatientCRRT).ToString(); } else { tbMachineGD.Text = _lpu.MachineGD; tbMachineGDF.Text = _lpu.MachineGDF; tbMachineCRRT.Text = _lpu.MachineCRRT; tbShift.Text = _lpu.Shift; tbPatientGD.Text = _lpu.PatientGD; tbPatientPD.Text = _lpu.PatientPD; tbPatientCRRT.Text = _lpu.PatientCRRT; } LoadTree(); ShowHistory(); }