private PfeSearchFieldDefinition ParovanieSearchFieldDef(TypBiznisEntityEnum conditionFilterValue, string code, string sField, string sDisplayField) { var res = new PfeSearchFieldDefinition() { Condition = new List <PfeFilterAttribute> { new PfeFilterAttribute { Field = sField, ComparisonOperator = "eq", Value = (int)conditionFilterValue, LogicOperator = "AND", LeftBrace = 1, RightBrace = 1 } }, Code = code, NameField = nameof(BiznisEntitaDokladView.D_BiznisEntita_Id), DisplayField = sDisplayField, AdditionalFilterDesc = "(osoba dokladu)", InputSearchField = nameof(BiznisEntitaDokladView.BiznisEntitaPopis) }; return(res); }
public static string GetDigiMestoKodByTypBiznisEntity(TypBiznisEntityEnum typBiznisEntityEnum) { switch (typBiznisEntityEnum) { case TypBiznisEntityEnum.DFA: return("FDOD"); case TypBiznisEntityEnum.OFA: return("FODB"); case TypBiznisEntityEnum.OOB: case TypBiznisEntityEnum.DOB: return("OBJ"); case TypBiznisEntityEnum.OZM: case TypBiznisEntityEnum.DZM: return("ZML"); } return(null); }
public static List <NodeAction> AddDokladActions( this List <NodeAction> list, IWebEasRepositoryBase repository, string modulCode, TypBiznisEntityEnum typBiznisEntityEnum = TypBiznisEntityEnum.Unknown, TypBiznisEntityEnum zdrojTypBiznisEntity = TypBiznisEntityEnum.Unknown, List <Types.Reg.TypBiznisEntityNastavView> typBiznisEntityNastavView = null) { var buttons = new NodeAction(NodeActionType.MenuButtons) { ActionIcon = NodeActionIcons.EllipsisV, //AngleDoubleRight Caption = "Viac", //Iné SelectionMode = PfeSelection.Multi, MenuButtons = new List <NodeAction>() }; string tbeCurr = ""; bool editCurr = true; if (typBiznisEntityEnum == TypBiznisEntityEnum.IND) { tbeCurr = modulCode + "-evi-intd"; } else if (typBiznisEntityEnum == TypBiznisEntityEnum.PDK) { tbeCurr = modulCode + "-pok-pdk"; } else if (typBiznisEntityEnum == TypBiznisEntityEnum.BAN) { tbeCurr = modulCode + "-bnk-ban"; } else if (typBiznisEntityEnum == TypBiznisEntityEnum.PPP) { tbeCurr = modulCode + "-bnk-ppp"; } else if (typBiznisEntityNastavView != null && typBiznisEntityEnum != TypBiznisEntityEnum.Unknown) { tbeCurr = typBiznisEntityNastavView.FirstOrDefault(x => x.KodDokladu == typBiznisEntityEnum.ToString()).PolozkaStromu; } if (!string.IsNullOrEmpty(tbeCurr)) { editCurr = CanWrite(repository, tbeCurr); } if ((modulCode == "crm" || modulCode == "fin" || modulCode == "rzp" || modulCode == "uct") && editCurr) { buttons.MenuButtons.Add(new NodeAction(NodeActionType.CopyMe) { SelectionMode = PfeSelection.Multi, Url = $"/office/{modulCode}/CopyDoklad", GroupType = "PostRequest", IdField = "D_BiznisEntita_Id" }); } if (typBiznisEntityEnum == TypBiznisEntityEnum.DFA || typBiznisEntityEnum == TypBiznisEntityEnum.OFA) { buttons.MenuButtons.Add(new NodeAction(NodeActionType.Dobropis) { SelectionMode = PfeSelection.Single, Url = $"/office/{modulCode}/CopyDoklad", GroupType = "PostRequest", IdField = "D_BiznisEntita_Id" }); } if (typBiznisEntityEnum == TypBiznisEntityEnum.DFA || typBiznisEntityEnum == TypBiznisEntityEnum.DZF || typBiznisEntityEnum == TypBiznisEntityEnum.OFA || typBiznisEntityEnum == TypBiznisEntityEnum.OZF || modulCode == "dap" ) { if (CanWrite(repository, "fin-bnk-ppp")) { list.Add(new NodeAction(NodeActionType.VytvoritPlatPrikaz) { SelectionMode = PfeSelection.Multi, Url = "/office/fin/GeneratePolozkyPPP" }); } } if (modulCode != "dap" && editCurr) //dane síce majú službu na zmenu stavu, ale nikde nie je použité { var changeStateDtoTypeName = $"WebEas.Esam.ServiceModel.Office.{modulCode}.Dto.ChangeStateDto, WebEas.Esam.ServiceModel.Office.{modulCode}"; var changeStateDtoType = Type.GetType(changeStateDtoTypeName, false, true); if (changeStateDtoType != null) { // TODO: Role budu riesene zvlast na kod polozky cez CFE buttons.MenuButtons.Add(new NodeAction(NodeActionType.ZmenaStavu, changeStateDtoType) { IdField = "D_BiznisEntita_Id" }); } } if (modulCode == "crm" && zdrojTypBiznisEntity != TypBiznisEntityEnum.Unknown && typBiznisEntityNastavView != null) { var crmDokladyDod = new List <TypBiznisEntityEnum>() { TypBiznisEntityEnum.DFA, TypBiznisEntityEnum.DZF, TypBiznisEntityEnum.DZM, TypBiznisEntityEnum.DOB, TypBiznisEntityEnum.DCP, TypBiznisEntityEnum.DDP, }; var crmDokladyOdb = new List <TypBiznisEntityEnum>() { TypBiznisEntityEnum.OFA, TypBiznisEntityEnum.DOL, TypBiznisEntityEnum.OZF, TypBiznisEntityEnum.OZM, TypBiznisEntityEnum.OOB, TypBiznisEntityEnum.OCP, TypBiznisEntityEnum.ODP }; var typyBe = typBiznisEntityNastavView.Where(x => crmDokladyDod.Union(crmDokladyOdb).Any(z => z == (TypBiznisEntityEnum)x.C_TypBiznisEntity_Id)); if (typyBe.Any(x => x.KodORS == "ORJ" && x.KodDokladu != "IND" && x.EvidenciaSystem == true && (TypBiznisEntityEnum)x.C_TypBiznisEntity_Id == zdrojTypBiznisEntity)) { var typyBeZdroj = typyBe.Where(x => x.KodORS == "ORJ" && x.KodDokladu != "IND" && x.EvidenciaSystem == true && x.C_TypBiznisEntity_Id != (int)zdrojTypBiznisEntity).ToList(); if (zdrojTypBiznisEntity == TypBiznisEntityEnum.DZF && typyBeZdroj.Any(x => x.C_TypBiznisEntity_Id == (int)TypBiznisEntityEnum.DFA)) { var tbe = typyBeZdroj.First(x => x.C_TypBiznisEntity_Id == (int)TypBiznisEntityEnum.DFA); if (CanWrite(repository, tbe.PolozkaStromu)) { list.Add(CopyDokladAction(NodeActionType.CopyToFA, tbe, NodeActionIcons.AngleDoubleRight, false)); } typyBeZdroj.Remove(tbe); } if (zdrojTypBiznisEntity == TypBiznisEntityEnum.OZF && typyBeZdroj.Any(x => x.C_TypBiznisEntity_Id == (int)TypBiznisEntityEnum.OFA)) { var tbe = typyBeZdroj.First(x => x.C_TypBiznisEntity_Id == (int)TypBiznisEntityEnum.OFA); if (CanWrite(repository, tbe.PolozkaStromu)) { list.Add(CopyDokladAction(NodeActionType.CopyToFA, tbe, NodeActionIcons.AngleDoubleRight, false)); } typyBeZdroj.Remove(tbe); } bool first; var defPar = Enum.GetNames(typeof(ParovanieDefEnum)); if (defPar.Any(x => x.StartsWith(zdrojTypBiznisEntity.ToString()))) { first = buttons.MenuButtons.Count > 0; foreach (var def in defPar.Where(x => x.StartsWith(zdrojTypBiznisEntity.ToString()))) { var par = def.Split('_'); if (typyBeZdroj.Any(x => ((TypBiznisEntityEnum)x.C_TypBiznisEntity_Id).ToString() == par[1])) { var tbe = typyBeZdroj.First(x => ((TypBiznisEntityEnum)x.C_TypBiznisEntity_Id).ToString() == par[1]); if (CanWrite(repository, tbe.PolozkaStromu)) { buttons.MenuButtons.Add(CopyDokladAction(NodeActionType.CopyTo, tbe, NodeActionIcons.AngleDoubleRight, first, "&refLeft=" + (int)Enum.Parse(typeof(ParovanieDefEnum), def))); first = false; } typyBeZdroj.Remove(tbe); } } } if (defPar.Any(x => x.EndsWith(zdrojTypBiznisEntity.ToString()))) { first = true; foreach (var def in defPar.Where(x => x.EndsWith(zdrojTypBiznisEntity.ToString()))) { var par = def.Split('_'); if (typyBeZdroj.Any(x => ((TypBiznisEntityEnum)x.C_TypBiznisEntity_Id).ToString() == par[0])) { var tbe = typyBeZdroj.First(x => ((TypBiznisEntityEnum)x.C_TypBiznisEntity_Id).ToString() == par[0]); if (CanWrite(repository, tbe.PolozkaStromu)) { buttons.MenuButtons.Add(CopyDokladAction(NodeActionType.CopyTo, tbe, NodeActionIcons.AngleDoubleLeft, first, "&refRight=" + (int)Enum.Parse(typeof(ParovanieDefEnum), def))); first = false; } typyBeZdroj.Remove(tbe); } } } if (crmDokladyDod.Contains(zdrojTypBiznisEntity)) { first = true; foreach (var tbe in typyBeZdroj.Where(x => crmDokladyDod.Contains((TypBiznisEntityEnum)x.C_TypBiznisEntity_Id)).ToList()) { if (CanWrite(repository, tbe.PolozkaStromu)) { buttons.MenuButtons.Add(CopyDokladAction(NodeActionType.CopyTo, tbe, NodeActionIcons.FilesO, first)); first = false; } typyBeZdroj.Remove(tbe); } first = true; foreach (var tbe in typyBeZdroj.ToList()) { if (CanWrite(repository, tbe.PolozkaStromu)) { buttons.MenuButtons.Add(CopyDokladAction(NodeActionType.CopyTo, tbe, NodeActionIcons.FilesO, first)); first = false; } typyBeZdroj.Remove(tbe); } } if (crmDokladyOdb.Contains(zdrojTypBiznisEntity)) { first = true; foreach (var tbe in typyBeZdroj.Where(x => crmDokladyOdb.Contains((TypBiznisEntityEnum)x.C_TypBiznisEntity_Id)).ToList()) { if (CanWrite(repository, tbe.PolozkaStromu)) { buttons.MenuButtons.Add(CopyDokladAction(NodeActionType.CopyTo, tbe, NodeActionIcons.FilesO, first)); first = false; } typyBeZdroj.Remove(tbe); } first = true; foreach (var tbe in typyBeZdroj.ToList()) { if (CanWrite(repository, tbe.PolozkaStromu)) { buttons.MenuButtons.Add(CopyDokladAction(NodeActionType.CopyTo, tbe, NodeActionIcons.FilesO, first)); first = false; } typyBeZdroj.Remove(tbe); } } } } if (modulCode == "fin" && editCurr) { buttons.MenuButtons.Add(new NodeAction(NodeActionType.StornovatDoklad) { Url = $"/office/{modulCode}/StornovatDoklad", GroupType = "PostRequest", IdField = "D_BiznisEntita_Id" }); } if (buttons.MenuButtons.Count > 0) { list.Add(buttons); } return(list); }