private static String GetAddressList(HttpContext context) { var addressData = new AddressData(); var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context); var themeFolder = ajaxInfo.GetXmlProperty("genxml/hidden/themefolder"); var razortemplate = ajaxInfo.GetXmlProperty("genxml/hidden/razortemplate"); var passSettings = ajaxInfo.ToDictionary(); foreach (var s in StoreSettings.Current.Settings()) // copy store setting, otherwise we get a byRef assignement { if (passSettings.ContainsKey(s.Key)) { passSettings[s.Key] = s.Value; } else { passSettings.Add(s.Key, s.Value); } } var l = addressData.GetAddressList(); var strOut = NBrightBuyUtils.RazorTemplRenderList(razortemplate, 0, "", l, "/DesktopModules/NBright/NBrightBuy", themeFolder, Utils.GetCurrentCulture(), passSettings); return(strOut); }
private void PageLoad() { #region "Data Repeater" if (_templD.Trim() != "") // if we don;t have a template, don't do anything { var l = _addressData.GetAddressList(); rpData.DataSource = l; rpData.DataBind(); } #endregion base.DoDetail(rpDataH); base.DoDetail(rpDataF); var addrid = Utils.RequestParam(Context, "addressid"); if (Utils.IsNumeric(addrid)) { var objAddr = _addressData.GetAddress(Convert.ToInt32(addrid)); if (objAddr == null) { objAddr = new NBrightInfo(true); //assume new address } base.DoDetail(rpAddr, objAddr); } else { base.DoDetail(rpAddr); } }
public IEncodedString AddressSelectList(NBrightInfo info, String xpath, String formselector, String datafields, String attributes = "", Boolean allowEmpty = true) { var usr = UserController.Instance.GetCurrentUserInfo(); var addressData = new AddressData(usr.UserID.ToString("")); var rtnList = addressData.GetAddressList(); if (attributes.StartsWith("ResourceKey:")) { attributes = ResourceKey(attributes.Replace("ResourceKey:", "")).ToString(); } var fieldList = datafields.Split(','); var strOut = ""; var upd = getUpdateAttr(xpath, attributes); var id = getIdFromXpath(xpath); strOut = "<select id='" + id + "' " + upd + " " + attributes + " formselector='" + formselector + "' >"; var s = ""; if (allowEmpty) { strOut += " <option value=''></option>"; } foreach (var tItem in rtnList) { var fields = tItem.ToDictionary(); var datavalues = ""; foreach (var xp in fieldList) { if (xp != "" && fields.ContainsKey(xp)) { datavalues += "," + fields[xp].Replace(",", " "); } else { datavalues += ","; } } var itemtext = tItem.GetXmlProperty("genxml/textbox/firstname") + "," + tItem.GetXmlProperty("genxml/textbox/lastname") + "," + tItem.GetXmlProperty("genxml/textbox/unit") + "," + tItem.GetXmlProperty("genxml/textbox/street") + "," + tItem.GetXmlProperty("genxml/textbox/city"); var idx = tItem.GetXmlProperty("genxml/hidden/index"); if (idx != "") { if (info.GetXmlProperty(xpath) == idx) { s = "selected"; } else { s = ""; } strOut += " <option value='" + idx + "' " + s + " datafields = '" + datafields + "' datavalues = '" + datavalues.TrimStart(',') + "' > " + itemtext.TrimStart(',') + "</option>"; } } strOut += "</select>"; return(new RawString(strOut)); }