Ejemplo n.º 1
0
		public FilterColumnChooser(FilterParams filterParams)
		{
			InitializeComponent();

			this.columnizer = filterParams.currentColumnizer;
			this.filterParams = filterParams;
			Init();
		}
Ejemplo n.º 2
0
        public static Func<Customer, bool> Filter(FilterParams filter)
        {
            Func<Customer, bool> func = (x) =>
            {
                bool result = true;
                if (filter.CityId.HasValue)
                {
                    result &= x.CityId == filter.CityId.Value;
                }

                if (filter.DistrictIds.Length > 0)
                {
                    result &= filter.DistrictIds.All(districtId => x.DistrictToClients.Any(d => d.DistrictId == districtId));//x.DistrictToClients == filter.DistrictId.Value;
                }

                if (filter.HouseTypeIds.Length > 0)
                {
                    result &= filter.HouseTypeIds.All(f => x.TypesHousingToCustomers.Any(type => type.TypesHousingId == f));
                }

                if (filter.PriceFrom.HasValue && filter.PriceTo.HasValue)
                {
                    result &= x.MinSum <= filter.PriceFrom.Value && x.MaxSum >= filter.PriceTo.Value;
                }
                else if (filter.PriceFrom.HasValue)
                {
                    result &= x.MinSum <= filter.PriceFrom.Value;
                }
                else if (filter.PriceTo.HasValue)
                {
                    result &= x.MaxSum >= filter.PriceTo.Value;
                }

                if (filter.IsArchived.HasValue)
                {
                    result &= x.IsArchive == filter.IsArchived.Value;
                }
                else
                {
                    result &= x.IsArchive == false;
                }

                if (filter.IsSiteAccessOnly.HasValue && filter.IsSiteAccessOnly.Value)
                {
                    result &= x.IsSiteAccess == true;
                }
                return result;
            };

            return func;
        }
Ejemplo n.º 3
0
        public static List<Menu> GetList(FilterParams fp)
        {
            IEnumerable<Menu> t = from o in GetAll() select o;

            //if (fp.ModuleId > 0)
            //    t = t.Where(o => o.ModuleID == fp.ModuleId);

            var key = fp.KeyWord.Trim();
            if (!string.IsNullOrEmpty(key))
            {
                key = key.ToUnsigned().ToLower();
                t = t.Where(o => o.Title.ToUnsigned().ToLower().Contains(key) || o.Description.ToUnsigned().ToLower().Contains(key));
            }
            return t.ToList();
        }
Ejemplo n.º 4
0
        public static Func<Housing, bool> Filter(FilterParams filter)
        {
            Func<Housing, bool> func = (x) =>
            {
                bool result = true;
                if (filter.CityId.HasValue)
                {
                    result &= x.CityId == filter.CityId.Value;
                }

                if (filter.DistrictId.Length > 0)
                {
                    result &= filter.DistrictId.Contains(x.DistrictId);
                }

                if (filter.HouseTypeId.Length > 0)
                {
                    result &= filter.HouseTypeId.Contains(x.TypesHousingId);
                }

                if (filter.PriceFrom.HasValue && filter.PriceTo.HasValue)
                {
                    result &= x.Sum >= filter.PriceFrom.Value && x.Sum <= filter.PriceTo.Value;
                }
                else if (filter.PriceFrom.HasValue)
                {
                    result &= x.Sum >= filter.PriceFrom.Value;
                }
                else if (filter.PriceTo.HasValue)
                {
                    result &= x.Sum <= filter.PriceTo.Value;
                }

                if (filter.IsArchived.HasValue)
                {
                    result &= x.IsArchive == filter.IsArchived.Value;
                }
                else
                {
                    result &= x.IsArchive == false;
                }
                return result;
            };

            return func;
        }
Ejemplo n.º 5
0
        public static List<Article> GetList(FilterParams fp)
        {
            IEnumerable<Article> t = from o in GetAll() select o;

            if (fp.CatId > 0)
                t = t.Where(o => o.CatID == fp.CatId);
            if (fp.Status >= 0)
                t = t.Where(o => o.Status == fp.Status);

            var key = fp.KeyWord.Trim();
            if (!string.IsNullOrEmpty(key))
            {
                key = key.ToUnsigned().ToLower();
                t = t.Where(o => o.Title.ToUnsigned().ToLower().Contains(key) || o.Summary.ToUnsigned().ToLower().Contains(key));
            }
            return t.ToList();
        }
Ejemplo n.º 6
0
		public static bool TestFilterCondition(FilterParams filterParams, string line, ILogLineColumnizerCallback columnizerCallback)
		{
			if (filterParams.lastLine.Equals(line))
			{
				return filterParams.lastResult;
			}

			bool match = TestFilterMatch(filterParams, line, columnizerCallback);
			filterParams.lastLine = line;

			if (filterParams.isRangeSearch)
			{
				if (!filterParams.isInRange)
				{
					if (match)
					{
						filterParams.isInRange = true;
					}
				}
				else
				{
					if (!match)
					{
						match = true;
					}
					else
					{
						filterParams.isInRange = false;
					}
				}
			}
			if (filterParams.isInvert)
			{
				match = !match;
			}
			filterParams.lastResult = match;
			return match;
		}
Ejemplo n.º 7
0
        public void SendFind(string schema, string collection, bool isRelational, FilterParams filter, FindParams findParams)
        {
            var builder = CreateFindMessage(schema, collection, isRelational, filter, findParams);

            _writer.Write(ClientMessageId.CRUD_FIND, builder);
        }
Ejemplo n.º 8
0
        public static List<Asset> GetRelList(int nId, string szRelType, string szSitePath, bool bAddDestId = false, string szDestId = "", int nLimit = 500)
        {
            FilterParams fpFilter = new FilterParams();

            if (szRelType.Equals("source", StringComparison.OrdinalIgnoreCase))
                fpFilter.Add(AssetPropertyNames.Label, Comparison.StartsWith, nId.ToString() + "-");
            else
                fpFilter.Add(AssetPropertyNames.Label, Comparison.EndsWith, "-" + nId.ToString());

            if (bAddDestId) fpFilter.Add(AssetPropertyNames.Label, Comparison.EndsWith, "-" + szDestId);

            fpFilter.Limit = nLimit;

            Out.DebugWriteLine("Loaded=" + Asset.Load(szSitePath + "/Relationships Config/").IsLoaded.ToString());

            return Asset.Load(szSitePath + "/Relationships Config/").GetFilterList(fpFilter);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Sends the delete documents message
        /// </summary>
        public void SendDelete(string schema, string collection, bool isRelational, FilterParams filter)
        {
            var msg = CreateDeleteMessage(schema, collection, isRelational, filter);

            _writer.Write(ClientMessageId.CRUD_DELETE, msg);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Sends the CRUD modify message
        /// </summary>
        public void SendUpdate(string schema, string collection, bool isRelational, FilterParams filter, List <UpdateSpec> updates)
        {
            var msg = CreateUpdateMessage(schema, collection, isRelational, filter, updates);

            _writer.Write(ClientMessageId.CRUD_UPDATE, msg);
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> GetAllFilms([FromQuery] FilterParams filterParams)
        {
            var films = await filmService.GetAllFilms(filterParams);

            return(Ok(films));
        }
Ejemplo n.º 12
0
 private void ApplyFilter(Action <Limit> setLimit, Action <Expr> setCriteria, Action <IEnumerable <Order> > setOrder, FilterParams filter, Action <IEnumerable <Scalar> > addParams)
 {
     if (filter.HasLimit)
     {
         var limit = new Limit();
         limit.RowCount = (ulong)filter.Limit;
         if (filter.Offset != -1)
         {
             limit.Offset = (ulong)filter.Offset;
         }
         setLimit(limit);
     }
     if (!string.IsNullOrEmpty(filter.Condition))
     {
         setCriteria(filter.GetConditionExpression(filter.IsRelational));
         if (filter.Parameters != null && filter.Parameters.Count > 0)
         {
             addParams(filter.GetArgsExpression(filter.Parameters));
         }
     }
     if (filter.OrderBy != null && filter.OrderBy.Length > 0)
     {
         setOrder(filter.GetOrderByExpressions(filter.IsRelational));
     }
 }
Ejemplo n.º 13
0
        public List <Vehicle> Get(FilterParams filterParams)
        {
            var vehicles = VehiclesNoTracking.Where(x => x.CompanyId == _info.CompanyId).Select(x => _unitWork.Mapper.Map <Vehicle>(x)).ToList();

            return(vehicles);
        }
Ejemplo n.º 14
0
        public static void RenderInput_bk(Asset asset, InputContext context)
        {
            //------------------------------------
            // Global
            //------------------------------------
            Dictionary<string, string> dicSiteType = new Dictionary<string, string>();
            dicSiteType.Add("Single Site", "single");
            dicSiteType.Add("Site Collection", "collection");
            dicSiteType.Add("Site Collection with TMF", "collection_tmf");

            Dictionary<string, string> dicMobile = new Dictionary<string, string>();
            dicMobile.Add("None", "no");
            dicMobile.Add("Responsive", "responsive");
            dicMobile.Add("Dual Output", "dual_output");
            dicMobile.Add("Dedicated", "dedicated");

            Dictionary<string, string> dicSelectOptions = new Dictionary<string, string>();
            dicSelectOptions.Add("Dropdown", "dropdown");
            dicSelectOptions.Add("Create New", "create_new");

            ShowAcquireParams sapModel = new ShowAcquireParams();
            sapModel.DefaultFolder = "/System/Models/";
            sapModel.ShowUpload = false;

            //Country data
            FilterParams fpCountry = new FilterParams();
            fpCountry.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Country Sites Config");
            Asset aCountryFolder = Asset.Load("/System/Translation Model Framework/Global/Country Sites Config/");
            Dictionary<string, string> dicCountries = new Dictionary<string, string>();
            if (aCountryFolder.IsLoaded)
            {
                foreach (Asset aFile in aCountryFolder.GetFilterList(fpCountry))
                {
                    if (!dicCountries.Keys.Contains(aFile.Label))
                    {
                        dicCountries.Add(aFile.Label, aFile.Label);
                    }
                }
            }

            //Language Data
            FilterParams fpLanguage = new FilterParams();
            fpLanguage.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Language");
            Asset aLanguageFolder = Asset.Load("/System/Translation Model Framework/Global/Languages Config/");
            Dictionary<string, string> dicLanguages = new Dictionary<string, string>();
            if (aLanguageFolder.IsLoaded)
            {
                foreach (Asset aFile in aLanguageFolder.GetFilterList(fpLanguage))
                {
                    if (!dicLanguages.Keys.Contains(aFile.Label))
                    {
                        dicLanguages.Add(aFile.Label, aFile.Label);
                    }
                }
            }

            //CP public sites
            Dictionary<string, string> dicCPSites = new Dictionary<string, string>();
            string szPublicSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-public/site-list.xml");
            if (szPublicSiteXML.Contains("<sites>"))
            {
                List<XmlNode> lsXml = Util.LoadXml(szPublicSiteXML, "file");
                foreach (XmlNode xNode in lsXml)
                {
                    dicCPSites.Add(xNode.Attributes["name"], xNode.Value);
                }
            }

            //CP Training
            Dictionary<string, string> dicCPTraining = new Dictionary<string, string>();
            string szTrainingXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-training/site-list.xml");
            if (szTrainingXML.Contains("<sites>"))
            {
                List<XmlNode> lsXml = Util.LoadXml(szTrainingXML, "file");
                foreach (XmlNode xNode in lsXml)
                {
                    dicCPTraining.Add(xNode.Attributes["name"], xNode.Value);
                }
            }

            //Partner Private sites
            Dictionary<string, string> dicPrivateSites = new Dictionary<string, string>();
            if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"]))
            {
                string szPrivateSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/partner/" + asset.Raw["private_key"] + "/site-list.xml");
                if (szPrivateSiteXML.Contains("<sites>"))
                {
                    List<XmlNode> lsXml = Util.LoadXml(szPrivateSiteXML, "file");
                    foreach (XmlNode xNode in lsXml)
                    {
                        dicPrivateSites.Add(xNode.Attributes["name"], xNode.Value);
                    }
                }
            }

            //------------------------------------
            // Input Form
            //------------------------------------
            Input.StartTabbedPanel("Import Setup", "Configuration");
            //Input.ShowRadioButton("Technology Stacks", "language_type", new Dictionary<string, string> { { "HTML", "html" }, { "NET", "net" }, { "PHP(Coming Soon)", "" }, { "Java(Coming Soon)", "" } }, "html");

            Input.StartDropDownContainer("Technology List Options", "technology_list_option", new Dictionary<string, string>() { { "CP Public", "public" }, { "CP Training", "training" }, { "Private", "private" } }, "public");
            //-----------------------------------------
            // CP Public Sites
            //-----------------------------------------
            Input.ShowDropDown("CrownPeak Technology Stacks", "cp_language_type", dicCPSites);

            Input.ShowDropDown("Create in a separate project", "new_project", new Dictionary<string, string>() { { "Yes", "yes" }, { "No", "no" } }, Util.MakeList("yes"));

            //TMF
            Input.StartDropDownContainer("Site Type", "site_type_option", dicSiteType, "single");
            //Single Site
            Input.ShowMessage("Creates a single site");
            Input.ShowTextBox("Site Name", "single_site_name");

            Input.ShowHeader("Mobile");
            Input.ShowCheckBox("", "single_site_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false);

            Input.ShowHeader("Extension");
            Input.StartHorizontalWrapContainer();
            Input.ShowCheckBox("", "single_site_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.ShowCheckBox("", "single_site_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.ShowCheckBox("", "single_site_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.EndHorizontalWrapContainer();
            Input.NextDropDownContainer();
            //Site Collection
            Input.ShowMessage("Creates collection of sites with their own templates and models");
            Input.ShowTextBox("Collection Name", "collection_name");
            while (Input.NextPanel("collection_panel", displayName: "Site List"))
            {
                Input.ShowTextBox("Site Name", "collection_site_name");

                Input.ShowHeader("Mobile");
                Input.ShowCheckBox("", "collection_site_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false);

                Input.ShowHeader("Extension");
                Input.StartHorizontalWrapContainer();
                Input.ShowCheckBox("", "collection_site_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false);
                Input.ShowCheckBox("", "collection_site_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
                Input.ShowCheckBox("", "collection_site_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
                Input.EndHorizontalWrapContainer();
            }
            Input.NextDropDownContainer();
            //Site Collection with TMF
            Input.ShowMessage("Creates collection of sites with TMF. Templates are shared");
            Input.ShowTextBox("Site Name", "collection_tmf_name");

            Input.ShowHeader("Mobile");
            Input.ShowCheckBox("", "collection_tmf_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false);

            Input.ShowHeader("Extension");
            Input.StartHorizontalWrapContainer();
            Input.ShowCheckBox("", "collection_tmf_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.ShowCheckBox("", "collection_tmf_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.ShowCheckBox("", "collection_tmf_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.EndHorizontalWrapContainer();

            while (Input.NextPanel("tmf_panel", displayName: "TMF List"))
            {
                Input.ShowCheckBox("", "master_site", "true", "Master Site", unCheckedValue: "false", defaultChecked: false);

                Input.StartHorizontalWrapContainer();
                Input.StartDropDownContainer("Country Select", "tmf_country_option", dicSelectOptions, "dropdown");
                Input.ShowDropDown("Country", "tmf_country_select", dicCountries);
                Input.NextDropDownContainer();
                Input.ShowTextBox("Country Name", "new_country_name", width: 30, helpMessage: "United States, England, etc");
                Input.EndDropDownContainer();

                Input.StartDropDownContainer("Language Select", "tmf_language_option", dicSelectOptions, "dropdown");
                Input.ShowDropDown("Language", "tmf_lang_select", dicLanguages);
                Input.NextDropDownContainer();
                Input.ShowTextBox("Language Name", "new_language_name", width: 30, helpMessage: "English, Spanish, etc");
                Input.EndDropDownContainer();
                Input.EndHorizontalWrapContainer();

                Input.ShowTextBox("Locale Name", "locale_name", helpMessage: "US-EN, AR-ES, etc");
            }
            Input.EndDropDownContainer();

            Input.NextDropDownContainer();
            //-----------------------------
            // CP Training Sites
            //-----------------------------
            Input.ShowDropDown("Training Technology Stacks", "training_language_type", dicCPTraining);
            Input.ShowDropDown("Project Level", "project_level", new Dictionary<string, string> { { "Root", "root" }, { "Nested", "nested" }, { "System", "system" } }, Util.MakeList("root"));

            Input.StartDropDownContainer("Collection Folder", "collection_folder_type", new Dictionary<string, string> { { "New", "new" }, { "Select", "select" } }, "new");
            Input.ShowTextBox("New Folder", "collection_new");
            Input.NextDropDownContainer();
            Input.ShowSelectFolder("Select", "collection_select");
            Input.EndDropDownContainer();

            Input.ShowTextBox("Site Root Name", "site_root_name");
            Input.ShowTextBox("Project Name", "project_name");
            Input.NextDropDownContainer();
            //-----------------------------
            // Partner Private Folder
            //-----------------------------
            if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"]))
            {
                Input.ShowDropDown("Private Technology Stacks", "private_language_type", dicPrivateSites);
                Input.AddHiddenField("private_language_exist", "true");
            }
            else
            {
                Input.AddHiddenField("private_language_exist", "false");
                Input.ShowMessage("Enter private key in Configuration tab, save and refesh the form");
                Input.ShowMessage("Ask CrownPeak support how to set up a private key");
            }
            Input.EndDropDownContainer();

            Input.StartControlPanel("Workflow");
            Dictionary<string, string> dicWorkflow = new Dictionary<string, string>();
            AssetParams apWorkflow = new AssetParams();
            apWorkflow.ExcludeProjectTypes = false;
            foreach (Asset aWorkflow in Asset.Load("/System/Workflows/").GetFileList(apWorkflow))
            {
                dicWorkflow.Add(aWorkflow.Label, aWorkflow.Label);
            }
            //Input.ShowTextBox("Workflow Name", "workflow_name", helpMessage: "Leaving blank will create assets without any workflow");
            Input.ShowDropDown("Workflow", "workflow_name", dicWorkflow);
            Input.EndControlPanel();

            /*
            //Mobile
            Input.StartDropDownContainer("Mobile", "include_mobile", dicMobile, "no");
            Input.NextDropDownContainer();
            //Responsive
                Input.ShowMessage("Responsive Mobile");
            Input.NextDropDownContainer();
            //Dual output
                Input.ShowMessage("Dual output shares one input template");
            Input.NextDropDownContainer();
            //Dedicated
                Input.ShowMessage("Dedicated mobile has separate templates and models");
            Input.EndDropDownContainer();
            */
            //Input.NextTabbedPanel();
            //    Input.ShowAcquireDocument("Developer Model", "model_developer", sapModel);
            //    Input.ShowAcquireDocument("File Model", "model_file", sapModel);
            //    Input.ShowAcquireDocument("Folder Model", "model_folder", sapModel);
            //    Input.ShowTextBox("Workflow Name", "workflow_name");

            Input.NextTabbedPanel();
            Input.ShowMessage("Enter private key, save and refesh the form");
            Input.ShowTextBox("Private Site Key", "private_key");
            Input.EndTabbedPanel();
        }
        public async Task <DataPage <CustomerV1> > GetCustomersAsync(string correlationId, FilterParams filter, PagingParams paging, SortParams sort)
        {
            var total = Convert.ToInt64(_customersDict.Count);
            var skip  = Convert.ToInt32(paging.Skip ?? 0);
            var take  = Convert.ToInt32(paging.Take ?? total);

            var data = _customersDict.Select(x => x.Value).Skip(skip).Take(take).ToList();

#warning Filtering is not supported
            DataPage <CustomerV1> dataPage = new DataPage <CustomerV1>(data, total);

            return(await Task.FromResult(dataPage));
        }
Ejemplo n.º 16
0
 public Task <DataPage <GuideV1> > GetPageByFilterAsync(string correlationId, FilterParams filter, PagingParams paging)
 {
     return(base.GetPageByFilterAsync(correlationId, ComposeFilter(filter), paging));
 }
        //protected override Dummy OnConvertToPublic(AnyValueMap map)
        //{
        //          Dummy dummy = new Dummy();

        //          ObjectWriter.SetProperties(dummy, map);

        //          if (map.TryGetValue(nameof(dummy.SubDummy), out object subDummyJson))
        //          {
        //              var subDummyMap = new AnyValueMap(JsonConverter.ToMap(subDummyJson.ToString()));
        //              dummy.SubDummy = ConvertSubDummyToPublic(subDummyMap);
        //          }

        //          return dummy;
        //}

        //      private SubDummy ConvertSubDummyToPublic(AnyValueMap map)
        //      {
        //          SubDummy subDummy = new SubDummy();
        //          subDummy.Type = map.GetAsNullableString(nameof(subDummy.Type));

        //          var arrayOfDouble = map.GetAsObject(nameof(subDummy.ArrayOfDouble)) as IEnumerable<object>;
        //          subDummy.ArrayOfDouble = arrayOfDouble.Select(x => System.Convert.ToDouble(x)).ToArray();
        //          return subDummy;
        //      }

        public async Task <DataPage <Dummy> > GetPageByFilterAsync(string correlationId, FilterParams filter, PagingParams paging)
        {
            filter ??= new FilterParams();
            var key = filter.GetAsNullableString("key");

            var filterCondition = "";

            if (key != null)
            {
                filterCondition += "key='" + key + "'";
            }

            return(await base.GetPageByFilterAsync(correlationId, filterCondition, paging, null, null));
        }
Ejemplo n.º 18
0
        private static bool filterByParameters(LogItem entry, FilterParams parameters)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            bool accept = false;

            switch (parameters.Level)
            {
            case 1:
                if (String.Equals(entry.Level, "ERROR",
                                  StringComparison.InvariantCultureIgnoreCase))
                {
                    accept = true;
                }
                break;

            case 2:
                if (String.Equals(entry.Level, "INFO",
                                  StringComparison.InvariantCultureIgnoreCase))
                {
                    accept = true;
                }
                break;

            case 3:
                if (String.Equals(entry.Level, "DEBUG",
                                  StringComparison.InvariantCultureIgnoreCase))
                {
                    accept = true;
                }
                break;

            case 4:
                if (String.Equals(entry.Level, "WARN",
                                  StringComparison.InvariantCultureIgnoreCase))
                {
                    accept = true;
                }
                break;

            case 5:
                if (String.Equals(entry.Level, "FATAL",
                                  StringComparison.InvariantCultureIgnoreCase))
                {
                    accept = true;
                }
                break;

            default:
                accept = true;
                break;
            }

            if (parameters.Date.HasValue)
            {
                if (entry.TimeStamp < parameters.Date)
                {
                    accept = false;
                }
            }

            if (!String.IsNullOrEmpty(parameters.Thread))
            {
                if (!String.Equals(entry.Thread, parameters.Thread, StringComparison.InvariantCultureIgnoreCase))
                {
                    accept = false;
                }
            }

            if (!String.IsNullOrEmpty(parameters.Message))
            {
                if (!entry.Message.ToUpper().Contains(parameters.Message.ToUpper()))
                {
                    accept = false;
                }
            }

            if (!String.IsNullOrEmpty(parameters.Logger))
            {
                if (!entry.Logger.ToUpper().Contains(parameters.Logger.ToUpper()))
                {
                    accept = false;
                }
            }

            return(accept);
        }
Ejemplo n.º 19
0
        public override IEnumerable <LogItem> GetEntries(string dataSource, FilterParams filter)
        {
            var settings = new XmlReaderSettings {
                ConformanceLevel = ConformanceLevel.Fragment
            };
            var nt  = new NameTable();
            var mgr = new XmlNamespaceManager(nt);

            mgr.AddNamespace("log4j", Constants.LAYOUT_LOG4J);
            var pc   = new XmlParserContext(nt, mgr, string.Empty, XmlSpace.Default);
            var date = new DateTime(1970, 1, 1, 0, 0, 0, 0);

            using (var stream = new FileStream(dataSource, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite))
            {
                using (var reader = new StreamReader(stream, System.Text.Encoding.Default, true))
                {
                    using (var xmlTextReader = XmlReader.Create(reader, settings, pc))
                    {
                        var      entryId       = 1;
                        DateTime?prevTimeStamp = null;
                        while (xmlTextReader.Read())
                        {
                            if ((xmlTextReader.NodeType != XmlNodeType.Element) || (xmlTextReader.Name != "log4j:event"))
                            {
                                continue;
                            }

                            var entry = new LogItem {
                                Id = entryId, Path = dataSource
                            };

                            entry.Logger = xmlTextReader.GetAttribute("logger");

                            entry.TimeStamp = date.AddMilliseconds(Convert.ToDouble(xmlTextReader.GetAttribute("timestamp"))).ToLocalTime();
                            if (prevTimeStamp.HasValue)
                            {
                                entry.Delta = (entry.TimeStamp - prevTimeStamp.Value).TotalSeconds;
                            }
                            prevTimeStamp = entry.TimeStamp;

                            entry.Level  = xmlTextReader.GetAttribute("level");
                            entry.Thread = xmlTextReader.GetAttribute("thread");

                            while (xmlTextReader.Read())
                            {
                                var breakLoop = false;
                                switch (xmlTextReader.Name)
                                {
                                case "log4j:event":
                                    breakLoop = true;
                                    break;

                                default:
                                    switch (xmlTextReader.Name)
                                    {
                                    case ("log4j:message"):
                                        entry.Message = xmlTextReader.ReadString();
                                        break;

                                    case ("log4j:data"):
                                        switch (xmlTextReader.GetAttribute("name"))
                                        {
                                        case ("log4net:UserName"):
                                            entry.UserName = xmlTextReader.GetAttribute("value");
                                            break;

                                        case ("log4japp"):
                                            entry.App = xmlTextReader.GetAttribute("value");
                                            break;

                                        case ("log4jmachinename"):
                                            entry.MachineName = xmlTextReader.GetAttribute("value");
                                            break;

                                        case ("log4net:HostName"):
                                            entry.HostName = xmlTextReader.GetAttribute("value");
                                            break;
                                        }
                                        break;

                                    case ("log4j:throwable"):
                                        entry.Throwable = xmlTextReader.ReadString();
                                        break;

                                    case ("log4j:locationInfo"):
                                        entry.Class  = xmlTextReader.GetAttribute("class");
                                        entry.Method = xmlTextReader.GetAttribute("method");
                                        entry.File   = xmlTextReader.GetAttribute("file");
                                        entry.Line   = xmlTextReader.GetAttribute("line");
                                        break;
                                    }
                                    break;
                                }
                                if (breakLoop)
                                {
                                    break;
                                }
                            }

                            if (filterByParameters(entry, filter))
                            {
                                yield return(entry);

                                entryId++;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 20
0
		private static bool TestMatchSub(FilterParams filterParams, string line, string lowerSearchText, string searchText, Regex rex, bool exactMatch)
		{
			if (filterParams.isRegex)
			{
				if (rex.IsMatch(line))
				{
					return true;
				}
			}
			else
			{
				if (!filterParams.isCaseSensitive)
				{
					if (exactMatch)
					{
						if (line.ToLower().Trim().Equals(lowerSearchText))
						{
							return true;
						}
					}
					else
					{
						if (line.ToLower().Contains(lowerSearchText))
						{
							return true;
						}
					}
				}
				else
				{
					if (exactMatch)
					{
						if (line.Equals(searchText))
						{
							return true;
						}
					}
					else
					{
						if (line.Contains(searchText))
						{
							return true;
						}
					}
				}

				if (filterParams.fuzzyValue > 0)
				{
					int range = line.Length - searchText.Length;
					if (range > 0)
					{
						for (int i = 0; i < range; ++i)
						{
							string src = line.Substring(i, searchText.Length);
							if (!filterParams.isCaseSensitive)
							{
								src = src.ToLower();
							}
							int dist = Distance(src, searchText);
							if ((float)(searchText.Length + 1) / (float)(dist + 1) >= 11F / (float)(filterParams.fuzzyValue + 1F))
							{
								return true;
							}
						}
					}
					return false;
				}
			}
			return false;
		}
        public ICallTreeDataProvider Get()
        {
            var queryString = this.httpRequest.Query;

            string filename  = queryString["filename"];
            string stacktype = queryString["stacktype"];

            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentNullException("filename");
            }

            if (string.IsNullOrEmpty(stacktype))
            {
                throw new ArgumentNullException("stacktype");
            }

            /* symbols and sources related parameters */
            string     sympathStr         = (string)queryString["sympath"] ?? SymbolPath.MicrosoftSymbolServerPath;
            SymbolPath symPath            = new SymbolPath(sympathStr);
            string     defaultSymbolCache = symPath.DefaultSymbolCache();

            // Normalize the symbol path.
            symPath    = symPath.InsureHasCache(defaultSymbolCache);
            sympathStr = symPath.ToString();

            string srcpath = (string)queryString["srcpath"];
            //TODO FIX NOW: Dont spew to the Console, send it back to the client.
            SymbolReader symbolReader = new SymbolReader(Console.Out, sympathStr);

            if (srcpath != null)
            {
                symbolReader.SourcePath = srcpath;
            }

            string modulePatStr = (string)queryString["symLookupPats"] ?? @"^(clr|ntoskrnl|ntdll|.*\.ni)";

            /* filtering parameters */
            string start     = (string)queryString["start"] ?? string.Empty;
            string end       = (string)queryString["end"] ?? string.Empty;
            string incpats   = (string)queryString["incpats"] ?? string.Empty;
            string excpats   = (string)queryString["excpats"] ?? string.Empty;
            string foldpats  = (string)queryString["foldpats"] ?? string.Empty;
            string grouppats = (string)queryString["grouppats"] ?? string.Empty;
            string foldpct   = (string)queryString["foldpct"] ?? string.Empty;
            string find      = (string)queryString["find"] ?? string.Empty;

            EtlxFile etlxFile;

            // Do it twice so that XXX.etl.zip becomes XXX.
            string etlxFilePath = Path.ChangeExtension(Path.ChangeExtension(filename, null), ".etlx");

            lock (this.etlxCache)
            {
                if (this.etlxCache.TryGetValue(filename, out etlxFile))
                {
                    if (etlxFile == null)
                    {
                        throw new ArgumentNullException("etlxFile");
                    }
                }
                else
                {
                    etlxFile = new EtlxFile(filename)
                    {
                        Pending = true
                    };
                    this.etlxCache.Set(filename, etlxFile, this.cacheExpirationTime);
                }
            }

            lock (etlxFile)
            {
                if (etlxFile.Pending)
                {
                    if (!File.Exists(etlxFilePath))
                    {
                        // if it's a zip file
                        if (string.Equals(Path.GetExtension(filename), ".zip", StringComparison.OrdinalIgnoreCase))
                        {
                            //TODO FIX NOW: Dont spew to the Console, send it back to the client.
                            ZippedETLReader reader = new ZippedETLReader(filename, Console.Out);
                            reader.SymbolDirectory = defaultSymbolCache;
                            reader.EtlFileName     = Path.ChangeExtension(etlxFilePath, etlExtension);
                            reader.UnpackAchive();
                            TraceLog.CreateFromEventTraceLogFile(reader.EtlFileName, etlxFilePath);
                        }
                        else
                        {
                            TraceLog.CreateFromEventTraceLogFile(filename, etlxFilePath);
                        }
                    }

                    etlxFile.TraceLog = TraceLog.OpenOrConvert(etlxFilePath);
                    etlxFile.Pending  = false;
                }

                Regex modulePat = new Regex(modulePatStr, RegexOptions.IgnoreCase);
                foreach (var moduleFile in etlxFile.TraceLog.ModuleFiles)
                {
                    if (modulePat.IsMatch(moduleFile.Name))
                    {
                        etlxFile.TraceLog.CodeAddresses.LookupSymbolsForModule(symbolReader, moduleFile);
                    }
                }
            }

            StackViewerSession stackViewerSession;

            lock (this.stackViewerSessionCache)
            {
                var filterParams = new FilterParams {
                    Name = filename + stacktype, StartTimeRelativeMSec = start, EndTimeRelativeMSec = end, MinInclusiveTimePercent = foldpct, FoldRegExs = foldpats, IncludeRegExs = incpats, ExcludeRegExs = excpats, GroupRegExs = grouppats
                };
                var keyBuilder = new StringBuilder();
                keyBuilder.Append(filterParams.Name).Append("?" + filterParams.StartTimeRelativeMSec).Append("?" + filterParams.EndTimeRelativeMSec).Append("?" + filterParams.MinInclusiveTimePercent).Append("?" + filterParams.FoldRegExs).Append("?" + filterParams.IncludeRegExs).Append("?" + filterParams.ExcludeRegExs).Append("?" + filterParams.GroupRegExs).Append("?" + find);

                var stackViewerKey = keyBuilder.ToString();
                if (this.stackViewerSessionCache.TryGetValue(stackViewerKey, out stackViewerSession))
                {
                    if (stackViewerSession == null)
                    {
                        throw new ArgumentNullException("stackViewerSession");
                    }
                }
                else
                {
                    stackViewerSession = new StackViewerSession(filename, stacktype, etlxFile.TraceLog, filterParams, symbolReader);
                    this.stackViewerSessionCache.Set(stackViewerKey, stackViewerSession, cacheExpirationTime);
                }
            }

            lock (stackViewerSession)
            {
                if (stackViewerSession.Pending)
                {
                    stackViewerSession.InitializeDataProvider();
                    stackViewerSession.Pending = false;
                }
            }

            return(stackViewerSession.GetDataProvider());
        }
Ejemplo n.º 22
0
        private static void CreateTMFRelationship(Asset masterLocale, Asset childLocale, IhSiteBuilderLog siteLog = null)
        {
            string szSiteName = IhSiteBuilderTMFHelper.GetSitePath(masterLocale).Parent.Label;

            Asset aSourceLanguageContent = masterLocale;
            Asset aDestinationLanguageContent = childLocale;

            Asset aFolderSource = Asset.Load(aSourceLanguageContent["folder_root"]);
            Asset aFolderDest = Asset.Load(aDestinationLanguageContent["folder_root"]);
            Asset aTemplConfig = Asset.Load(IhSiteBuilderTMFHelper.GetSitePath(masterLocale) + "/TMF Config/Templates configuration");

            FilterParams fpFilter = new FilterParams();
            fpFilter.Add(Comparison.Equals, AssetType.File);
            fpFilter.SortOrder = SortOrder.OrderBy(AssetPropertyNames.Label);
            fpFilter.Add(AssetPropertyNames.Label, Comparison.NotInSet, Util.MakeList(".jpeg", ".jpg", ".gif", ".png", ".js", ".css", ".pdf", ".doc", ".docx"));

            List<Asset> laPackageList = Asset.Load(aFolderSource.Id).GetFilterList(fpFilter);
            foreach (Asset aPackage in laPackageList)
            {
                int nSourceId = aPackage.Id;
                Asset aContentSource = Asset.Load(nSourceId);

                if (!string.Equals(aContentSource.TemplateId.ToString(), "0") && string.IsNullOrWhiteSpace(aTemplConfig["tmftemplate_" + aContentSource.TemplateId.ToString()]))
                {
                    string szSourcePath = aContentSource.AssetPath.ToString();
                    string szDestinationPath = szSourcePath.Replace(aSourceLanguageContent["folder_root"], aDestinationLanguageContent["folder_root"]);
                    int nDestinationId = Asset.Load(szDestinationPath).Id;

                    int nRelationshipId = 0;
                    string szDestStatus = "";
                    if (nDestinationId <= 0)
                    {
                        szDestStatus = "DESTINATION LABEL NOT FOUND, ";
                        List<Asset> laConfigList = IhSiteBuilderTMFHelper.GetRelList(nSourceId, "source", szSiteName);
                        nDestinationId = 0;
                        foreach (Asset aConfigList in laConfigList)
                        {
                            if (Asset.Load(aConfigList["destination_id"]).AssetPath.ToString().ToLower().Contains(aDestinationLanguageContent["folder_root"].ToLower()))
                            {
                                nDestinationId = Convert.ToInt32(aConfigList["destination_id"]);
                                nRelationshipId = aConfigList.Id;
                                break;
                            }
                        }
                    }
                    else
                        nRelationshipId = Asset.Load(IhSiteBuilderTMFHelper.GetSitePath(masterLocale) + "/Relationship config/" + nSourceId.ToString() + "-" + nDestinationId.ToString()).Id;

                    string szStatus = "";
                    Asset aContentDest = Asset.Load(nDestinationId);
                    if (nRelationshipId <= 0)
                    {
                        if (aContentSource.Id > 0 && aContentDest.Id > 0)
                        {
                            siteLog.Add("aContentSource: " + aContentSource.AssetPath);
                            siteLog.Add("aContentDest: " + aContentDest.AssetPath);
                            siteLog.Add("Master Locale: " + IhSiteBuilderTMFHelper.GetSitePath(masterLocale).AssetPath);
                            IhSiteBuilderTMFHelper.AutoLinkLocales(aContentSource, aContentDest, IhSiteBuilderTMFHelper.GetSitePath(masterLocale).AssetPath.ToString());
                            IhSiteBuilderTMFHelper.FixRelativeLinks(aContentDest, masterLocale, childLocale, IhSiteBuilderTMFHelper.GetSitePath(masterLocale).AssetPath.ToString());

                            szStatus = "RELATIONSHIP CREATED, SourceID= " + nSourceId.ToString() + " DestID= " + nDestinationId.ToString();
                        }
                        else
                            szStatus = "SKIPPED, SourceID= " + nSourceId.ToString() + " DestID= " + nDestinationId.ToString();
                    }
                    else
                        szStatus = "RELATIONSHIP ALREADY EXISTS, SourceID= " + nSourceId.ToString() + " DestID= " + nDestinationId.ToString() + " Relationship ID= " + nRelationshipId.ToString();

                    szStatus = szDestStatus + szStatus;
                    siteLog.Add(szStatus);
                }
            }
        }
 public async Task <DataPage <AccountV1> > GetAccountsAsync(string correlationId, FilterParams filter, PagingParams paging)
 {
     return(await CallCommandAsync <DataPage <AccountV1> >(
                "get_accounts",
                correlationId,
                new
     {
         filter = filter,
         paging = paging
     }
                ));
 }
        public async Task <ActionResult <PagedResponse <GroupResponseDto> > > GetGroups([FromQuery] FilterParams filterParams, [FromQuery] PaginationParams paginationParams)
        {
            PagedResponse <GroupResponseDto> pagedResponse = await GroupApplication.GetAllGroups(filterParams, paginationParams);

            return(Ok(pagedResponse));
        }
Ejemplo n.º 25
0
		private static bool TestFilterMatch(FilterParams filterParams, string line, ILogLineColumnizerCallback columnizerCallback)
		{
			string lowerSearchText;
			string searchText;
			Regex rex;
			if (filterParams.isInRange)
			{
				lowerSearchText = filterParams.lowerRangeSearchText;
				searchText = filterParams.rangeSearchText;
				rex = filterParams.rangeRex;
			}
			else
			{
				lowerSearchText = filterParams.lowerSearchText;
				searchText = filterParams.searchText;
				rex = filterParams.rex;
			}

			if (searchText == null || lowerSearchText == null || searchText.Length == 0)
			{
				return false;
			}

			if (filterParams.columnRestrict)
			{
				string[] columns = filterParams.currentColumnizer.SplitLine(columnizerCallback, line);
				bool found = false;
				foreach (int colIndex in filterParams.columnList)
				{
					if (colIndex < columns.Length) // just to be sure, maybe the columnizer has changed anyhow
					{
						if (columns[colIndex].Trim().Length == 0)
						{
							if (filterParams.emptyColumnUsePrev)
							{
								string prevValue = (string)filterParams.lastNonEmptyCols[colIndex];
								if (prevValue != null)
								{
									if (TestMatchSub(filterParams, prevValue, lowerSearchText, searchText, rex, filterParams.exactColumnMatch))
									{
										found = true;
									}
								}
							}
							else if (filterParams.emptyColumnHit)
							{
								return true;
							}
						}
						else
						{
							filterParams.lastNonEmptyCols[colIndex] = columns[colIndex];
							if (TestMatchSub(filterParams, columns[colIndex], lowerSearchText, searchText, rex, filterParams.exactColumnMatch))
							{
								found = true;
							}
						}
					}
				}
				return found;
			}
			else
			{
				return TestMatchSub(filterParams, line, lowerSearchText, searchText, rex, false);
			}
		}
Ejemplo n.º 26
0
 /* Required AnnouncementSortModel */
 public ActionResult SortedByParamList(FilterParams filterParams)
 {
     filterParams.IsEnabledFilter = true;
     filterParams.CurrentPage     = 1;
     return(List(filterParams));
 }
Ejemplo n.º 27
0
        public IEnumerable <SubjectWithSelectedCountriesData> GetData([FromBody] FilterParams filters)
        {
            var result       = new List <SubjectWithSelectedCountriesData>();
            var subjectCodes = filters.subjectCodes;

            subjectCodes.ForEach(code =>
            {
                var subjectData = applicationContext.Subjects.Find(code);

                var data = applicationContext.AllData
                           .Where(data => data.SubjectCode.Equals(code) && filters.countryCodes.Contains(data.CountryCode))
                           .Select(data => new AllDataWithCountryName
                {
                    CountryName = data.CountryCodeNavigation.CountryName,
                    _1980       = data._1980,
                    _1981       = data._1981,
                    _1982       = data._1982,
                    _1983       = data._1983,
                    _1984       = data._1984,
                    _1985       = data._1985,
                    _1986       = data._1986,
                    _1987       = data._1987,
                    _1988       = data._1988,
                    _1989       = data._1989,
                    _1990       = data._1990,
                    _1991       = data._1991,
                    _1992       = data._1992,
                    _1993       = data._1993,
                    _1994       = data._1994,
                    _1995       = data._1995,
                    _1996       = data._1996,
                    _1997       = data._1997,
                    _1998       = data._1998,
                    _1999       = data._1999,
                    _2000       = data._2000,
                    _2001       = data._2001,
                    _2002       = data._2002,
                    _2003       = data._2003,
                    _2004       = data._2004,
                    _2005       = data._2005,
                    _2006       = data._2006,
                    _2007       = data._2007,
                    _2008       = data._2008,
                    _2009       = data._2009,
                    _2010       = data._2010,
                    _2011       = data._2011,
                    _2012       = data._2012,
                    _2013       = data._2013,
                    _2014       = data._2014,
                    _2015       = data._2015,
                    _2016       = data._2016,
                    _2017       = data._2017,
                    _2018       = data._2018,
                    _2019       = data._2019,
                    _2020       = data._2020,
                    _2021       = data._2021,
                    _2022       = data._2022,
                    _2023       = data._2023,
                    _2024       = data._2024,
                }).ToList();

                result.Add(new SubjectWithSelectedCountriesData
                {
                    Data        = data,
                    Code        = subjectData.Code,
                    Description = subjectData.Description,
                    Units       = subjectData.Units,
                    Scale       = subjectData.Scale,
                    Notes       = subjectData.Notes
                });
            });
            return(result);
        }
Ejemplo n.º 28
0
        protected override Bitmap ProcessImage(Bitmap image, FilterParams param, CancellationToken ct)
        {
            var gaussParams = (GaussianBlurParams)param;

            var(outputImage, outBitmapData) = CreateImage(image, ImageLockMode.WriteOnly);
            var(inputImage, inBitmapData)   = CreateImage(image, ImageLockMode.ReadOnly);
            var channels = GetBitsPerPixel(inBitmapData.PixelFormat) / 8;

            var kernel       = gaussParams.Kernel;
            var kernelRadius = gaussParams.Kernel.Length / 2;
            var kernelSum    = gaussParams.Kernel.Sum(x => x.Sum());

            unsafe
            {
                var inScan0  = (byte *)inBitmapData.Scan0.ToPointer();
                var outScan0 = (byte *)outBitmapData.Scan0.ToPointer();

                //for every pixel
                Parallel.For(0, inBitmapData.Height, i =>
                {
                    for (var j = 0; j < inBitmapData.Width; ++j)
                    {
                        ct.ThrowIfCancellationRequested();

                        var currPixel = GetPixelPointer(outScan0, i, j, outBitmapData.Stride, channels);

                        //for every channel
                        for (var c = 0; c < 3; c++)
                        {
                            var pixelSum = 0f;

                            //for every element in kernel
                            for (var ki = -kernelRadius; ki <= kernelRadius; ki++)
                            {
                                for (var kj = -kernelRadius; kj <= kernelRadius; kj++)
                                {
                                    var ii = i + ki;
                                    var jj = j + kj;
                                    byte *kernelPixel;
                                    //if pixel outside image then repeat using center pixel
                                    if (ii < 0 || ii >= inBitmapData.Height || jj < 0 || jj >= inBitmapData.Width)
                                    {
                                        kernelPixel = currPixel;
                                    }
                                    else
                                    {
                                        kernelPixel = GetPixelPointer(inScan0, ii, jj, inBitmapData.Stride, channels);
                                    }

                                    var k     = kernel[ki + kernelRadius][kj + kernelRadius];
                                    pixelSum += kernelPixel[c] * k;
                                }
                            }

                            //todo: if kernelsum is 0 then normalize
                            if (kernelSum == 0)
                            {
                                kernelSum = 1;                 //if kernel == 0 (for eg. edge detection)
                            }
                            currPixel[c] = GetByteValue(pixelSum / kernelSum);
                        }
                    }
                });

                outputImage.UnlockBits(outBitmapData);
                inputImage.UnlockBits(inBitmapData);

                return(outputImage);
            }
        }
Ejemplo n.º 29
0
        public override IEnumerable <LogItem> GetEntries(string dataSource, FilterParams filter)
        {
            IEnumerable <LogItem> enumerable = this.InternalGetEntries(dataSource, filter);

            return(enumerable.ToArray()); // avoid file locks
        }
Ejemplo n.º 30
0
        internal Delete CreateDeleteMessage(string schema, string collection, bool isRelational, FilterParams filter)
        {
            var msg = new Delete();

            msg.DataModel              = (isRelational ? DataModel.Table : DataModel.Document);
            msg.Collection             = ExprUtil.BuildCollection(schema, collection);
            ApplyFilter(v => msg.Limit = v, v => msg.Criteria = v, msg.Order.Add, filter, msg.Args.Add);

            return(msg);
        }
Ejemplo n.º 31
0
        private IEnumerable <LogItem> InternalGetEntries(string dataSource, FilterParams filter)
        {
            using (IDbConnection connection = this.CreateConnection(dataSource))
            {
                connection.Open();
                using (IDbTransaction transaction = connection.BeginTransaction())
                {
                    using (IDbCommand command = connection.CreateCommand())
                    {
                        command.CommandText =
                            @"select caller, date, level, logger, thread, message, exception from log where date >= @date";

                        IDbDataParameter parameter = command.CreateParameter();
                        parameter.ParameterName = "@date";
                        parameter.Value         = filter.Date.HasValue ? filter.Date.Value : MinDateTime;
                        command.Parameters.Add(parameter);

                        switch (filter.Level)
                        {
                        case 1:
                            AddLevelClause(command, "ERROR");
                            break;

                        case 2:
                            AddLevelClause(command, "INFO");
                            break;

                        case 3:
                            AddLevelClause(command, "DEBUG");
                            break;

                        case 4:
                            AddLevelClause(command, "WARN");
                            break;

                        case 5:
                            AddLevelClause(command, "FATAL");
                            break;

                        default:
                            break;
                        }

                        AddLoggerClause(command, filter.Logger);
                        AddThreadClause(command, filter.Thread);
                        AddMessageClause(command, filter.Message);

                        AddOrderByClause(command);

                        using (IDataReader reader = command.ExecuteReader())
                        {
                            int index = 0;
                            while (reader.Read())
                            {
                                string   caller = reader.GetString(0);
                                string[] split  = caller.Split(',');

                                const string machineKey  = "{log4jmachinename=";
                                string       item0       = Find(split, machineKey);
                                string       machineName = GetValue(item0, machineKey);

                                const string hostKey  = " log4net:HostName=";
                                string       item1    = Find(split, hostKey);
                                string       hostName = GetValue(item1, hostKey);

                                const string userKey  = " log4net:UserName="******" log4japp=";
                                string       item3  = Find(split, appKey);
                                string       app    = GetValue(item3, appKey);

                                DateTime timeStamp = reader.GetDateTime(1);
                                string   level     = reader.GetString(2);
                                string   logger    = reader.GetString(3);
                                string   thread    = reader.GetString(4);
                                string   message   = reader.GetString(5);
                                string   exception = reader.GetString(6);

                                LogItem entry = new LogItem
                                {
                                    Id          = ++index,
                                    TimeStamp   = timeStamp,
                                    Level       = level,
                                    Thread      = thread,
                                    Logger      = logger,
                                    Message     = message,
                                    Throwable   = exception,
                                    MachineName = machineName,
                                    HostName    = hostName,
                                    UserName    = userName,
                                    App         = app,
                                };
                                // TODO: altri filtri
                                yield return(entry);
                            }
                        }
                    }
                    transaction.Commit();
                }
            }
        }
Ejemplo n.º 32
0
        internal Update CreateUpdateMessage(string schema, string collection, bool isRelational, FilterParams filter, List <UpdateSpec> updates)
        {
            var msg = new Update();

            msg.DataModel              = (isRelational ? DataModel.Table : DataModel.Document);
            msg.Collection             = ExprUtil.BuildCollection(schema, collection);
            ApplyFilter(v => msg.Limit = v, v => msg.Criteria = v, msg.Order.Add, filter, msg.Args.Add);

            foreach (var update in updates)
            {
                var updateBuilder = new UpdateOperation();
                updateBuilder.Operation = update.Type;
                updateBuilder.Source    = update.GetSource(isRelational);
                if (update.Type != UpdateOperation.Types.UpdateType.ItemRemove ||
                    (update.Type == UpdateOperation.Types.UpdateType.ItemRemove && update.HasValue))
                {
                    //updateBuilder.Value = update.GetValue(update.Type == UpdateOperation.Types.UpdateType.MergePatch ? true : false);
                    updateBuilder.Value = update.GetValue(update.Type);
                }
                msg.Operation.Add(updateBuilder);
            }

            return(msg);
        }
Ejemplo n.º 33
0
 private void SetSelectedFilterConfiguration(FilterParams filterParams)
 {
     SelectedExpression = filterParams != null ? filterParams.Conditions.Root : null;
 }
Ejemplo n.º 34
0
        internal Find CreateFindMessage(string schema, string collection, bool isRelational, FilterParams filter, FindParams findParams)
        {
            var builder = new Find();

            builder.Collection = ExprUtil.BuildCollection(schema, collection);
            builder.DataModel  = (isRelational ? DataModel.Table : DataModel.Document);
            if (findParams.GroupBy != null && findParams.GroupBy.Length > 0)
            {
                builder.Grouping.AddRange(new ExprParser(ExprUtil.JoinString(findParams.GroupBy)).ParseExprList());
            }
            if (findParams.GroupByCritieria != null)
            {
                builder.GroupingCriteria = new ExprParser(findParams.GroupByCritieria).Parse();
            }
            if (findParams.Locking != 0)
            {
                builder.Locking = (Find.Types.RowLock)findParams.Locking;
            }
            if (findParams.LockingOption != 0)
            {
                builder.LockingOptions = (Find.Types.RowLockOptions)findParams.LockingOption;
            }
            if (findParams.Projection != null && findParams.Projection.Length > 0)
            {
                var parser = new ExprParser(ExprUtil.JoinString(findParams.Projection));
                builder.Projection.Add(builder.DataModel == DataModel.Document ?
                                       parser.ParseDocumentProjection() :
                                       parser.ParseTableSelectProjection());

                if (parser.tokenPos < parser.tokens.Count)
                {
                    throw new ArgumentException(string.Format("Expression has unexpected token '{0}' at position {1}.", parser.tokens[parser.tokenPos].value, parser.tokenPos));
                }
            }
            ApplyFilter(v => builder.Limit = v, v => builder.Criteria = v, builder.Order.Add, filter, builder.Args.Add);
            return(builder);
        }
Ejemplo n.º 35
0
        public FilterConfigurator(IFilterableCollection filterableCollection, FilterablePropertyDescriptionCollection availableFilterableProperties, FilterParams selectedFilter)
        {
            DefaultStyleKey = typeof(FilterConfigurator);

            _filterableCollection    = filterableCollection;
            _beginningSelectedFilter = selectedFilter;

            Filters.Clear();
            if (_filterableCollection != null &&
                _filterableCollection.AllFilters != null)
            {
                foreach (var filterParams in filterableCollection.AllFilters)
                {
                    Filters.Add(filterParams);
                }
            }

            FilterableArguments         = availableFilterableProperties;
            SelectedFilterConfiguration = selectedFilter;

            if (selectedFilter != null)
            {
                SelectedExpression = selectedFilter.Conditions.Root;
            }

            //Set the default owner to the app main window (if possible)
            if (Application.Current != null &&
                Application.Current.MainWindow != this)
            {
                Owner = Application.Current.MainWindow;
            }
        }
Ejemplo n.º 36
0
        public void SendPrepareStatement(uint stmtId,
                                         PreparedStatementType type,
                                         string schema,
                                         string collection,
                                         bool isRelational,
                                         FilterParams filter,
                                         FindParams findParams,
                                         List <UpdateSpec> updateSpecs = null,
                                         object[] rows    = null,
                                         string[] columns = null,
                                         bool upsert      = false,
                                         string sql       = null)
        {
            var builder = new Prepare();

            builder.StmtId = stmtId;
            builder.Stmt   = new Prepare.Types.OneOfMessage();
            switch (type)
            {
            case PreparedStatementType.Find:
                builder.Stmt.Type = Prepare.Types.OneOfMessage.Types.Type.Find;
                var message = CreateFindMessage(schema, collection, isRelational, filter, findParams);
                message.Args.Clear();
                if (filter.HasLimit)
                {
                    uint positionFind = (uint)filter.Parameters.Count;
                    message.Limit     = null;
                    message.LimitExpr = new LimitExpr
                    {
                        RowCount = new Expr
                        {
                            Type     = Expr.Types.Type.Placeholder,
                            Position = positionFind++
                        },
                        Offset = new Expr
                        {
                            Type     = Expr.Types.Type.Placeholder,
                            Position = positionFind++
                        }
                    };
                }
                builder.Stmt.Find = message;
                break;

            case PreparedStatementType.Update:
                builder.Stmt.Type = Prepare.Types.OneOfMessage.Types.Type.Update;
                var updateMessage = CreateUpdateMessage(schema, collection, isRelational, filter, updateSpecs);
                updateMessage.Args.Clear();
                if (filter.HasLimit)
                {
                    uint positionUpdate = (uint)filter.Parameters.Count;
                    updateMessage.Limit     = null;
                    updateMessage.LimitExpr = new LimitExpr
                    {
                        RowCount = new Expr
                        {
                            Type     = Expr.Types.Type.Placeholder,
                            Position = positionUpdate++
                        }
                    };
                }
                builder.Stmt.Update = updateMessage;
                break;

            case PreparedStatementType.Delete:
                builder.Stmt.Type = Prepare.Types.OneOfMessage.Types.Type.Delete;
                var deleteMessage = CreateDeleteMessage(schema, collection, isRelational, filter);
                deleteMessage.Args.Clear();
                if (filter.HasLimit)
                {
                    uint positionDelete = (uint)filter.Parameters.Count;
                    deleteMessage.Limit     = null;
                    deleteMessage.LimitExpr = new LimitExpr
                    {
                        RowCount = new Expr
                        {
                            Type     = Expr.Types.Type.Placeholder,
                            Position = positionDelete++
                        }
                    };
                }
                builder.Stmt.Delete = deleteMessage;
                break;

            case PreparedStatementType.Insert:
                builder.Stmt.Type = Prepare.Types.OneOfMessage.Types.Type.Insert;
                var insertMessage = CreateInsertMessage(schema, isRelational, collection, rows, columns, upsert);
                insertMessage.Args.Clear();
                uint position = 0;
                foreach (var row in insertMessage.Row)
                {
                    foreach (var field in row.Field)
                    {
                        if (field.Type == Expr.Types.Type.Literal)
                        {
                            field.Type     = Expr.Types.Type.Placeholder;
                            field.Literal  = null;
                            field.Position = position++;
                        }
                    }
                }
                builder.Stmt.Insert = insertMessage;
                break;

            case PreparedStatementType.SqlStatement:
                builder.Stmt.Type = Prepare.Types.OneOfMessage.Types.Type.Stmt;
                var sqlMessage = CreateExecuteSQLStatement(sql, rows);
                sqlMessage.Args.Clear();
                builder.Stmt.StmtExecute = sqlMessage;
                break;
            }

            _writer.Write((int)ClientMessages.Types.Type.PreparePrepare, builder);
            ReadOk();
        }
Ejemplo n.º 37
0
 public Filter(ITester <T> tester, string filter, FilterParams filterParams) : base(filter, filterParams)
 {
     _tester = tester;
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Filters everything even subfolders from the selected folder. Key = AssetID, Value = Asset.
        /// <para>If AssetType.Unspecified is selected, it will return all folders and files.</para>
        /// </summary>
        public static List<Asset> GetFilterList(Asset _assetFolder, AssetType _assetType = AssetType.Unspecified, string _path = "", bool excludeProjectTypes = false, List<string> excludeFolders = null, IhSiteBuilderLog siteLog = null)
        {
            FilterParams fpFilter = new FilterParams();
            fpFilter.ExcludeProjectTypes = excludeProjectTypes;

            if (!_assetType.Equals(AssetType.Unspecified))
                fpFilter.Add(Comparison.Equals, _assetType);

            Dictionary<string, Asset> dtAssets = new Dictionary<string, Asset>();
            if (!string.IsNullOrWhiteSpace(_path))
            {
                if (Asset.Load(_path).IsLoaded)
                    _assetFolder = Asset.Load(_path);
            }

            List<Asset> laAssets = _assetFolder.GetFilterList(fpFilter);

            if (excludeFolders != null)
            {
                laAssets = ExcludeFolderList(laAssets, excludeFolders);
            }
            foreach (Asset asAsset in laAssets)
            {
                if (!dtAssets.Keys.Contains(asAsset.BranchId.ToString()))
                {
                    if (asAsset.Type.Equals(AssetType.Folder))
                    {
                        dtAssets.Add(asAsset.BranchId.ToString(), asAsset);
                    }
                    else if (asAsset.Type.Equals(AssetType.File))
                    {
                        if (asAsset.WorkflowStatus.Name.Equals("Live") || asAsset.WorkflowStatus.Name.Equals("Stage") || asAsset.WorkflowStatus.Name.Equals("Draft") || asAsset.WorkflowStatus.Name.Equals(""))
                        {
                            dtAssets.Add(asAsset.BranchId.ToString(), asAsset);
                        }
                    }
                }
                else
                {
                    if (asAsset.WorkflowStatus.Name.Equals("Live"))
                    {
                        dtAssets[asAsset.BranchId.ToString()] = asAsset;
                    }
                    else if (asAsset.WorkflowStatus.Name.Equals("Stage"))
                    {
                        if (!dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Live") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Stage"))
                        {
                            dtAssets[asAsset.BranchId.ToString()] = asAsset;
                        }
                    }
                    else if (asAsset.WorkflowStatus.Name.Equals("Draft"))
                    {
                        if (!dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Live") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Stage") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Draft"))
                        {
                            dtAssets[asAsset.BranchId.ToString()] = asAsset;
                        }
                    }
                }
            }
            return dtAssets.Values.ToList<Asset>();
        }
Ejemplo n.º 39
0
 public async Task <DataPage <Dummy> > GetAsync(string correlationId, FilterParams filter, PagingParams paging, SortParams sort)
 {
     return(await GetPageByFilterAsync(correlationId, ComposeFilter(filter), paging, ComposeSort(sort)));
 }
Ejemplo n.º 40
0
 public static Translate GetObject(FilterParams fp)
 {
     return GetList(fp).FirstOrDefault();
 }
Ejemplo n.º 41
0
        public override UsersList getUsersList(FilterParams filtr)
        {
            using (var db = new CMSdb(_context))
            {
                var query = db.cms_userss.AsQueryable();

                if (!string.IsNullOrEmpty(filtr.Domain))
                {
                    query = query.Where(s => s.fklinkusertosites.Any(t => t.f_site == filtr.Domain))
                            .Where(s => (s.f_group.ToLower() != "developer" && s.f_group.ToLower() != "administrator"));
                }

                if (filtr.Disabled.HasValue)
                {
                    query = query.Where(w => w.b_disabled == filtr.Disabled.Value);
                }
                if (filtr.Group != String.Empty)
                {
                    query = query.Where(w => w.f_group == filtr.Group);
                }
                foreach (string param in filtr.SearchText.Split(' '))
                {
                    if (param != String.Empty)
                    {
                        query = query.Where(w => w.c_surname.Contains(param) || w.c_name.Contains(param) || w.c_patronymic.Contains(param) || w.c_email.Contains(param));
                    }
                }

                query = query.OrderBy(o => new { o.c_surname, o.c_name });

                if (query.Any())
                {
                    int ItemCount = query.Count();

                    var List = query
                               .Skip(filtr.Size * (filtr.Page - 1))
                               .Take(filtr.Size)
                               .Select(s => new UsersModel
                    {
                        Id        = s.id,
                        Surname   = s.c_surname,
                        Name      = s.c_name,
                        EMail     = s.c_email,
                        Group     = s.f_group,
                        GroupName = s.fkusersgroup.c_title,
                        Disabled  = s.b_disabled,
                        Lvl       = s.fkusersgroup.n_level
                    });

                    UsersModel[] usersInfo = List.ToArray();

                    return(new UsersList
                    {
                        Data = usersInfo,
                        Pager = new Pager
                        {
                            page = filtr.Page,
                            size = filtr.Size,
                            items_count = ItemCount,
                            page_count = (ItemCount % filtr.Size > 0) ? (ItemCount / filtr.Size) + 1 : ItemCount / filtr.Size
                        }
                    });
                }
                return(null);
            }
        }
Ejemplo n.º 42
0
        public static void RenderInput(Asset asset, InputContext context)
        {
            //------------------------------------
            // Global
            //------------------------------------
            Dictionary<string, string> dicSiteType = new Dictionary<string, string>();
            dicSiteType.Add("Single Site", "single");
            dicSiteType.Add("Site Collection", "collection");
            dicSiteType.Add("Site Collection with TMF", "collection_tmf");

            Dictionary<string, string> dicMobile = new Dictionary<string, string>();
            dicMobile.Add("None", "no");
            dicMobile.Add("Responsive", "responsive");
            dicMobile.Add("Dual Output", "dual_output");
            dicMobile.Add("Dedicated", "dedicated");

            Dictionary<string, string> dicSelectOptions = new Dictionary<string, string>();
            dicSelectOptions.Add("Dropdown", "dropdown");
            dicSelectOptions.Add("Create New", "create_new");

            ShowAcquireParams sapModel = new ShowAcquireParams();
            sapModel.DefaultFolder = "/System/Models/";
            sapModel.ShowUpload = false;

            //Country data
            FilterParams fpCountry = new FilterParams();
            fpCountry.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Country Sites Config");
            Asset aCountryFolder = Asset.Load("/System/Translation Model Framework/Global/Country Sites Config/");
            Dictionary<string, string> dicCountries = new Dictionary<string, string>();
            if (aCountryFolder.IsLoaded)
            {
                foreach (Asset aFile in aCountryFolder.GetFilterList(fpCountry))
                {
                    if (!dicCountries.Keys.Contains(aFile.Label))
                    {
                        dicCountries.Add(aFile.Label, aFile.Label);
                    }
                }
            }

            //Language Data
            FilterParams fpLanguage = new FilterParams();
            fpLanguage.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Language");
            Asset aLanguageFolder = Asset.Load("/System/Translation Model Framework/Global/Languages Config/");
            Dictionary<string, string> dicLanguages = new Dictionary<string, string>();
            if (aLanguageFolder.IsLoaded)
            {
                foreach (Asset aFile in aLanguageFolder.GetFilterList(fpLanguage))
                {
                    if (!dicLanguages.Keys.Contains(aFile.Label))
                    {
                        dicLanguages.Add(aFile.Label, aFile.Label);
                    }
                }
            }

            //CP public sites
            Dictionary<string, string> dicCPSites = new Dictionary<string, string>();
            string szPublicSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-public/site-list.xml");
            if (szPublicSiteXML.Contains("<sites>"))
            {
                List<XmlNode> lsXml = Util.LoadXml(szPublicSiteXML, "file");
                foreach (XmlNode xNode in lsXml)
                {
                    dicCPSites.Add(xNode.Attributes["name"], xNode.Value);
                }
            }

            //CP Training
            Dictionary<string, string> dicCPTraining = new Dictionary<string, string>();
            string szTrainingXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-training/site-list.xml");
            if (szTrainingXML.Contains("<sites>"))
            {
                List<XmlNode> lsXml = Util.LoadXml(szTrainingXML, "file");
                foreach (XmlNode xNode in lsXml)
                {
                    dicCPTraining.Add(xNode.Attributes["name"], xNode.Value);
                }
            }

            //Partner Private sites
            Dictionary<string, string> dicPrivateSites = new Dictionary<string, string>();
            if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"]))
            {
                string szPrivateSiteXML = GetPageSource(asset.Raw["private_key"]);
                if (szPrivateSiteXML.Contains("<sites>"))
                {
                    List<XmlNode> lsXml = Util.LoadXml(szPrivateSiteXML, "file");
                    foreach (XmlNode xNode in lsXml)
                    {
                        dicPrivateSites.Add(xNode.Attributes["name"], xNode.Value);
                    }
                }
            }

            //------------------------------------
            // Input Form
            //------------------------------------
            Input.StartTabbedPanel("Import Setup", "Configuration");

            string szLog = GetPageSource("http://mtistage.cp-access.com/SiteBuilder/Import-Log.xml");
            if (!string.IsNullOrWhiteSpace(szLog))
            {
                Input.StartControlPanel("Log");
                Input.ShowTextBox("", "log_message", szLog, height: 20, readOnly: true);
                Input.EndControlPanel();
            }

            Input.StartDropDownContainer("Site Builder Type", "sitebuilder_type", new Dictionary<string, string> { { "Build Site", "site_build" }, { "Add Extension", "site_extension" } });

                Input.StartDropDownContainer("Technology List Options", "technology_list_option", new Dictionary<string, string>() { { "CP Public", "public" }, { "CP Training", "training" }, { "Private", "private" }, { "Local", "local" } }, "public");
                //-----------------------------------------
                // CP Public Sites
                //-----------------------------------------
                    Input.ShowDropDown("CrownPeak Technology Stacks", "cp_language_type", dicCPSites);

                Input.NextDropDownContainer();
                //-----------------------------
                // CP Training Sites
                //-----------------------------
                    Input.ShowDropDown("Training Technology Stacks", "training_language_type", dicCPTraining);

                Input.NextDropDownContainer();
                //-----------------------------
                // Partner Private Folder
                //-----------------------------
                    if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"]))
                    {
                        Input.ShowDropDown("Private Technology Stacks", "private_language_type", dicPrivateSites);
                        Input.AddHiddenField("private_language_exist", "true");
                    }
                    else
                    {
                        Input.AddHiddenField("private_language_exist", "false");
                        Input.ShowMessage("Enter private key in Configuration tab, save and refesh the form");
                        Input.ShowMessage("Ask CrownPeak support how to set up a private key");
                    }
                //-----------------------------
                // Local File
                //-----------------------------
                Input.NextDropDownContainer();
                    Input.ShowAcquireDocument("Select a File", "local_file", helpMessage: "Select a local XML file");
                Input.EndDropDownContainer();

                //-----------------------------
                // Site Structure Setting
                //-----------------------------
                Input.ShowDropDown("Project Level", "project_level", new Dictionary<string, string> { { "Root", "root" }, { "Nested", "nested" }, { "System", "system" } }, Util.MakeList("root"));

                Input.StartDropDownContainer("Collection Folder", "collection_folder_type", new Dictionary<string, string> { { "New", "new" }, { "Select", "select" } }, "new");
                Input.ShowTextBox("New Folder", "collection_new");
                Input.NextDropDownContainer();
                Input.ShowSelectFolder("Select", "collection_select");
                Input.EndDropDownContainer();

                Input.ShowTextBox("Site Root Name", "site_root_name");
                Input.ShowTextBox("Project Name", "project_name");

            //-----------------------------
            // Add Extension
            //-----------------------------
            Input.NextDropDownContainer();
                Dictionary<string, string> dicExtensionTypes = new Dictionary<string, string>();
                dicExtensionTypes.Add("TMF", "ext_tmf");
                dicExtensionTypes.Add("Blog", "ext_blog");
                dicExtensionTypes.Add("Release management", "ext_release_management");
                dicExtensionTypes.Add("Metadata Management", "ext_metadata_management");
                dicExtensionTypes.Add("Deep Clone Site", "ext_deep_clone");
                dicExtensionTypes.Add("Clone and Convert", "ext_clone_convert");

                Input.StartDropDownContainer("Extension Type", "extension_types", dicExtensionTypes);
                    Input.ShowSelectFolder("Project Folder", "tmf_project_folder", "/", helpMessage: "Skip if the site doesn't use any Project folder");
                    Input.StartControlPanel("Master Site");
                        Input.StartHorizontalWrapContainer();
                        Input.StartDropDownContainer("Country Select", "tmf_master_country_option", dicSelectOptions, "dropdown");
                        Input.ShowDropDown("Country", "tmf_master_country_select", dicCountries);
                        Input.NextDropDownContainer();
                        Input.ShowTextBox("Country Name", "new_master_country_name", width: 30, helpMessage: "United States, England, etc");
                        Input.EndDropDownContainer();

                        Input.StartDropDownContainer("Language Select", "tmf_master_language_option", dicSelectOptions, "dropdown");
                        Input.ShowDropDown("Language", "tmf_master_lang_select", dicLanguages);
                        Input.NextDropDownContainer();
                        Input.ShowTextBox("Language Name", "new_master_language_name", width: 30, helpMessage: "English, Spanish, etc");
                        Input.EndDropDownContainer();
                        Input.EndHorizontalWrapContainer();

                        Input.ShowSelectFolder("Main Site", "tmf_master_main_site", "/");
                        Input.ShowTextBox("Rename Main Site", "tmf_master_main_site_rename");
                    Input.EndControlPanel();
                    while (Input.NextPanel("tmf_locale_panel", displayName: "Locale List"))
                    {
                        Input.StartHorizontalWrapContainer();
                        Input.StartDropDownContainer("Country Select", "tmf_country_option", dicSelectOptions, "dropdown");
                        Input.ShowDropDown("Country", "tmf_country_select", dicCountries);
                        Input.NextDropDownContainer();
                        Input.ShowTextBox("Country Name", "new_country_name", width: 30, helpMessage: "United States, England, etc");
                        Input.EndDropDownContainer();

                        Input.StartDropDownContainer("Language Select", "tmf_language_option", dicSelectOptions, "dropdown");
                        Input.ShowDropDown("Language", "tmf_lang_select", dicLanguages);
                        Input.NextDropDownContainer();
                        Input.ShowTextBox("Language Name", "new_language_name", width: 30, helpMessage: "English, Spanish, etc");
                        Input.EndDropDownContainer();
                        Input.EndHorizontalWrapContainer();

                        Input.ShowTextBox("Locale Name", "locale_name", helpMessage: "US-EN, AR-ES, etc");
                    }

                Input.NextDropDownContainer();
                Input.NextDropDownContainer();
                Input.NextDropDownContainer();
                Input.NextDropDownContainer();
                Input.NextDropDownContainer();
                Input.EndDropDownContainer();

            Input.EndDropDownContainer();

            Input.StartControlPanel("Workflow");
            Dictionary<string, string> dicWorkflow = new Dictionary<string, string>();
            AssetParams apWorkflow = new AssetParams();
            apWorkflow.ExcludeProjectTypes = false;
            foreach (Asset aWorkflow in Asset.Load("/System/Workflows/").GetFileList(apWorkflow))
            {
                if (!dicWorkflow.Keys.Contains(aWorkflow.Label))
                    dicWorkflow.Add(aWorkflow.Label, aWorkflow.Label);
            }
                //Input.ShowTextBox("Workflow Name", "workflow_name", helpMessage: "Leaving blank will create assets without any workflow");
                Input.ShowDropDown("Workflow", "workflow_name", dicWorkflow);
            Input.EndControlPanel();

            Input.NextTabbedPanel();
                Input.ShowMessage("Enter private key, save and refesh the form");
                Input.ShowTextBox("Private Site Key", "private_key");
            Input.EndTabbedPanel();
        }
Ejemplo n.º 43
0
 public FilterFactory([NotNull] FilterTest testCallback, [CanBeNull] FilterParams filterParams)
 {
     _tester       = new SimpleTester(testCallback);
     _filterParams = filterParams;
 }
Ejemplo n.º 44
0
 public async Task <DataPage <object> > GetAsync(string correlationId, FilterParams filter, PagingParams paging, SortParams sort, ProjectionParams projection)
 {
     return(await GetPageByFilterAndProjectionAsync(correlationId, ComposeFilter(filter), paging, ComposeSort(sort), projection));
 }
Ejemplo n.º 45
0
        public static List<Translate> GetList(FilterParams fp)
        {
            IEnumerable<Translate> t = from o in GetAll() select o;

            if (!String.IsNullOrEmpty(fp.ObjType))
                t = t.Where(o => o.Type.ToUnsigned().ToLower().Contains(fp.ObjType.ToUnsigned().ToLower()));

            if (fp.ObjID > 0)
                t = t.Where(o => o.ModuleItemID == fp.ObjID);

            if (!String.IsNullOrEmpty(fp.ObjField))
                t = t.Where(o => o.ModuleItemField.ToUnsigned().ToLower().Contains(fp.ObjField.ToUnsigned().ToLower()));

            if (fp.LangID > 0)
                t = t.Where(o => o.LangID == fp.LangID);

            return t.ToList();
        }