Пример #1
0
        public static FilterParams GetDefaultFilter(IEnumerable <SearchPanelMetaItem> searchPanel, IObject initSource)
        {
            var filter = new FilterParams();

            foreach (var item in searchPanel)
            {
                if (item.DefaultValue != null)
                {
                    if (item.IsRange)
                    {
                        if (item.EditorType == EditorType.Date || item.EditorType == EditorType.Datetime)
                        {
                            filter.Add(item.Name, ">=", item.DefaultValue.Invoke(initSource));
                            filter.Add(item.Name, "<=", DateTime.Now.Date.AddDays(1).AddSeconds(-1));
                        }
                        else
                        {
                            filter.Add(item.Name, "<=", item.DefaultValue.Invoke(initSource));
                            filter.Add(item.Name, ">=", item.DefaultValue.Invoke(initSource));
                        }
                    }
                    else
                    {
                        string operation = item.DefaultOper;
                        if (String.IsNullOrWhiteSpace(operation))
                        {
                            operation = item.EditorType == EditorType.Text ? "like" : "=";
                        }
                        filter.Add(item.Name, operation, item.DefaultValue.Invoke(initSource));
                    }
                }
            }
            return(filter);
        }
Пример #2
0
        public ActionResult ThisWeekSearch()
        {
            var filter = new FilterParams();

            filter.Add("datEnteredDate", ">=", DateTime.Today.AddDays(-7));
            filter.Add("idfPerson", "=", false);
            Session["Filter"] = filter;
            return(RedirectToAction("ListForm"));
        }
Пример #3
0
        public static FilterParams CetTestFilters()
        {
            var ret = new FilterParams();

            ret.Add("par11", "like", "%Value%");
            ret.Add("par21", ">=", 2);
            ret.Add("par22", "<=", 5);
            return(ret);
        }
Пример #4
0
        public void CreateExcludeTemplateList()
        {
            Asset siteroot = Asset.GetSiteRoot(this.asset);
            Asset templatesRoot;

            if (string.IsNullOrEmpty(siteroot.Raw[""]))
            {
                templatesRoot = Asset.Load("/System/Templates");
            }
            else
            {
                throw new NotImplementedException();
            }

            FilterParams fp = new FilterParams();

            fp.ExcludeProjectTypes = false;
            fp.Add(Comparison.Equals, AssetType.Folder);

            var templates = templatesRoot.GetFilterList(fp);

            var entries = new Dictionary <string, string>(templates.Count);

            foreach (var tpl in templates.OrderBy(_ => _.AssetPath.ToString()))
            {
                string title = string.Format("{0} ({1})", tpl.Label, tpl.AssetPath.GetParent());
                entries.Add(title, tpl.Id.ToString());
            }

            Input.ShowSelectList("Exclude Templates", "exclude_template_list", entries, size: 10);
        }
        public new Task <UserPreferencesV1> GetOneByIdAsync(string correlationId, string userId)
        {
            var filterParams = new FilterParams();

            filterParams.Add("user_id", userId);
            return(base.GetOneRandomAsync(correlationId, ComposeFilter(filterParams)));
        }
Пример #6
0
        public ActionResult ExtendedSearchResult()
        {
            FilterParams filter = SearchPanelHelper.SearchPanelParseValues(Request.QueryString);

            filter.Add("idfPerson", "=", false);
            Session["Filter"] = filter;
            return(RedirectToAction("ListForm", new { isExtendedSearch = true }));
        }
Пример #7
0
        public ActionResult MyCasesSearch()
        {
            var filter = new FilterParams();

            filter.Add("idfPerson", "=", true);
            Session["Filter"] = filter;
            return(RedirectToAction("ListForm"));
        }
        public async Task <SettingSectionV1> GetOneByIdAsync(string correlationId, string id)
        {
            FilterParams filter = new FilterParams();

            filter.Add("id", id);

            return(await base.GetOneRandomAsync(correlationId, ComposeFilter(filter)));
        }
Пример #9
0
        private static FilterParams GetFilterForPatientsList(Patient patientInfoForSearch)
        {
            var filter = new FilterParams();

            if (patientInfoForSearch.CurrentResidenceAddress.Region != null)
            {
                filter.Add("idfsRegion", "=", patientInfoForSearch.CurrentResidenceAddress.Region.idfsRegion);
            }
            if (patientInfoForSearch.CurrentResidenceAddress.Rayon != null)
            {
                filter.Add("idfsRayon", "=", patientInfoForSearch.CurrentResidenceAddress.Rayon.idfsRayon);
            }
            if (!string.IsNullOrEmpty(patientInfoForSearch.strFirstName))
            {
                filter.Add("strFirstName", "like", String.Format("%{0}%", patientInfoForSearch.strFirstName));
            }
            if (!string.IsNullOrEmpty(patientInfoForSearch.strSecondName))
            {
                filter.Add("strSecondName", "like", String.Format("%{0}%", patientInfoForSearch.strSecondName));
            }
            if (!string.IsNullOrEmpty(patientInfoForSearch.strLastName))
            {
                filter.Add("strLastName", "like", String.Format("%{0}%", patientInfoForSearch.strLastName));
            }
            if (patientInfoForSearch.datDateofBirth.HasValue)
            {
                filter.Add("datDateofBirth", ">=", patientInfoForSearch.datDateofBirth.Value);
                filter.Add("datDateofBirth", "<", patientInfoForSearch.datDateofBirth.Value.AddDays(1));
            }
            return(filter);
        }
Пример #10
0
 static void AddExpression(FilterParams pars, string fieldName, object val)
 {
     if (val is string)
     {
         pars.Add(fieldName, "=", val);
     }
     else if (val is DateTime)
     {
         pars.Add(fieldName, ">=", ((DateTime)val).Date);
         pars.Add(fieldName, "<", ((DateTime)val).Date.AddDays(1));
     }
     else if (val is BaseReferenceItem)
     {
         long?id = ((BaseReferenceItem)val).Id;
         if (id != null && id.Value != 0)
         {
             pars.Add(fieldName, "=", id);
         }
     }
 }
        public async Task <LimitV1> GetOneByUserIdAsync(string correlationId, string userId)
        {
            var filter = new FilterParams();
            var paging = new PagingParams();

            filter.Add("user_id", userId);
            var result = await GetPageByFilterAsync(correlationId, ComposeFilter(filter), paging);

            var data = result.Data.ConvertAll <LimitV1>(x => ToPublic(x));

            return(data[0]);
        }
Пример #12
0
        public void OnPostPublish(Asset asset, PostPublishContext context)
        {
            context.RenderPublishLinks = true;

            using (var Logger = new CrownPeak.CMSAPI.CustomLibrary.UtilLogLogger("SitemapIndex.OnPostPublish", asset))
            {
                foreach (var panel in asset.GetPanels("sitemap_roots"))
                {
                    var sitemapAssetsList = new List <Asset>();

                    if (string.IsNullOrEmpty(panel["sitemap_asset"]) == false)
                    {
                        Asset sitemapAsset = Asset.Load(panel["sitemap_asset"]);
                        if (sitemapAsset.IsLoaded == true)
                        {
                            sitemapAssetsList.Add(sitemapAsset);
                        }
                    }

                    if (string.IsNullOrEmpty(panel["multi_sitemap_root_path"]) == false && string.IsNullOrEmpty(panel["multi_sitemap_template_id"]) == false)
                    {
                        try
                        {
                            FilterParams fp = new FilterParams();
                            fp.Add(AssetPropertyNames.TemplateId, Comparison.Equals, int.Parse(panel["multi_sitemap_template_id"]));

                            Asset rootfolder  = Asset.Load(panel["multi_sitemap_root_path"]);
                            var   foundAssets = rootfolder.GetFilterList(fp);

                            sitemapAssetsList.AddRange(foundAssets);
                        }
                        catch (Exception) { }
                    }

                    Logger.Info("sitemapAssetsList count is '{0}'.", sitemapAssetsList.Count);

                    foreach (var sitemapAsset in sitemapAssetsList)
                    {
                        if (sitemapAsset.IsLoaded)
                        {
                            sitemapAsset.Publish(publishDependencies: false);

                            string sitemapUrl = sitemapAsset.GetLink(addDomain: true, protocolType: ProtocolType.Https);

                            Logger.Info("Ping search engines for '{0}'.", sitemapUrl);
                            var sitemapsPinger = new CPContrib.SiteMap.SitemapsPinger(Logger);
                            sitemapsPinger.Ping(sitemapUrl);
                        }
                    }
                }
            }             //Logger.Flush();
        }
Пример #13
0
        private List <OrganizationListItem> GetOrganizationsList(string textForSearch)
        {
            var    accessor      = OrganizationListItem.Accessor.Instance(null);
            var    filter        = new FilterParams();
            string searchPattern = GetSearchPattern(textForSearch);

            filter.Add("name", "LIKE", searchPattern);
            using (var dbmanager = DbManagerFactory.Factory.Create(ModelUserContext.Instance))
            {
                List <OrganizationListItem> organizations = accessor.SelectListT(dbmanager, filter);
                return(organizations);
            }
        }
Пример #14
0
        public static FilterParams DuplicatesFilter(HttpRequestBase request)
        {
            var result = new FilterParams();

            foreach (var key in request.QueryString.AllKeys)
            {
                if (String.IsNullOrWhiteSpace(request.QueryString[key]))
                {
                    continue;
                }
                if (key == "idfsTentativeDiagnosis" && !String.IsNullOrWhiteSpace(request.QueryString["idfsFinalDiagnosis"]))
                {
                    continue;
                }
                result.Add(key, "=", request.QueryString[key]);
            }
            return(result);
        }
Пример #15
0
        public static void Add(this FilterParams filterParams, string param, string oper, object inputVal, EditorType editorType = EditorType.Text)
        {
            switch (editorType)
            {
            case EditorType.Numeric:
                {
                    decimal preValue = 0;
                    decimal.TryParse(inputVal.ToString(), out preValue);
                    inputVal = preValue;
                }
                break;

            case EditorType.Date:
            case EditorType.Datetime:
            {
                DateTime preValue = new DateTime();
                if (!DateTime.TryParse(inputVal.ToString(), out preValue))
                {
                    inputVal = null;
                }
            }
            break;

            case EditorType.Flag:
            {
                bool preValue = false;
                bool.TryParse(inputVal.ToString(), out preValue);
                inputVal = preValue;
            }
            break;

            default:
            {
                inputVal = inputVal.ToString();
            }
            break;
            }

            filterParams.Add(param, oper, inputVal);
        }
Пример #16
0
        public static Asset GetMasterPage(Asset asset, int masterTemplateId, string masterIdentifier = "_Master")
        {
            try
            {
                Asset result = null;

                Asset masterFolder = GetSiteRoot(asset, masterIdentifier);
                if (Log.IsDebugEnabled)
                {
                    Log.Debug("GetSiteRoot returns {0}", masterFolder);
                }

                if (null != masterFolder)
                {
                    FilterParams filter = new FilterParams();
                    filter.Limit = 1;
                    filter.Add(AssetPropertyNames.TemplateId, Comparison.Equals, masterTemplateId);

                    result = masterFolder.GetFilterList(filter).FirstOrDefault(x => x.WorkflowStatus.Name == asset.WorkflowStatus.Name);

                    if (null == result)
                    {
                        filter.SetFilterStatus(new string[] { "", "Draft", "Stage", "Live" });
                        result = masterFolder.GetFilterList(filter).FirstOrDefault();
                    }
                }

                if (Log.IsTraceEnabled)
                {
                    Log.Trace("getmasterpage result={0}", result);
                }
                return(result);
            }
            catch (Exception ex)
            {
                Log.Error("GetMasterPage", ex);
                throw;
            }
        }
Пример #17
0
 static void AddExpression(FilterParams pars, string fieldName, object val, OperationType oper)
 {
     if (val is string)
     {
         pars.Add(fieldName, Oper(oper), val);
     }
     else if (val is long)
     {
         pars.Add(fieldName, Oper(oper), (long)val);
     }
     else if (val is DateTime)
     {
         pars.Add(fieldName, Oper(oper), ((DateTime)val).Date);
     }
     else if (val is Reference)
     {
         long id = ((Reference)val).RecordID;
         if (id != 0)
         {
             pars.Add(fieldName, Oper(oper), id);
         }
     }
     else if (val is GisReference)
     {
         long id = ((GisReference)val).RecordID;
         if (id != 0)
         {
             pars.Add(fieldName, Oper(oper), id);
         }
     }
     else if (val is Diagnosis)
     {
         long id = ((Diagnosis)val).RecordID;
         if (id != 0)
         {
             pars.Add(fieldName, Oper(oper), id);
         }
     }
 }
Пример #18
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();
        }
Пример #19
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);
                }
            }
        }
Пример #20
0
        /// <summary>
        /// Get FilterParams by linked content
        /// </summary>
        /// <param name="linkedContent"></param>
        /// <returns></returns>
        public static FilterParams GetFilterParams(IObject obj, LinkedContent linkedContent)
        {
            var filterParams = new FilterParams();

            var notComboboxLinkedContext = linkedContent.m_LinkedItems.Where(s => s.MetaItem.Location != SearchPanelLocation.Combobox && s.MetaItem.Location != SearchPanelLocation.Toolbox);
            var comboboxLinkedContext    = linkedContent.m_LinkedItems.Where(s => s.MetaItem.Location == SearchPanelLocation.Combobox || s.MetaItem.Location == SearchPanelLocation.Toolbox);

            foreach (
                var control in
                notComboboxLinkedContext.Where(f => f.MetaItem.EditorType == EditorType.Text))
            {
                string valText = control.Controls.First().Text == null ? null : control.Controls.First().Text.Trim();
                if (!String.IsNullOrEmpty(valText))
                {
                    filterParams.Add(control.MetaItem.Name, Utils.IsEmpty(control.MetaItem.DefaultOper) ? "Like" : control.MetaItem.DefaultOper, valText);
                }
                else if (control.MetaItem.Mandatory(obj))
                {
                    throw new ValidationModelException("strSearchPanelMandatoryFields_msgId", control.MetaItem.Name, control.MetaItem.Name, null, typeof(RequiredValidator), ValidationEventType.Error, obj);
                }
            }
            foreach (
                var control in
                notComboboxLinkedContext.Where(f => f.MetaItem.EditorType == EditorType.Numeric).Where(
                    f => f.MetaItem.IsRange == false) /*.Where(d => !string.IsNullOrWhiteSpace(d.Controls.First().Text))*/)
            {
                if (!control.Controls.First().Visible)
                {
                    object val = obj.GetValue(control.MetaItem.Name);
                    if (val != null)
                    {
                        filterParams.Add(control.MetaItem.Name, Utils.IsEmpty(control.MetaItem.DefaultOper) ? "=" : control.MetaItem.DefaultOper, val, EditorType.Numeric);
                    }
                }
                if (!Utils.IsEmpty(control.Controls.First().EditValue))
                {
                    filterParams.Add(control.MetaItem.Name, Utils.IsEmpty(control.MetaItem.DefaultOper) ? "=" : control.MetaItem.DefaultOper, control.Controls.First().Text, EditorType.Numeric);
                }
            }

            foreach (
                var control in
                notComboboxLinkedContext.Where(f => f.MetaItem.EditorType == EditorType.Numeric).Where(f => f.MetaItem.IsRange))
            {
                List <BaseEdit> contr = control.Controls.ToList();
                if (!Utils.IsEmpty(contr[0].EditValue))
                {
                    filterParams.Add(control.MetaItem.Name, ">=", contr[0].Text, EditorType.Numeric);
                }
                if (!Utils.IsEmpty(contr[1].EditValue))
                {
                    filterParams.Add(control.MetaItem.Name, "<=", contr[1].Text, EditorType.Numeric);
                }
            }

            foreach (
                var control in
                notComboboxLinkedContext.Where(f => f.MetaItem.EditorType == EditorType.Date).Where(
                    f => f.MetaItem.IsRange == false).Where(d => !string.IsNullOrWhiteSpace(d.Controls.First().Text)))
            {
                if (!Utils.IsEmpty(control.Controls.First().EditValue))
                {
                    var start = control.Controls.First().EditValue as DateTime?;
                    if (start.HasValue)
                    {
                        filterParams.Add(control.MetaItem.Name,
                                         string.IsNullOrEmpty(control.MetaItem.DefaultOper) ? "=" : control.MetaItem.DefaultOper,
                                         start.Value, EditorType.Date);
                    }
                }
            }
            foreach (
                var control in
                notComboboxLinkedContext.Where(f => f.MetaItem.EditorType == EditorType.Date).Where(f => f.MetaItem.IsRange))
            {
                List <BaseEdit> contr = control.Controls.ToList();

                bool bStart = false;
                var  start  = contr[0].EditValue as DateTime?;
                if (start.HasValue)
                {
                    filterParams.Add(control.MetaItem.Name, ">=", start.Value, EditorType.Date);
                    bStart = true;
                }
                bool bEnd = false;
                var  end  = contr[1].EditValue as DateTime?;
                if (end.HasValue)
                {
                    filterParams.Add(control.MetaItem.Name, "<", end.Value.AddDays(1), EditorType.Date);
                    bEnd = true;
                }

                if (control.MetaItem.Mandatory(obj) && (!bStart || !bEnd))
                {
                    throw new ValidationModelException("strSearchPanelMandatoryFields_msgId", control.MetaItem.Name, control.MetaItem.Name, null, typeof(RequiredValidator), ValidationEventType.Error, obj);
                }
            }
            foreach (
                var control in
                notComboboxLinkedContext.Where(f => f.MetaItem.EditorType == EditorType.Lookup && !f.MetaItem.IsMultiple))
            {
                var cntrl           = (control.Controls.First() as LookUpEdit);
                var lookUpEditValue = cntrl.EditValue as IObject;
                //if (!Utils.IsEmpty(lookUpEditValue))
                if (lookUpEditValue != null)
                {
                    if ((long)lookUpEditValue.Key != 0)
                    {
                        filterParams.Add(control.MetaItem.Name, "=", lookUpEditValue.Key);
                    }
                }
                else if (!Utils.IsEmpty(cntrl.EditValue))   //This is the case of Case_Status lookup, we use custom values for it
                {
                    filterParams.Add(control.MetaItem.Name, "=", cntrl.EditValue);
                }
            }
            foreach (
                var control in
                notComboboxLinkedContext.Where(f => f.MetaItem.EditorType == EditorType.Lookup && f.MetaItem.IsMultiple))
            {
                var cntrl     = (control.Controls.First() as PopupContainerEdit);
                var container = cntrl.Properties.PopupControl;
                var list      = container.Controls[0] as CheckedListBoxControl;
                foreach (var i in list.CheckedItems)
                {
                    var o = i as IObject;
                    if (o == null)
                    {
                        continue;
                    }
                    if (0L.Equals(o.Key))
                    {
                        continue;
                    }
                    if (control.MetaItem.IsBitMask)
                    {
                        filterParams.Add(control.MetaItem.Name, "&", o.Key, true);
                    }
                    else
                    {
                        filterParams.Add(control.MetaItem.Name, "=", o.Key, true);
                    }
                }
            }


            foreach (
                var control in
                comboboxLinkedContext.Where(f => f.MetaItem.IsMultiple))
            {
                var cntrl     = (control.Controls.ToArray()[2] as PopupContainerEdit);
                var container = cntrl.Properties.PopupControl;
                var list      = container.Controls[0] as CheckedListBoxControl;
                foreach (var i in list.CheckedItems)
                {
                    var o = i as IObject;
                    if (o == null)
                    {
                        continue;
                    }
                    if (0L.Equals(o.Key))
                    {
                        continue;
                    }
                    if (control.MetaItem.IsBitMask)
                    {
                        filterParams.Add(control.MetaItem.Name, "&", o.Key, true);
                    }
                    else
                    {
                        filterParams.Add(control.MetaItem.Name, "=", o.Key, true);
                    }
                }
            }

            foreach (
                var control in
                comboboxLinkedContext.Where(f => !f.MetaItem.IsMultiple))
            {
                var    controlWithValue = control.Controls.ToArray()[2] as BaseEdit;
                var    condition        = control.MetaItem.IsRange ? ">=" : control.Controls.ToArray()[1].EditValue.ToString();
                object value            = null;

                if (controlWithValue.Controls.Count == 4) // panel with range controls
                {
                    var cnt1 = controlWithValue.Controls[1];
                    var cnt2 = controlWithValue.Controls[3];
                    if (cnt1 is DateEdit)
                    {
                        value = (cnt1 as DateEdit).EditValue;
                        if (!Utils.IsEmpty(value))
                        {
                            filterParams.Add(control.MetaItem.Name, ">=", value);
                        }
                    }
                    if (cnt2 is DateEdit)
                    {
                        value = (cnt2 as DateEdit).EditValue;
                        if (!Utils.IsEmpty(value))
                        {
                            filterParams.Add(control.MetaItem.Name, "<=", value);
                        }
                    }
                }

                if (!Utils.IsEmpty(controlWithValue.EditValue) && !String.IsNullOrWhiteSpace(condition))
                {
                    if (controlWithValue is LookUpEdit)
                    {
                        //value = (controlWithValue as LookUpEdit).EditValue;
                        var lookUpEditValue = (controlWithValue as LookUpEdit).EditValue as IObject;
                        if (lookUpEditValue != null)
                        {
                            value = lookUpEditValue.Key;
                        }
                    }
                    else if (controlWithValue is DateEdit)
                    {
                        value = (controlWithValue as DateEdit).EditValue;
                    }
                    else
                    {
                        if (control.Controls.ToArray()[1].Text != "Like")
                        {
                            value = controlWithValue.Text;
                        }
                        else
                        {
                            value = controlWithValue.Text;
                        }
                    }

                    filterParams.Add(control.MetaItem.Name, condition, value); //  as ListControl));
                }
            }
            foreach (
                var control in
                notComboboxLinkedContext.Where(f => f.MetaItem.EditorType == EditorType.Flag))
            {
                //for null values if needed
                var flag = (control.Controls.First() as CheckEdit);
                filterParams.Add(control.MetaItem.Name, "=", flag.Checked?1:0);
            }
            return(filterParams);
        }
Пример #21
0
        /*public class PersonsComparer : IEqualityComparer<Person>
         * {
         *  public bool Equals(Person x, Person y)
         *  {
         *      return x.Pin.CompareTo(y.Pin) == 0;
         *  }
         *
         *  public int GetHashCode(Person obj)
         *  {
         *      return obj.Pin.GetHashCode();
         *  }
         * }*/

        private Schema.Patient _getFromPersonIdentityServiceInternal(Schema.Patient p)
        {
            IdentityServiceClient client = null;

            //IIdentityService client = null;
            try
            {
                /*var b = new WSHttpBinding(SecurityMode.TransportWithMessageCredential);
                 * b.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
                 * b.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
                 *
                 * var factory = new ChannelFactory<IIdentityService>(b);
                 * factory.Credentials.UserName.UserName = "******";
                 * factory.Credentials.UserName.Password = "******";
                 * //factory.Credentials.Peer.PeerAuthentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.PeerTrust;
                 * //factory.Credentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.TrustedPeople, X509FindType.FindBySubjectName, "localhost");
                 *
                 * client = factory.CreateChannel(new EndpointAddress(new Uri("https://eservice.e-health.gov.az/EHealthWcf/IdentityService.svc")));
                 * ServicePointManager.ServerCertificateValidationCallback =
                 * ((sender, certificate, chain, sslPolicyErrors) =>
                 * {
                 *     return true;
                 * });
                 */

                //client = new IdentityServiceClient("BasicHttpBinding_IIdentityService", "https://eservice.e-health.gov.az/EHealthWcf/IdentityService.svc");
                client = new IdentityServiceClient();
                var encryptedUser    = Config.GetSetting("AzPinServiceUsr");  //"essiduser";
                var enryptedPassword = Config.GetSetting("AzPinServicePwd");; //"ess1dUs3R";
                var usr = Cryptor.Decrypt(encryptedUser);
                var pwd = Cryptor.Decrypt(enryptedPassword, usr);
                client.ClientCredentials.UserName.UserName = usr;
                client.ClientCredentials.UserName.Password = pwd;
                Person prs = null;
                if (p.idfsSearchMethod == 1)
                {
                    var prsList = client.GetPersonByParams(p.strFirstName, p.strLastName, p.strSecondName, p.datDateofBirth /*.HasValue ? p.datDateofBirth.Value.ToString("yyyy-MM-ddT00:00:00") : null*/);
                    if (prsList != null && prsList.Select(i => i.Pin).Distinct().Count() == 1)
                    {
                        prs = prsList[0];
                        if (prs != null)
                        {
                            try
                            {
                                prs = client.GetPersonByPin(prs.Pin);
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
                else if (p.idfsSearchMethod == 2)
                {
                    IdentityServiceDocumentType docType = IdentityServiceDocumentType.Passport;
                    switch (p.idfsDocumentType)
                    {
                    case 1:
                        docType = IdentityServiceDocumentType.Passport;
                        break;

                    case 2:
                        docType = IdentityServiceDocumentType.IDCardForAdult;
                        break;

                    case 3:
                        docType = IdentityServiceDocumentType.IDcardForChild;
                        break;

                    case 4:
                        docType = IdentityServiceDocumentType.TemporaryResidencePermit;
                        break;

                    case 5:
                        docType = IdentityServiceDocumentType.PermanentResidencePermit;
                        break;

                    case 6:
                        docType = IdentityServiceDocumentType.BirthCertificate;
                        break;
                    }
                    prs = client.GetPersonByDocumentNumber(p.strDocumentNumber, docType, docType == IdentityServiceDocumentType.BirthCertificate ? p.datDocumentDate : null);
                    if (prs != null)
                    {
                        try
                        {
                            prs = client.GetPersonByPin(prs.Pin);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
                else if (p.idfsSearchMethod == 3)
                {
                    prs = client.GetPersonByPin(p.strPersonID);
                }
                else if (p.idfsSearchMethod == 4)
                {
                    prs = new Person()
                    {
                        Pin = "0YR9DE3", Name = "İSMAYILOV", SurName = "RAMİL", FatherName = "TOFİQ OĞLU", DateOfBirth = new DateTime(1986, 1, 19), Sex = "M"
                    };
                }

                if (prs != null)
                {
                    using (DbManagerProxy manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance))
                    {
                        FilterParams filters = new FilterParams();
                        filters.Add("strPersonID", "=", prs.Pin);
                        var items = Schema.PatientListItem.Accessor.Instance(null).SelectListT(manager, filters);
                        if (items != null && items.Count == 1)
                        {
                            var proot = Schema.Patient.Accessor.Instance(null).SelectByKey(manager, items[0].idfHumanActual);
                            p = proot;
                        }
                    }

                    p.PersonIDType   = p.PersonIDTypeLookup.FirstOrDefault(i => i.idfsBaseReference != 0 && i.idfsBaseReference != (long)PersonalIDType.Unknown);
                    p.strPersonID    = prs.Pin;
                    p.strFirstName   = prs.Name;
                    p.strLastName    = prs.SurName;
                    p.strSecondName  = prs.FatherName;
                    p.datDateofBirth = prs.DateOfBirth;
                    p.Gender         = p.GenderLookup.FirstOrDefault(c => c.idfsBaseReference == (prs.Sex == "M" ? (long)GenderType.Male : (prs.Sex == "F" ? (long)GenderType.Female : 0)));
                    return(p);
                }
            }
            catch (FaultException fex)
            {
                switch (fex.Code.Name)
                {
                case "2.1":
                case "2.2":
                case "2.3":
                    return(null);

                case "0":
                case "1":
                default:
                    LogError.Log("ErrorLog_PinService_", fex, stream =>
                    {
                        stream.WriteLine(String.Format("SearchMethod = {0}, DocumentType = {1}, PersonID = '{2}', FirstName = '{3}', LastName = '{4}', SecondName = '{5}', DateofBirth = '{6}'",
                                                       p.idfsSearchMethod, p.idfsDocumentType, p.strPersonID, p.strFirstName, p.strLastName, p.strSecondName, p.datDateofBirth.HasValue ? p.datDateofBirth.Value.ToString("yyyy-MM-ddT00:00:00") : ""));
                        stream.WriteLine(String.Format("Code = {0}, Subcode = {1}, Reason = {2}",
                                                       fex.Code.Name, fex.Code.SubCode == null ? "" : fex.Code.SubCode.Name, fex.Reason.ToString()));
                    });
                    if (fex.InnerException != null)
                    {
                        LogError.Log("ErrorLog_PinService_", fex.InnerException);
                    }
                    throw;
                }
            }
            catch (Exception ex)
            {
                LogError.Log("ErrorLog_PinService_", ex, stream =>
                {
                    stream.WriteLine(String.Format("SearchMethod = {0}, DocumentType = {1}, PersonID = '{2}', FirstName = '{3}', LastName = '{4}', SecondName = '{5}', DateofBirth = '{6}'",
                                                   p.idfsSearchMethod, p.idfsDocumentType, p.strPersonID, p.strFirstName, p.strLastName, p.strSecondName, p.datDateofBirth.HasValue ? p.datDateofBirth.Value.ToString("yyyy-MM-ddT00:00:00") : ""));
                });
                if (ex.InnerException != null)
                {
                    LogError.Log("ErrorLog_PinService_", ex.InnerException);
                }
                throw;
            }
            finally
            {
                if (client != null && client.State != System.ServiceModel.CommunicationState.Closed)
                {
                    client.Close();
                }
            }
            return(null);
        }
Пример #22
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);
        }
Пример #23
0
        public string ComponentOutput(Asset asset, OutputContext context)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<?xml version='1.0' encoding='UTF-8'?>");
            sb.AppendLine(string.Format("<!-- generated {0} -->", DateTime.UtcNow.ToString("O")));
            sb.AppendLine(@"<sitemapindex xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
			xsi:schemaLocation='http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd'
			xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>"            );

            bool forceHttps = asset.Raw["sitemap_force_https"] == "true";

            foreach (var panel in asset.GetPanels("sitemap_roots"))
            {
                var sitemapAssetsList = new List <Asset>();

                if (string.IsNullOrEmpty(panel["sitemap_asset"]) == false)
                {
                    Asset sitemapAsset = Asset.Load(panel["sitemap_asset"]);
                    sitemapAssetsList.Add(sitemapAsset);
                }

                if (string.IsNullOrEmpty(panel["multi_sitemap_root_path"]) == false && string.IsNullOrEmpty(panel["multi_sitemap_template_id"]) == false)
                {
                    try
                    {
                        FilterParams fp = new FilterParams();
                        fp.Add(AssetPropertyNames.TemplateId, Comparison.Equals, int.Parse(panel["multi_sitemap_template_id"]));

                        Asset rootfolder  = Asset.Load(panel["multi_sitemap_root_path"]);
                        var   foundAssets = rootfolder.GetFilterList(fp);

                        sitemapAssetsList.AddRange(foundAssets);
                    }
                    catch (Exception) { }
                }

                Log.Info("sitemapAssetsList count is '{0}'.", sitemapAssetsList.Count);

                foreach (var sitemapAsset in sitemapAssetsList)
                {
                    if (sitemapAsset.IsLoaded)
                    {
                        //create dependency to the sitemaproot asset specified
                        asset.AddDependencyTo(sitemapAsset);

                        sb.AppendLine("<sitemap>");

                        string loc = sitemapAsset.GetLink(addDomain: true);
                        if (forceHttps)
                        {
                            loc = loc.Replace("http://", "https://");
                        }
                        sb.AppendFormat("  <loc>{0}</loc>\n", loc);

                        if (sitemapAsset.PublishDate != null)
                        {
                            //use W3C Datetime format, yyyy-MM-dd
                            sb.AppendFormat("  <lastmod>{0}</lastmod>\n", sitemapAsset.PublishDate.Value.ToString("yyyy-MM-dd"));
                        }

                        sb.AppendLine("</sitemap>");
                    }
                }
            }

            sb.AppendLine("</sitemapindex>");

            return(sb.ToString());
        }
Пример #24
0
 public static void ExcludeTemplates(FilterParams fp, IEnumerable <int> templateRefs)
 {
     fp.Add(AssetPropertyNames.TemplateId, Comparison.NotInSet, templateRefs.ToList());
 }
Пример #25
0
        private Tuple <Schema.Patient, string> _getFromPersonIdentityServiceInternal(Schema.Patient p)
        {
            var    strPinVerificationSuffix = PinVerificationSuffix;
            string pin    = p.strPersonID;
            string form   = p.Parent is Schema.HumanCase ? "H02" : "H04";
            string caseID = p.Parent is Schema.HumanCase ?
                            (p.Parent as Schema.HumanCase).strCaseID :
                            (p.Parent is Schema.ContactedCasePerson ?
                             ((p.Parent as Schema.ContactedCasePerson).Parent as Schema.HumanCase).strCaseID :
                             "");
            DateTime?dtResponse = null;
            string   resultCode = "";

            Georgia.CommonDataWebSoapClient client = new Georgia.CommonDataWebSoapClient();
            try
            {
                string codedUsername = Config.GetSetting("GgPinServiceUsr");
                string codedPassword = Config.GetSetting("GgPinServicePwd");
                string username      = Cryptor.Decrypt(codedUsername);
                string password      = Cryptor.Decrypt(codedPassword, username);

                var token = client.Login(username, password);
                if (token == null)
                {
                    throw new Exception("PIN Service unreachable");
                }

                var person = client.GetPersonInfoEx(token.Value, Guid.Empty, p.strPersonID, p.datDateofBirth.Value.Year);
                if (person == null)
                {
                    resultCode = "NO_RECORDS_FOUND";
                    return(new Tuple <Schema.Patient, string>(null, string.Format("strPinNoRecordsFound{0}", strPinVerificationSuffix)));
                }

                dtResponse = DateTime.Now;
                resultCode = "OK";

                using (DbManagerProxy manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance))
                {
                    FilterParams filters = new FilterParams();
                    filters.Add("strPersonID", "=", p.strPersonID);
                    var items = Schema.PatientListItem.Accessor.Instance(null).SelectListT(manager, filters);
                    if (items != null && items.Count == 1)
                    {
                        var proot = Schema.Patient.Accessor.Instance(null).SelectByKey(manager, items[0].idfHumanActual);
                        p = proot;
                    }
                }

                p.PersonIDType = p.PersonIDTypeLookup.FirstOrDefault(i => i.idfsBaseReference == (long)PersonalIDType.PIN_GG);
                p.strPersonID  = person.PrivateNumber;
                p.strFirstName = person.FirstName;
                p.strLastName  = person.LastName;
                p.Gender       = p.GenderLookup.FirstOrDefault(c => c.idfsBaseReference == (person.GenderID.Equals(PersonGendersEnum.Male) ? (long)GenderType.Male : (person.GenderID.Equals(PersonGendersEnum.Female) ? (long)GenderType.Female : 0)));

                p.bPINMode = true;
                DateTime xx;
                if ((person.BirthDate != null) && (DateTime.TryParseExact(person.BirthDate.ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out xx)))
                {
                    p.datDateofBirth = xx; //person.BirthDate;
                }

                return(new Tuple <Schema.Patient, string>(p, null));
            }
            catch (Exception ex)
            {
                LogError.Log("ErrorLog_PinService_", ex, stream =>
                {
                    stream.WriteLine(String.Format("PIN = {0}, Form = {1}, CaseID = {2}, UserID = {3}, UserName = {4}, UserOrganization = {5}, EIDSSDateTime = {6}, PINServiceDateTime = {7}, Result = {8}",
                                                   pin, form, caseID,
                                                   EidssUserContext.Instance.CurrentUser.LoginName,
                                                   EidssUserContext.Instance.CurrentUser.FullName,
                                                   EidssUserContext.Instance.CurrentUser.OrganizationEng,
                                                   DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"),
                                                   dtResponse.HasValue ? dtResponse.Value.ToString("yyyy-MM-ddTHH:mm:ss") : "",
                                                   resultCode
                                                   ));
                });
                resultCode = "Exception:" + ex.Message;
                throw;
            }
            finally
            {
                if (client != null && client.State != System.ServiceModel.CommunicationState.Closed)
                {
                    client.Close();
                }

                LogError.Log("Log_PinService_", null, stream =>
                {
                    stream.WriteLine(String.Format("PIN = {0}, form = {1}, CaseID = {2}, UserID = {3}, UserName = {4}, UserOrganization = {5}, EIDSSDateTime = {6}, PINServiceDateTime = {7}, Result = {8}",
                                                   pin, form, caseID,
                                                   EidssUserContext.Instance.CurrentUser.LoginName,
                                                   EidssUserContext.Instance.CurrentUser.FullName,
                                                   EidssUserContext.Instance.CurrentUser.OrganizationEng,
                                                   DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"),
                                                   dtResponse.HasValue ? dtResponse.Value.ToString("yyyy-MM-ddTHH:mm:ss") : "",
                                                   resultCode
                                                   ));
                }, "{0}{3}.txt");
            }
        }
Пример #26
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>();
        }
Пример #27
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();
        }
Пример #28
0
        private static FilterParams GetFilterForFarmsList(FarmPanel farmInfoForSearch)
        {
            var filter = new FilterParams();

            if (!string.IsNullOrEmpty(farmInfoForSearch.strContactPhone))
            {
                filter.Add("strContactPhone", "like", String.Format("%{0}%", farmInfoForSearch.strContactPhone));
            }
            if (farmInfoForSearch.idfsOwnershipStructure.HasValue)
            {
                filter.Add("idfsOwnershipStructure", "=", farmInfoForSearch.idfsOwnershipStructure);
            }
            if (farmInfoForSearch.idfsLivestockProductionType.HasValue)
            {
                filter.Add("idfsLivestockProductionType", "=", farmInfoForSearch.idfsLivestockProductionType);
            }
            if (farmInfoForSearch.Address.idfsCountry.HasValue)
            {
                filter.Add("idfsCountry", "=", farmInfoForSearch.Address.idfsCountry);
            }
            if (farmInfoForSearch.Address.idfsRegion.HasValue)
            {
                filter.Add("idfsRegion", "=", farmInfoForSearch.Address.idfsRegion);
            }
            if (farmInfoForSearch.Address.idfsRayon.HasValue)
            {
                filter.Add("idfsRayon", "=", farmInfoForSearch.Address.idfsRayon);
            }
            if (farmInfoForSearch.Address.idfsSettlement.HasValue)
            {
                filter.Add("idfsSettlement", "=", farmInfoForSearch.Address.idfsSettlement);
            }
            if (farmInfoForSearch.Address.idfsSettlement.HasValue)
            {
                filter.Add("idfsSettlement", "=", farmInfoForSearch.Address.idfsSettlement);
            }
            if (!string.IsNullOrEmpty(farmInfoForSearch.strOwnerFirstName))
            {
                filter.Add("strFirstName", "like", String.Format("%{0}%", farmInfoForSearch.strOwnerFirstName));
            }
            if (!string.IsNullOrEmpty(farmInfoForSearch.strOwnerMiddleName))
            {
                filter.Add("strSecondName", "like", String.Format("%{0}%", farmInfoForSearch.strOwnerMiddleName));
            }
            if (!string.IsNullOrEmpty(farmInfoForSearch.strOwnerLastName))
            {
                filter.Add("strLastName", "like", String.Format("%{0}%", farmInfoForSearch.strOwnerLastName));
            }
            if (!string.IsNullOrEmpty(farmInfoForSearch.strNationalName))
            {
                filter.Add("strNationalName", "like", String.Format("%{0}%", farmInfoForSearch.strNationalName));
            }
            return(filter);
        }
Пример #29
0
        public static FilterParams SearchPanelParseValues(NameValueCollection collection)
        {
            var result = new FilterParams();

            string[] helpers;
            string[] ignoredKeys = new string[collection.AllKeys.Length];
            int      counter     = 0;

            foreach (string key in collection.AllKeys)
            {
                if (String.IsNullOrWhiteSpace(collection[key]) || ignoredKeys.Contains(key) || key.ToLowerInvariant().EndsWith("input") || key.ToLowerInvariant().EndsWith("-text"))
                {
                    continue;
                }

                helpers = key.Split('.');

                if (helpers.Length <= 1)
                {
                    continue;
                }

                if (helpers[0].ToLowerInvariant() == "lookup" && collection[key] == "0")
                {
                    continue;
                }

                if (helpers[1].ToLowerInvariant() == "operand")
                {
                    continue;
                }

                //helpers is an array of strings helping to define param

                if (helpers.Length >= 3)                                                        //it means the item is interval or from combobox
                {
                    if (helpers[0].Equals("CBox", StringComparison.InvariantCultureIgnoreCase)) //value from combobox
                    {
                        // find all parts, include all to ignored keys
                        result.Add(
                            collection[String.Format(CBOX_PARAMETER_PATTERN, "Item", helpers[2])],
                            collection[String.Format(CBOX_PARAMETER_PATTERN, "Operand", helpers[2])],
                            collection[String.Format(CBOX_PARAMETER_PATTERN, "Value", helpers[2])]
                            );
                        ignoredKeys[counter++] = String.Format(CBOX_PARAMETER_PATTERN, "Item", helpers[2]);
                        ignoredKeys[counter++] = String.Format(CBOX_PARAMETER_PATTERN, "Operand", helpers[2]);
                        ignoredKeys[counter++] = String.Format(CBOX_PARAMETER_PATTERN, "Value", helpers[2]);
                    }
                    else //interval values
                    {
                        if (helpers[2].Contains("_Day"))
                        {
                            DateTime?date = DateTimeHelper.GetDateForFilterByKey(collection, key.Replace("_Day", ""));
                            if (date.HasValue)
                            {
                                result.Add(helpers[2].Replace("_Day", ""), (helpers[1].ToLowerInvariant() == "from") ? ">=" : "<=", date);
                            }
                        }
                        else if (!helpers[2].Contains("_Month") && !helpers[2].Contains("_Year"))
                        {
                            result.Add(
                                helpers[2],
                                (helpers[1].ToLowerInvariant() == "from") ? ">=" : "<=",
                                GetTypedValue(helpers[0], collection[key])
                                );
                        }
                        ignoredKeys[counter++] = key;
                    }
                }
                else
                {
                    if (helpers[0].ToLowerInvariant() == "string")
                    {
                        result.Add(helpers[1], "LIKE", String.Format("%{0}%", collection[key]));
                    }
                    else
                    {
                        if (helpers[0].ToLowerInvariant() == "flag")
                        {
                            if (Convert.ToBoolean(collection[key].Split(',')[0]))
                            {
                                result.Add(helpers[1], null, null);
                            }
                        }
                        else
                        {
                            result.Add(helpers[1], "=", GetTypedValue(helpers[0], collection[key]));
                        }
                        ignoredKeys[counter++] = key;
                    }
                }
            }
            return(result);
        }