public static void PurgeDataBaseInfo(int portalId, int moduleId, DataCtrlInterface objCtrl, string entityTypeCode, int purgeDays = -7) { var l = objCtrl.GetList(portalId, moduleId, entityTypeCode); foreach (NBrightInfo obj in l) { if (obj.ModifiedDate < (DateTime.Now.AddDays(purgeDays))) { objCtrl.Delete(obj.ItemID); } } }
public UserDataInfo(int portalId, int moduleId, DataCtrlInterface objCtrl, string ctrlTypeCode) { _objCtrl = objCtrl; PortalId = portalId; ModuleId = moduleId; SearchPortalId = portalId; SearchModuleId = 0; // don't auto link search moduledid to module. (This is done in the "EventBeforeBindListData" event) CtrlTypeCode = ctrlTypeCode; UserDataKey = Cookie.GetCookieValue(portalId, "UserDataInfo", "UserDataKey", moduleId.ToString("")); if (UserDataKey != "") { var strFilter = " and guidkey = '" + UserDataKey + "' "; var l = objCtrl.GetList(portalId, moduleId, "USERDATAINFO", strFilter, "", 1); if (l.Count >= 1) { _obj = l[0]; } if (_obj == null) { CreateNewUserDataInfoRecord(); } } else { CreateNewUserDataInfoRecord(); } if (_obj == null) { return; } ItemId = _obj.ItemID; GUIDKey = _obj.GUIDKey; var s = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/tabid"); if (Utils.IsNumeric(s)) { TabId = Convert.ToInt32(s); } else { TabId = -1; } SkinSrc = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/skinsrc"); EntityTypeCode = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/entitytypecode"); EntityTypeCodeLang = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/entitytypecodelang"); RtnSelUrl = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/rtnselurl"); RtnUrl = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/rtnurl"); FromItemId = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/fromitemid"); SelItemId = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/selitemid"); SelType = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/seltype"); SortItemId = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/current/sortitemid"); if (CtrlTypeCode != null) { SearchClearAfter = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchclearafter"); SearchExtra1 = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchextra1"); SearchExtra2 = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchextra2"); SearchFilters = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchfilters"); SearchOrderby = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchorderby"); SearchPageNumber = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchpagenumber"); SearchReturnLimit = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchreturnlimit"); SearchDate1 = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchsearchdate1"); SearchDate2 = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchsearchdate2"); var strSearchPortalId = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchportalid"); if (Utils.IsNumeric(strSearchPortalId) && (Convert.ToInt32(strSearchPortalId) > 0)) { SearchPortalId = Convert.ToInt32(strSearchPortalId); } var strSearchModuleId = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchmoduleid"); if (Utils.IsNumeric(strSearchModuleId) && (Convert.ToInt32(strSearchModuleId) > 0 | Convert.ToInt32(strSearchModuleId) == -1)) { SearchModuleId = Convert.ToInt32(strSearchModuleId); } var xmlNod = GenXmlFunctions.GetGenXmLnode(_obj.XMLData, "root/" + CtrlTypeCode.ToLower() + "/searchgenxml"); if (xmlNod != null) { SearchGenXml = xmlNod.InnerXml; } else { SearchGenXml = ""; } } var d = new XmlDocument(); s = GenXmlFunctions.GetGenXmlValue(_obj.XMLData, "root/extraxml"); if (s != "") { d.LoadXml(s); } ExtraXml = d; }