public List <StavEntityView> GetListNaslStavEntity(int idStavEntity) { var filter = new Filter("C_StavEntity_Id_Parent", idStavEntity); List <NasledovnyStavEntity> naslStavy = this.GetList <NasledovnyStavEntity>(filter); filter = new Filter(FilterElement.In("C_StavEntity_Id", naslStavy.Select(nav => nav.C_StavEntity_Id_Child))); return(this.GetList <StavEntityView>(filter)); }
public static void AddFilterForIDsDkl(Filter filter, Dictionary <string, object> parameters) { if (parameters.ContainsKey("C_STREDISKO_ID")) { filter.And(Filter.OrElements(FilterElement.Custom("VyzadovatStredisko = 0"), FilterElement.In("C_Stredisko_Id", parameters["C_STREDISKO_ID"].ToString().FromJson <List <int> >()))); } if (parameters.ContainsKey("C_PROJEKT_ID")) { filter.And(Filter.OrElements(FilterElement.Custom("VyzadovatProjekt = 0"), FilterElement.In("C_Projekt_Id", parameters["C_PROJEKT_ID"].ToString().FromJson <List <int> >()))); } if (parameters.ContainsKey("C_TYPBIZNISENTITY_KNIHA_ID")) { filter.And(FilterElement.In("C_TypBiznisEntity_Kniha_Id", parameters["C_TYPBIZNISENTITY_KNIHA_ID"].ToString().FromJson <List <int> >())); } if (parameters.ContainsKey("C_TYPBIZNISENTITY_ID")) { filter.And(FilterElement.In("C_TypBiznisEntity_Id", parameters["C_TYPBIZNISENTITY_ID"].ToString().FromJson <List <int> >())); } }
static string parseParam(Filter filter, string sqlFromAlias, Dictionary <string, object> parameters, string fld) { if (parameters.ContainsKey(fld)) { string ids = parameters[fld].ToString(); if (ids.Contains(",")) { sqlFromAlias = sqlFromAlias.Replace("@" + fld, "NULL"); filter.Remove(fld); filter.And(FilterElement.In(fld, ids.FromJson <List <int> >())); } else { sqlFromAlias = sqlFromAlias.Replace("@" + fld, ids); filter.Remove(fld); } } else { sqlFromAlias = sqlFromAlias.Replace("@" + fld, "NULL"); } return(sqlFromAlias); }
public static void AddFilterForIDsRzp(Filter filter, Dictionary <string, object> parameters, IWebEasRepositoryBase repository) { #region Rozpočtová položka if (parameters.ContainsKey("C_RZPPOL_ID")) { // JP: spadne ak sa zavola v "Zmeny rozpoctu" akcia na polozke "Zobrazit prehlad rozpoctu" - vieme o tom riesenie in progress (FE) filter.And(FilterElement.In("C_RzpPol_Id", parameters["C_RZPPOL_ID"].ToString().FromJson <List <int> >())); } if (parameters.ContainsKey("RZPUCETNAZOV")) // Zadaná časť textu rozpočtovej položky { filter.And(FilterElement.Like("RzpUcetNazov", string.Concat(parameters["RZPUCETNAZOV"].ToString(), "%"))); } #endregion #region FRZdroj string zdIds = parameters.ContainsKey("C_FRZDROJ_ID") ? parameters["C_FRZDROJ_ID"].ToString() : string.Empty; if (!zdIds.IsEmpty()) { //Multiselect ID hodnôt, filtrujem cez jednotlivé časti ZD var fks = repository.Db.Select(repository.Db.From <FRZdrojView>() .Select(x => new { x.C_FRZdroj_Id, x.ZD1, x.ZD2, x.ZD3, x.ZD4, x.ZD5, x.ZdrojKod, x.Platny }) .Where(x => Sql.In(x.C_FRZdroj_Id, zdIds.FromJson <List <int> >()))); List <FilterElement> rue = new List <FilterElement>(); //Stĺpce "ZD1, ZD2, ZD3, ZD4, ZD5" nie sú v modeli, iba fyzicky v rzp.V_RzpDennik foreach (var p in fks) { string flt = string.Empty; if (p.Platny || !p.ZdrojKod.IsNullOrEmpty()) { flt = $"C_FRZdroj_Id = {p.C_FRZdroj_Id}"; //Môžem ísť cez ID } else { flt = $"ZD1 = '{p.ZD1}'"; if (!p.ZD2.IsNullOrEmpty()) { flt += $" AND ZD2 = '{p.ZD2}'"; } if (!p.ZD3.IsNullOrEmpty()) { flt += $" AND ZD3 = '{p.ZD3}'"; } if (!p.ZD4.IsNullOrEmpty()) { flt += $" AND ZD4 = '{p.ZD4}'"; } //p.ZD5 - tieto sú platné vždy } rue.Add(FilterElement.Custom(flt)); } filter.And(Filter.OrElements(rue.ToArray())); } #endregion #region FR Ekonomická klasifikácia string ekIds = parameters.ContainsKey("C_FREK_ID") ? parameters["C_FREK_ID"].ToString() : string.Empty; if (!ekIds.IsEmpty()) { //Multiselect ID hodnôt, filtrujem cez jednotlivé časti FK var eks = repository.Db.Select(repository.Db.From <FREK>() .Select(x => new { x.C_FREK_Id, x.EKPolozka, x.EKPodpolozka, x.Platny }) .Where(x => Sql.In(x.C_FREK_Id, ekIds.FromJson <List <int> >()))); List <FilterElement> rue = new List <FilterElement>(); //Stĺpce "EKPolozka, EKPodpolozka" nie sú v modeli, iba fyzicky v rzp.V_RzpDennik foreach (var p in eks) { string flt = string.Empty; if (p.Platny || !p.EKPodpolozka.IsNullOrEmpty()) //všetky s podpoložkou { flt = $"C_FREK_ID = {p.C_FREK_Id}"; //Môžem ísť cez ID } else { flt = $"EKPolozka LIKE '{p.EKPolozka.TrimEnd('0')}%'"; //Nuly sprava odstraňujem } rue.Add(FilterElement.Custom(flt)); } filter.And(Filter.OrElements(rue.ToArray())); } #endregion #region FR Funkčná klasifikácia string fkIds = parameters.ContainsKey("C_FRFK_ID") ? parameters["C_FRFK_ID"].ToString() : string.Empty; if (!fkIds.IsEmpty()) { //Multiselect ID hodnôt, filtrujem cez jednotlivé časti FK var fks = repository.Db.Select(repository.Db.From <FRFK>() .Select(x => new { x.C_FRFK_Id, x.FKOddiel, x.FKSkupina, x.FKTrieda, x.FKPodtrieda, x.Platny }) .Where(x => Sql.In(x.C_FRFK_Id, fkIds.FromJson <List <int> >()))); List <FilterElement> rue = new List <FilterElement>(); //Stĺpce "FKOddiel, FKSkupina, FKTrieda, FKPodtrieda" nie sú v modeli, iba fyzicky v rzp.V_RzpDennik foreach (var p in fks) { string flt = string.Empty; if (p.Platny || !p.FKPodtrieda.IsNullOrEmpty()) { flt = $"C_FRFK_Id = {p.C_FRFK_Id}"; //Môžem ísť cez ID } else { flt = $"FKOddiel = '{p.FKOddiel}'"; if (!p.FKSkupina.IsNullOrEmpty()) { flt += $" AND FKSkupina = '{p.FKSkupina}'"; } if (!p.FKTrieda.IsNullOrEmpty()) { flt += $" AND FKTrieda = '{p.FKTrieda}'"; } //p.FKPodtrieda - tieto sú platné vždy } rue.Add(FilterElement.Custom(flt)); } filter.And(Filter.OrElements(rue.ToArray())); } #endregion #region Programy aj s podúrovňami string programIds = parameters.ContainsKey("D_PROGRAM_ID") ? parameters["D_PROGRAM_ID"].ToString() : string.Empty; if (!programIds.IsEmpty()) { //Multiselect ID hodnôt, filtrujem cez jednotlivé časti programu var prg = repository.Db.Select(repository.Db.From <ProgramCis>() .Select(x => new { x.D_Program_Id, x.Program, x.Podprogram, x.Prvok }) .Where(x => x.D_Tenant_Id == repository.Session.TenantIdGuid && Sql.In(x.D_Program_Id, programIds.FromJson <List <int> >()))); List <FilterElement> rue = new List <FilterElement>(); foreach (var p in prg) { //Stĺpce "Program, Podprogram, Prvok" nie sú v modeli, iba fyzicky v rzp.V_RzpDennik string flt = string.Empty; if (p.Prvok != null) { flt = $"D_Program_Id = {p.D_Program_Id}"; //Môžem ísť cez ID } else { flt = $"Program = {p.Program}"; if (p.Podprogram != null) { flt += $" AND Podprogram = {p.Podprogram}"; } } rue.Add(FilterElement.Custom(flt)); } filter.And(Filter.OrElements(rue.ToArray())); } #endregion #region Analytiky A1, A2, A3 if (parameters.ContainsKey("A1")) { filter.AndEq("A1", parameters["A1"].ToString()); } if (parameters.ContainsKey("A2")) { filter.AndEq("A2", parameters["A2"].ToString()); } if (parameters.ContainsKey("A3")) { filter.AndEq("A3", parameters["A3"].ToString()); } #endregion }
public static void AddFilterForIDsUct(Filter filter, Dictionary <string, object> parameters) { if (parameters.ContainsKey("C_UCTKLUC_ID1")) { filter.And(Filter.OrElements(FilterElement.Custom("VyzadovatUctKluc1 = 0"), FilterElement.In("C_UctKluc_Id1", parameters["C_UCTKLUC_ID1"].ToString().FromJson <List <int> >()))); } if (parameters.ContainsKey("C_UCTKLUC_ID2")) { filter.And(Filter.OrElements(FilterElement.Custom("VyzadovatUctKluc2 = 0"), FilterElement.In("C_UctKluc_Id2", parameters["C_UCTKLUC_ID2"].ToString().FromJson <List <int> >()))); } if (parameters.ContainsKey("C_UCTKLUC_ID3")) { filter.And(Filter.OrElements(FilterElement.Custom("VyzadovatUctKluc3 = 0"), FilterElement.In("C_UctKluc_Id3", parameters["C_UCTKLUC_ID3"].ToString().FromJson <List <int> >()))); } }