public static TreeNode GetRoot(Organization organization, TreeNode root = null) { TreeNode node = new TreeNode(organization.ShortName); node.Name = organization.ID.ToString(); node.ImageIndex = (organization is LPU) ? 1 : 0; node.SelectedImageIndex = (organization is LPU) ? 1 : 0; if (root != null) { root.Nodes.Add(node); } OrganizationList organizationList = OrganizationList.GetUniqueInstance(); var list = organizationList.GetChildList(organization); foreach (var item in list) { GetRoot(item, node); } return(node); }
public static bool DeleteOrganization(Organization organization) { if (MessageBox.Show(string.Concat("Вы действительно хотите удалить организацию \"", organization.ShortName, "\"?\n\nПри этом будут удалены входящие в неё подразделения и привязанные к ним персоны, если таковые имеются."), "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { OrganizationList organizationList = OrganizationList.GetUniqueInstance(); if (organizationList.GetChildList(organization).Count() > 0) { if (MessageBox.Show("У филиала имеются зависимые организации, они будут также удалены. Продолжить удаление?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { return(false); } } PersonList personList = PersonList.GetUniqueInstance(); if (personList.GetItems(organization).Count() > 0) { if (MessageBox.Show("В организации имеются сотрудники, они будут также удалены. Продолжить удаление?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { return(false); } } organization.Delete(); return(true); } return(false); }
private Organization GetOrganization() { int id; int.TryParse(dgv.Rows[dgv.CurrentCell.RowIndex].Cells[0].Value.ToString(), out id); OrganizationList organizationList = OrganizationList.GetUniqueInstance(); return(organizationList.GetItem(id)); }
private Organization GetOrganization(TypeOrg typeOrg, bool haveParent) { Organization organization = new Organization(typeOrg); if (haveParent) { organization.ParentOrganization = OrganizationList.GetUniqueInstance().GetFirst(); } return(organization); }
public ReadFileOrganization() { organizationList = OrganizationList.GetUniqueInstance(); realRegionList = RealRegionList.GetUniqueInstance(); admLevelList = AdmLevelList.GetUniqueInstance(); typeFinList = TypeFinList.GetUniqueInstance(); mainSpecList = MainSpecList.GetUniqueInstance(); subRegionList = SubRegionList.GetUniqueInstance(); typeLPUList = TypeLPUList.GetUniqueInstance(); ownershipList = OwnershipList.GetUniqueInstance(); }
private Organization GetOrganization() { if (_dgv.CurrentCell == null) { return(null); } int id = Convert.ToInt32(_dgv.Rows[_dgv.CurrentCell.RowIndex].Cells[0].Value); OrganizationList organizationList = OrganizationList.GetUniqueInstance(); return(organizationList.GetItem(id)); }
public void SetStyle() { foreach (DataGridViewRow row in _dgv.Rows) { int id; int.TryParse(row.Cells["RR ID"].Value.ToString(), out id); OrganizationList organizationList = OrganizationList.GetUniqueInstance(); Organization organization = organizationList.GetItem(id); if (organization.Deleted) { row.DefaultCellStyle.ForeColor = Color.Red; } } }
public Person(DataRow row) : base(row) { LastName = row["person_lastName"].ToString(); NumberSF = row["person_numberSF"].ToString(); FirstName = row["person_firstName"].ToString(); SecondName = row["person_secondName"].ToString(); Appeal = Convert.ToInt32(row["appeal_id"].ToString()); int idPosition; int.TryParse(row["position_id"].ToString(), out idPosition); PositionList positionList = PositionList.GetUniqueInstance(); Position = positionList.GetItem(idPosition) as Position; int idMainSpecPerson; int.TryParse(row["mainSpecPerson_id"].ToString(), out idMainSpecPerson); MainSpecPersonList mainSpecPersonList = MainSpecPersonList.GetUniqueInstance(); MainSpecPerson = mainSpecPersonList.GetItem(idMainSpecPerson) as MainSpecPerson; int idAcademTitle; int.TryParse(row["academTitle_id"].ToString(), out idAcademTitle); AcademTitleList academTitleList = AcademTitleList.GetUniqueInstance(); AcademTitle = academTitleList.GetItem(idAcademTitle) as AcademTitle; Email = row["person_email"].ToString(); Mobile = row["person_mobile"].ToString(); Phone = row["person_phone"].ToString(); Comment = row["person_comment"].ToString(); int idOrganization; int.TryParse(row["organization_id"].ToString(), out idOrganization); OrganizationList organizationList = OrganizationList.GetUniqueInstance(); Organization = organizationList.GetItem(idOrganization); CrmID = row["person_crmID"].ToString(); Deleted = false; }
public virtual void Save() { int id; int.TryParse(_provider.Insert("SF_Organization", ID, NumberSF, TypeOrg, Name, ShortName, (MainSpec == null) ? 0 : MainSpec.ID, Email, Website, Phone, (ParentOrganization == null) ? 0 : ParentOrganization.ID, _machineGD, _machineGDF, _machineCRRT, _shift, _patientGD, _patientPD, _patientCRRT, INN, KPP, PostIndex, (RealRegion == null) ? 0 : RealRegion.ID, City, Street, Pharmacy, Deleted.ToString(), CrmID ), out id); ID = id; OrganizationList organizationList = OrganizationList.GetUniqueInstance(); organizationList.Add(this); }
public virtual void Delete() { OrganizationList organizationList = OrganizationList.GetUniqueInstance(); organizationList.Delete(this); }
public bool IsHaveDepartment() { return(OrganizationList.GetUniqueInstance().GetChildList(this).Count(item => item.TypeOrg == TypeOrg.Отделение) > 0); }
public override void Save() { if (ID == 0) { LpuList lpuList = new LpuList(); if (lpuList.IsInList(INN)) { throw new NullReferenceException("В списке уже есть организация с таким ИНН"); } } int idParentOrganization; idParentOrganization = (ParentOrganization == null) ? 0 : ParentOrganization.ID; int idLPURR = (LpuRR == null) ? 0 : LpuRR.ID; int idLPURR2 = (LpuRR2 == null) ? 0 : LpuRR2.ID; int id; int.TryParse(_provider.Insert("SF_LPU", ID, NumberSF, TypeOrg, Name, ShortName, (MainSpec == null) ? 0 : MainSpec.ID, Email, Website, Phone, idParentOrganization, (TypeLPU == null) ? 0 : TypeLPU.ID, (Ownership == null) ? 0 : Ownership.ID, (AdmLevel == null) ? 0 : AdmLevel.ID, INN, KPP, PostIndex, (RealRegion == null) ? 0 : RealRegion.ID, City, Street, idLPURR, _bedsTotal, _bedsIC, _bedsSurgical, _operating, _machineGD, _machineGDF, _machineCRRT, _shift, _patientGD, _patientPD, _patientCRRT, SubRegion, (TypeFin == null) ? 0 :TypeFin.ID, idLPURR2, Deleted.ToString(), CrmID ), out id); ID = id; OrganizationList.GetUniqueInstance().Add(this); }
private Organization GetOrganization(RelationshipModel model) { OrganizationList organizationList = OrganizationList.GetUniqueInstance(); return(organizationList.GetItem(model.OrganizationNumberSF)); }
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(); }
private Organization GetOrganization(TreeNode node) { OrganizationList organizationList = OrganizationList.GetUniqueInstance(); return(organizationList.GetItem(Convert.ToInt32(node.Name))); }
private void Export(Language lang) { OrganizationList organizationList = OrganizationList.GetUniqueInstance(); string[] columnNames = (lang == Language.Rus) ? _columnNamesRus : _columnNamesEng; DataTable dt = CreateDataTable(columnNames); HistoryList historyList = HistoryList.GetUniqueInstance(); foreach (var item in organizationList.List) { Organization organization = item.Value; LPU lpu = (organization.TypeOrg == TypeOrg.ЛПУ) ? (organization as LPU) : null; int parentID = (organization.ParentOrganization == null) ? organization.ID : organization.ParentOrganization.ID; string recordType = GetRecordType(organization); string inn = (organization.INN == "") ? "" : "'" + organization.INN; string kpp = (organization.KPP == "") ? "" : "'" + organization.KPP; string realRegionName = (organization.RealRegion == null) ? "" : organization.RealRegion.Name; string postIndex = organization.PostIndex; string pharmacy = ((organization.TypeOrg == TypeOrg.Аптека) && (organization.ParentOrganization == null)) ? (organization as Organization).Pharmacy : string.Empty; string mainSpec = (organization.MainSpec != null) ? organization.MainSpec.GetName(lang) : string.Empty; string typeLPU = string.Empty; string ownership = string.Empty; string adminLevel = string.Empty; string typeFin = string.Empty; if (lpu != null) { typeLPU = lpu.TypeLPU.GetName(lang); ownership = lpu.Ownership.GetName(lang); adminLevel = lpu.AdmLevel.GetName(lang); typeFin = lpu.TypeFin.GetName(lang); } object[] row; if (lang == Language.Rus) { string street = organization.Street; string idLpuRR = string.Empty; string idLpuRR2 = string.Empty; if (lpu != null) { idLpuRR = ((lpu.ParentOrganization == null) || ((lpu.ParentOrganization != null) && (lpu.LpuRR.ID != 0))) ? lpu.LpuRR.ID.ToString() : string.Empty; idLpuRR2 = (lpu.LpuRR2.ID != 0) ? lpu.LpuRR2.ID.ToString() : string.Empty; } History created = historyList.GetItem(organization, HistoryAction.Создал); History modifed = historyList.GetItem(organization, HistoryAction.едактировал); string createdAuthor = (created != null) ? created.Author : string.Empty; string createdDatetime = (created != null) ? created.datetime : string.Empty; string modifedAuthor = (modifed != null) ? modifed.Author : string.Empty; string modifedDatetime = (modifed != null) ? modifed.datetime : string.Empty; row = new object[] { organization.ID, parentID, organization.NumberSF, recordType, GetFormatTypeOrg(organization), GetClientType(organization), organization.Name, organization.ShortName, inn, kpp, realRegionName, organization.City, postIndex, street, organization.Email, organization.Website, organization.Phone, pharmacy, typeLPU, ownership, adminLevel, typeFin, mainSpec, lpu.SubRegion, idLpuRR, idLpuRR2, (lpu != null) ? lpu.BedsTotal : string.Empty, (lpu != null) ? lpu.BedsIC : string.Empty, (lpu != null) ? lpu.BedsSurgical : string.Empty, (lpu != null) ? lpu.Operating : string.Empty, organization.MachineGD, organization.MachineGDF, organization.MachineCRRT, organization.Shift, organization.PatientGD, organization.PatientPD, organization.PatientCRRT, createdAuthor, createdDatetime, modifedAuthor, modifedDatetime }; } else { string MachineGD = string.Empty; string MachineGDF = string.Empty; string MachineCRRT = string.Empty; string Shift = string.Empty; string PatientGD = string.Empty; string PatientPD = string.Empty; string PatientCRRT = string.Empty; if ((lpu != null) && (lpu.IsHaveDepartment())) { OrganizationList organizationoList = OrganizationList.GetUniqueInstance(); var childList = from child in organizationoList.GetChildList(lpu) where child.TypeOrg == TypeOrg.Отделение select new { MachineGD = string.IsNullOrEmpty(child.MachineGD) ? 0 : Convert.ToInt32(child.MachineGD), MachineGDF = string.IsNullOrEmpty(child.MachineGDF) ? 0 : Convert.ToInt32(child.MachineGDF), MachineCRRT = string.IsNullOrEmpty(child.MachineCRRT) ? 0 : Convert.ToInt32(child.MachineCRRT), Shift = string.IsNullOrEmpty(child.Shift) ? 0 : Convert.ToInt32(child.Shift), PatientGD = string.IsNullOrEmpty(child.PatientGD) ? 0 : Convert.ToInt32(child.PatientGD), PatientPD = string.IsNullOrEmpty(child.PatientPD) ? 0 : Convert.ToInt32(child.PatientPD), PatientCRRT = string.IsNullOrEmpty(child.PatientCRRT) ? 0 : Convert.ToInt32(child.PatientCRRT) }; MachineGD = childList.Sum(child => child.MachineGD).ToString(); if (MachineGD == "0") { MachineGD = string.Empty; } MachineGDF = childList.Sum(child => child.MachineGDF).ToString(); if (MachineGDF == "0") { MachineGDF = string.Empty; } MachineCRRT = childList.Sum(child => child.MachineCRRT).ToString(); if (MachineCRRT == "0") { MachineCRRT = string.Empty; } Shift = childList.Sum(child => child.Shift).ToString(); if (Shift == "0") { Shift = string.Empty; } PatientGD = childList.Sum(child => child.PatientGD).ToString(); if (PatientGD == "0") { PatientGD = string.Empty; } PatientPD = childList.Sum(child => child.PatientPD).ToString(); if (PatientPD == "0") { PatientPD = string.Empty; } PatientCRRT = childList.Sum(child => child.PatientCRRT).ToString(); if (PatientCRRT == "0") { PatientCRRT = string.Empty; } } else { MachineGD = organization.MachineGD; MachineGDF = organization.MachineGDF; MachineCRRT = organization.MachineCRRT; Shift = organization.Shift; PatientGD = organization.PatientGD; PatientPD = organization.PatientPD; PatientCRRT = organization.PatientCRRT; } row = new object[] { organization.ID, parentID, recordType, organization.Name, organization.ShortName, inn, kpp, realRegionName, organization.City, postIndex, GetAddressWithDistrict(organization), organization.Email, organization.Website, organization.Phone, pharmacy, GetClientType(organization), typeLPU, ownership, adminLevel, typeFin, mainSpec, lpu.SubRegion, (lpu != null) ? lpu.BedsTotal : string.Empty, (lpu != null) ? lpu.BedsIC : string.Empty, (lpu != null) ? lpu.BedsSurgical : string.Empty, (lpu != null) ? lpu.Operating : string.Empty, MachineGD, MachineGDF, MachineCRRT, Shift, PatientGD, PatientPD, PatientCRRT }; } dt.Rows.Add(row); } CreateExcel excel = new CreateExcel(dt); excel.Show(); }