Example #1
0
        private void CbListDataBinding(object sender, EventArgs e)
        {
            var chk       = (CheckBoxList)sender;
            var container = (IDataItemContainer)chk.NamingContainer;

            try
            {
                chk.Visible = visibleStatus.DefaultIfEmpty(true).First();
                var xmlNod      = GenXmlFunctions.GetGenXmLnode(chk.ID, "checkboxlist", (string)DataBinder.Eval(container.DataItem, _databindColumn));
                var xmlNodeList = xmlNod.SelectNodes("./chk");
                if (xmlNodeList != null)
                {
                    foreach (XmlNode xmlNoda in xmlNodeList)
                    {
                        if (xmlNoda.Attributes != null)
                        {
                            if (xmlNoda.Attributes.GetNamedItem("data") != null)
                            {
                                var datavalue = xmlNoda.Attributes["data"].Value;
                                //use the data attribute if there
                                if ((chk.Items.FindByValue(datavalue).Value != null))
                                {
                                    chk.Items.FindByValue(datavalue).Selected = Convert.ToBoolean(xmlNoda.Attributes["value"].Value);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                //do nothing
            }
        }
Example #2
0
        private String BuildCategorySearch(String search, NBrightInfo searchData, String selectoperator)
        {
            var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier;
            var dbOwner = DotNetNuke.Data.DataProvider.Instance().DatabaseOwner;

            // get list of selected categories.
            var catlist = new List<string>();
            var xmlNod = GenXmlFunctions.GetGenXmLnode(searchData.XMLData, search);
            if (xmlNod != null)
            {
                var xmlNodeList = xmlNod.SelectNodes("./chk");
                if (xmlNodeList != null)
                {
                    if (xmlNodeList.Count == 0)
                    {//dropdown list
                        catlist.Add(xmlNod.InnerText);
                    }
                    else
                    {// checkbox list
                        foreach (XmlNode xmlNoda in xmlNodeList)
                        {
                            if (xmlNoda.Attributes != null && xmlNoda.Attributes["value"] != null && xmlNoda.Attributes["data"] != null)
                            {
                                if (xmlNoda.Attributes["value"].Value.ToLower() == "true")
                                {
                                    catlist.Add(xmlNoda.Attributes["data"].Value);
                                }
                            }
                        }
                    }
                }
            }
            //build SQL
            var strRtn = "";
            if (catlist.Count > 0)
            {
                var categorylist = "";
                for (int i = 0; i < catlist.Count; i++)
                {
                    categorylist += catlist[i] + ",";
                }
                categorylist = categorylist.TrimEnd(',');

                if (selectoperator.ToLower() == "and")
                {
                    strRtn += " (select count(parentitemid) from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and parentitemid = NB1.[ItemId] and XrefItemId in (" + categorylist + ")) = " + catlist.Count + " ";
                }
                else
                {
                    if (selectoperator.ToLower() == "cascade")
                    {
                        strRtn += "NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId in (" + categorylist + ")) ";
                    }
                    else
                    {
                        strRtn += "NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId in (" + categorylist + ")) ";
                    }
                }
            }
            else
            {
                // no categories selected, so add sql to stop display 
                strRtn += "NB1.[ItemId] = -1";
            }

            return strRtn;
        }
Example #3
0
        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;
        }