public Macro(string name, int nprms, Dictionary <string, int> prmIndMap, LPU?[] prmDefaults, LPU unformatted) { this.name = name; this.nprms = nprms; this.prmIndMap = prmIndMap; this.prmDefaults = prmDefaults; this.unformatted = unformatted; }
public FormAddOrganization(Organization organization) { InitializeComponent(); _organization = organization; _parentLPU = (_organization.ParentOrganization as LPU); _mainSpecList = MainSpecList.GetUniqueInstance(); _historyList = HistoryList.GetUniqueInstance(); }
public FormSecondStepAddOrganization(LPU lpu) { InitializeComponent(); _realRegionList = RealRegionList.GetUniqueInstance(); _lpuCompetitorsList = LpuCompetitorsList.GetUniqueInstance(); _lpuRRList = LpuRRList.GetUniqueInstance(); _lpu = lpu; _seacher = new SearchInDgv(dgvLPUCompetitors); }
private void loadSFLPU() { IController <RegionRR> controller = new LPUController <RegionRR>(); DataGridView dgv = controller.GetDataGridView(lpuRR.RegionRR); dgv.CellDoubleClick += (object sender, DataGridViewCellEventArgs e) => { LPU lpu = lpuList.GetItem(Convert.ToInt32(dgv[0, e.RowIndex].Value)); tbSName.Text = lpu.ShortName; tbName.Text = lpu.Name; }; this.Controls.Add(dgv); }
public FormAddLPU(LPU lpu) { InitializeComponent(); _lpu = lpu; if (_lpu.ParentOrganization != null) { _parentLPU = (_lpu.ParentOrganization as LPU); } _isLoad = false; _typeLPUList = TypeLPUList.GetUniqueInstance(); _ownershipList = OwnershipList.GetUniqueInstance(); _admLevelList = AdmLevelList.GetUniqueInstance(); _mainSpecList = MainSpecList.GetUniqueInstance(); _realRegionList = RealRegionList.GetUniqueInstance(); _typeFinList = TypeFinList.GetUniqueInstance(); _historyList = HistoryList.GetUniqueInstance(); _lpuRRList = LpuRRList.GetUniqueInstance(); }
private static Errorable <LPU> ResolveUnit( Func <string, Errorable <LPU> > argResolve, Func <string, List <LPU>, Errorable <LPU> > macroReinvResolve, LPU x) { Errorable <List <LPU> > resolveAcc(IEnumerable <LPU> args) => Acc(args.Select(a => ResolveUnit(argResolve, macroReinvResolve, a))); Errorable <LPU> reloc(Errorable <ParseUnit> pu) { return(pu.isValid ? new LPU(pu.value, x.location) : Errorable <LPU> .Fail(pu.errors)); } return(x.unit.Match( macroVar: argResolve, macroReinv: macroReinvResolve, paren: ns => reloc(resolveAcc(ns).Map(ParseUnit.Paren)), words: ns => reloc(resolveAcc(ns).Map(ParseUnit.Words)), nswords: ns => reloc(resolveAcc(ns).Map(ParseUnit.NoSpaceWords)), postfix: ns => reloc(resolveAcc(ns).Map(ParseUnit.Postfix)), deflt: () => Errorable <LPU> .OK(x))); }
private bool CopyFields() { if ((tbName.Text == "") || (tbSName.Text == "")) { return(false); } if ((rbNonActive.Checked) || (rbGroup.Checked)) { LPU lpu = lpuList.GetItem(lpuRR); if (lpu != null) { MessageBox.Show("Установить статус " + ((rbNonActive.Checked) ? "\"неактивен\"" : "\"групповой\"") + " нельзя - имеется сопоставление с ЛПУ-SF № " + lpu.ID, "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } lpuRR.Name = tbSName.Text; lpuRR.FullName = tbName.Text; lpuRR.StatusLPU = (rbActive.Checked) ? StatusLPU.Активен : (rbNonActive.Checked) ? StatusLPU.Неактивен : StatusLPU.Групповой; return(true); }
public DataTable ToDataTableWithSF(User user) { var list = List.Select(item => item as UserLpuRR).ToList(); if (user.RoleSF == RolesSF.Пользователь) { UserRightList userRightList = UserRightList.GetUniqueInstance(); list = list.Where(item => userRightList.IsInList(user, item.LpuRR.RegionRR)).ToList(); RoleList roleList = RoleList.GetUniqueInstance(); Role role = roleList.GetItem(ROLE_RP_ID) as Role; if (user.Role == role) { list = list.Where(item => item.User == user).ToList(); } } //list = list.Where(item => item.YearEnd == DateTime.Today.Year).ToList(); DataTable dt = new DataTable(); dt.Columns.Add("№ ЛПУ-RR", typeof(int)); dt.Columns.Add("ФИО РП"); dt.Columns.Add("Дивизион"); dt.Columns.Add("Начало отчётности"); dt.Columns.Add("Окончание отчётности"); dt.Columns.Add("Сокр. название ЛПУ-RR"); dt.Columns.Add("Полное название ЛПУ-RR"); dt.Columns.Add("Регион RR"); dt.Columns.Add("Статус"); dt.Columns.Add("Сокр. название ЛПУ-SF"); dt.Columns.Add("Регион России"); dt.Columns.Add("Город"); dt.Columns.Add("№ ЛПУ-SF"); LpuList lpuList = new LpuList(); foreach (UserLpuRR item in list) { if ((item.LpuRR == null) || (item.User == null)) { continue; } string lpuSFID = string.Empty; string lpuSFName = string.Empty; string lpuSFRealRegion = string.Empty; string lpuSFCity = string.Empty; LPU lpu = lpuList.GetItem(item.LpuRR); if (lpu != null) { lpuSFID = lpu.ID.ToString(); lpuSFName = lpu.ShortName; lpuSFRealRegion = lpu.RealRegion.Name; lpuSFCity = lpu.City; } dt.Rows.Add(new object[] { item.LpuRR.ID, item.User.Name, item.Sdiv.ToString(), item.YearBegin, item.YearEnd, item.LpuRR.Name, item.LpuRR.FullName, item.LpuRR.RegionRR.Name, item.LpuRR.StatusLPU.ToString(), lpuSFName, lpuSFRealRegion, lpuSFCity, lpuSFID }); } return(dt); }
public DataTable ToDataTableWithLpuSF(User user) { DataTable dt = new DataTable(); dt.Columns.Add("№ ЛПУ-RR", typeof(int)); dt.Columns.Add("Сокр. название ЛПУ-RR"); dt.Columns.Add("Полное название ЛПУ-RR"); dt.Columns.Add("Регион RR"); dt.Columns.Add("Статус"); dt.Columns.Add("Использование"); dt.Columns.Add("Сокр. название ЛПУ-SF"); dt.Columns.Add("Регион России"); dt.Columns.Add("Город"); dt.Columns.Add("№ ЛПУ-SF"); dt.Columns.Add("color"); LpuList lpuList = new LpuList(); List <LpuRR> listNew = new List <LpuRR>(); listNew = List.Select(item => item as LpuRR).ToList(); if (user.RoleSF == RolesSF.Пользователь) { UserRightList userRightList = UserRightList.GetUniqueInstance(); listNew = listNew.Where(item => userRightList.IsInList(user, item.RegionRR)).ToList(); } foreach (LpuRR lpuRR in listNew) { if (lpuRR.ID == 0) { continue; } LPU lpu = lpuList.GetItem(lpuRR); string lpuName = string.Empty; string realRegionName = string.Empty; string cityName = string.Empty; string lpuID = string.Empty; if (lpu != null) { lpuName = lpu.ShortName; realRegionName = (lpu.RealRegion != null) ? lpu.RealRegion.Name : string.Empty; cityName = lpu.City; lpuID = lpu.ID.ToString(); } bool colorWhite = true; if (user.RoleSF == RolesSF.Пользователь) { colorWhite = IsUserLpu(lpuRR, user); } dt.Rows.Add(new object[] { lpuRR.ID, lpuRR.Name, lpuRR.FullName, lpuRR.RegionRR.Name, lpuRR.StatusLPU.ToString(), (IsLpuUsed(lpuRR) ? "Используется" : "Не используется"), lpuName, realRegionName, cityName, lpuID, colorWhite }); } return(dt); }
static bool isLambda(LPU lpu) => lpu.unit.type == ParseUnit.Type.LambdaMacroParam;
private Errorable <LPU> RealizeOverUnit(List <LPU> args, LPU unfmtd) => Macro.ResolveUnit(
public static Macro Create(string name, List <MacroArg> prms, LPU unformatted) => new Macro(
private void Update(OrganizationModel model) { Organization organization = GetOrganization(model); if (organization == null) { return; } organization.NumberSF = model.NumberSF; organization.CrmID = model.CrmID; if (model.ParentNumberSF != string.Empty) { organization.ParentOrganization = organizationList.GetItem(model.ParentNumberSF) ?? organization.ParentOrganization; } organization.Name = model.Name; organization.ShortName = model.ShortName; organization.Email = model.Email; organization.Website = model.Website; organization.Phone = model.Phone; organization.Pharmacy = model.Pharmacy; organization.Deleted = model.Deleted; organization.INN = model.INN; organization.KPP = model.KPP; organization.RealRegion = GetItem(realRegionList, model.RealRegion, "Region", model.NumberSF) as RealRegion; organization.City = model.City; organization.PostIndex = model.PostIndex; organization.Street = model.Street; if (organization is LPU) { LPU lpu = organization as LPU; lpu.AdmLevel = GetItem(admLevelList, model.AdmLevel, "AdminLevel", model.NumberSF) as AdmLevel; lpu.TypeFin = GetItem(typeFinList, model.TypeFin, "TypeFin", model.NumberSF) as TypeFin; lpu.MainSpec = GetItem(mainSpecList, model.MainSpec, "MainSpec", model.NumberSF) as MainSpec; lpu.SubRegion = model.SubRegion; lpu.BedsTotal = model.BedsTotal; lpu.BedsIC = model.BedsIC; lpu.BedsSurgical = model.BedsSurgical; lpu.Operating = model.Operating; lpu.TypeLPU = GetItem(typeLPUList, model.TypeLPU, "Hospital type", model.NumberSF) as TypeLPU; lpu.Ownership = GetItem(ownershipList, model.Ownership, "Ownership", model.NumberSF) as Ownership; } if (organization is IAvitum) { IAvitum avitum = organization as IAvitum; avitum.MachineGD = model.MachineGD; avitum.MachineGDF = model.MachineGDF; avitum.MachineCRRT = model.MachineCRRT; avitum.Shift = model.Shifts; avitum.PatientGD = model.PatientGD; avitum.PatientPD = model.PatientPD; avitum.PatientCRRT = model.PatientCRRT; } organization.Save(); }
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(); }