public void MapWithoutIdShouldUseDefaultMapping() { const int CategoryId = 1; const string CategoryName = "Category1"; const string CategoryDescription = "Description Category1"; DocumentMapperConfig.NewConfig <Category>() .WithAttribute(c => c.Name) .WithAttribute(c => c.Description); var category = new Category { Id = CategoryId, Name = CategoryName, Description = CategoryDescription }; var document = category.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); }
public void MapWithDefaultsChangingTypeName() { const int CategoryId = 1; const string CategoryName = "Category1"; const string CategoryDescription = "Description Category1"; const string CategoryType = "CategoryModel"; DocumentMapperConfig.NewConfig <Category>() .WithTypeName(CategoryType) .MapWithDetaults(); var category = new Category { Id = CategoryId, Name = CategoryName, Description = CategoryDescription }; var document = category.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); resource.Type.Should().Be(CategoryType); resource.Attributes.Should().ContainKey(nameof(Category.Name)); resource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); resource.Attributes.Should().ContainKey(nameof(Category.Description)); resource.Attributes[nameof(Category.Description)].Should().Be(CategoryDescription); }
public void WhenIProcessTheFile() { ImageMemoryStream.Seek(0, SeekOrigin.Begin); const string classifierConfigFile = "svm_config.xml"; //Arrange var handler = new ImageRatingHandler { Parameters = new WorkItemBase.WorkItemParameters { RuntimeData = new Dictionary <string, string> { { "ExhibitId", ExhibitId.ToString(CultureInfo.InvariantCulture) }, { "FileId", FileId.ToString(CultureInfo.InvariantCulture) }, { "FileCategoryId", CategoryId.ToString(CultureInfo.InvariantCulture) }, { "ClassifierConfigFile", Path.GetFullPath(classifierConfigFile) } } }, WorkItemDataStream = ImageMemoryStream }; //Act using (new Performance("ImageRating")) { HandlerOutcome = handler.Execute(); } }
public void MapNullProperties() { const int CategoryId = 1; const string CategoryName = null; DocumentMapperConfig.NewConfig <Category>() .WithId(c => c.Id) .WithAttribute(c => c.Name); var category = new Category { Id = CategoryId, Name = CategoryName }; var document = category.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); resource.Attributes.Should().ContainKey(nameof(Category.Name)); resource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); }
public SPDiagnosticsCategory this[CategoryId id] { get { return(Areas[DiagnosticsAreaName].Categories[id.ToString()]); } }
private void FillDropDown() { ItemRelationship.DisplayCategoryHierarchy(cboCategories, -1, PortalId, false); var li = new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1"); cboCategories.Items.Insert(0, li); li = cboCategories.Items.FindByValue(CategoryId.ToString(CultureInfo.InvariantCulture)); if (li != null) { li.Selected = true; } cboWorkflow.Visible = UseApprovals; lblWorkflow.Visible = UseApprovals; if (UseApprovals) { cboWorkflow.DataSource = DataProvider.Instance().GetApprovalStatusTypes(PortalId); cboWorkflow.DataValueField = "ApprovalStatusID"; cboWorkflow.DataTextField = "ApprovalStatusName"; cboWorkflow.DataBind(); li = cboWorkflow.Items.FindByText(ApprovalStatus.Waiting.Name); if (li != null) { li.Selected = true; } } }
public void MapSpecificProperties() { const int CategoryId = 1; const string CategoryName = "Category1"; const string CategoryDescription = "Description Category1"; DocumentMapperConfig.NewConfig <Category>() .WithId(c => c.Id) .WithAttribute(c => c.Name); var category = new Category { Id = CategoryId, Name = CategoryName, Description = CategoryDescription }; var document = category.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); resource.Attributes.Should().ContainKey(nameof(Category.Name)); resource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); resource.Attributes.Should().NotContainKey(nameof(Category.Description)); }
public void MapWrapperType() { const int CategoryId = 1; const string CategoryName = "Category1"; const string CategoryDescription = "Description Category1"; DocumentMapperConfig.NewConfig <Category>() .MapWithDetaults() .Ignore(c => c.Description); var category = new Category { Id = CategoryId, Name = CategoryName, Description = CategoryDescription }; var result = new ResultModel <Category> { Data = category }; DocumentMapperConfig.AddWrapperType(typeof(ResultModel <>), r => r.Data); var document = result.ToDocument(); var resource = (Resource)document.Data; resource.Id.Should().Be(CategoryId.ToString()); resource.Attributes.Should().ContainKey(nameof(Category.Name)); resource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); resource.Attributes.Should().NotContainKey(nameof(Category.Description)); }
protected override NameValueCollection DataAsNameValueCollection() { NameValueCollection nvc = base.DataAsNameValueCollection(); nvc["numberOfPosts"] = NumberOfPosts.ToString(); nvc["showExcerpt"] = ShowExcerpt.ToString(); nvc["categoryid"] = CategoryId.ToString(); return(nvc); }
public override string ToString() { StringBuilder sb = new StringBuilder("{"); sb.Append(CategoryId.ToString() + ","); sb.Append(lang.shortCode + ","); sb.Append(Convert.ToString(EventRequired) + ","); sb.Append(CategoryName + ","); sb.Append(SortOrdinal.ToString() + "}"); return(sb.ToString()); }
/// <summary> /// Search the category name from a list using the instance's category id /// </summary> /// <param name="categoryList"></param> /// <returns></returns> public string getCategoryName(List <FileLibraryCategoryData> categoryList) { foreach (FileLibraryCategoryData c in categoryList) { if (c.CategoryId == CategoryId) { return(c.CategoryName); } } return(CategoryId.ToString()); }
/// <summary> /// Search the category title by using the instance's category id /// </summary> /// <param name="categoryList"></param> /// <returns></returns> public string getCategoryTitle(List <EventCalendarCategoryData> categoryList) { foreach (EventCalendarCategoryData c in categoryList) { if (c.CategoryId == CategoryId) { return(c.Title); } } return(CategoryId.ToString()); }
/// <summary> /// Logs to the ULS. /// </summary> /// <param name="categoryId"></param> /// <param name="traceSeverity">The trace severity.</param> /// <param name="message">The message.</param> /// <param name="args">The message arguments.</param> protected virtual void InnerLog(CategoryId categoryId, TraceSeverity traceSeverity, string message, params object[] args) { //SPSecurity.RunWithElevatedPrivileges( // () => // { if (_innerLogger == null) { _innerLogger = new InnerLogger(Name); } SPDiagnosticsCategory category = _innerLogger.Areas[_innerLogger.Name].Categories[categoryId.ToString()]; _innerLogger.WriteTrace(0, category, traceSeverity, message, args); //}); }
public void MapRelationship() { const int CategoryId = 1; const string CategoryName = "Category1"; DocumentMapperConfig.NewConfig <Product>() .WithId(p => p.Id) .WithAttribute(p => p.Active) .WithRelationship(p => p.Category); DocumentMapperConfig.NewConfig <Category>() .WithId(p => p.Id) .WithAttribute(p => p.Name); var product = new Product { Category = new Category { Id = CategoryId, Name = CategoryName } }; var document = product.ToDocument(); var resource = (Resource)document.Data; resource.Relationships.Should().ContainKey(nameof(Product.Category)); var categoryRelationship = (Resource)resource.Relationships[nameof(Product.Category)].Data; categoryRelationship.Id.Should().Be(CategoryId.ToString()); categoryRelationship.Attributes.Should().BeNull(); document.Included.Should().NotBeNull(); document.Included.Should().NotBeEmpty(); var categoryResource = document.Included.ElementAt(0); categoryRelationship.Id.Should().Be(CategoryId.ToString()); categoryResource.Attributes.Should().ContainKey(nameof(Category.Name)); categoryResource.Attributes[nameof(Category.Name)].Should().Be(CategoryName); }
public string GetCurrentUrl(IUrlHelper urlHelper) { var parms = new Dictionary <string, string>(); if (CategoryId.HasValue) { parms.Add("categoryId", CategoryId.ToString()); } if (!String.IsNullOrEmpty(SearchedProduct)) { parms.Add("searchedProduct", SearchedProduct); } if (MinPrice != CurrentSetMinPrice || MaxPrice != CurrentSetMaxPrice) { parms.Add("minPrice", CurrentSetMinPrice.ToString()); parms.Add("maxPrice", CurrentSetMaxPrice.ToString()); } return(urlHelper.Action("Index", "Product", parms)); }
public override NameValueCollection GetParameters() { NameValueCollection nvc = base.GetParameters(); if (RequiresApiToken) { if (!String.IsNullOrEmpty(GetApiToken())) { nvc.Add("token", GetApiToken()); } } if (RequiresServiceId) { if (!String.IsNullOrEmpty(GetServiceId())) { nvc.Add("serviceId", GetServiceId()); } } ParameterValidator.IsNotNull(CategoryId, "CategoryId"); nvc.Add("categoryId", CategoryId.ToString()); if (!ParameterValidator.IsNonEmptyInt(ProgramId)) { nvc.Add("programId", ProgramId.ToString()); } if (!ParameterValidator.IsNonEmptyInt(PaymentMethodId)) { nvc.Add("paymentMethodId", PaymentMethodId.ToString()); } if (!ParameterValidator.IsNull(ShowNotAllowedOnRegistration)) { nvc.Add("ShowNotAllowedOnRegistration", ((bool)ShowNotAllowedOnRegistration) ? "1" : "0"); } return(nvc); }
public AddEntityCategoriesFixture(OsdrWebTestHarness harness) { var categories = new List <TreeNode>() { new TreeNode("Category Root", new List <TreeNode>() { new TreeNode("My Test Category"), new TreeNode("Projects Two") }) }; var response = harness.JohnApi.PostData("api/categorytrees/tree", categories).Result; var content = response.Content.ReadAsStringAsync().Result; CategoryId = Guid.Parse(content); harness.WaitWhileCategoryTreePersisted(CategoryId); BlobId = harness.JohnBlobStorageClient.AddResource(harness.JohnId.ToString(), "Chemical-diagram.png", new Dictionary <string, object>() { { "parentId", harness.JohnId } }).Result; FileId = harness.WaitWhileFileProcessed(BlobId); var fileNodeResponse = harness.JohnApi.GetNodeById(FileId).Result; var fileNode = JsonConvert.DeserializeObject <JObject>(fileNodeResponse.Content.ReadAsStringAsync().Result); FileNodeId = Guid.Parse(fileNode.Value <string>("id")); // add category to entity response = harness.JohnApi.PostData($"/api/categoryentities/entities/{FileNodeId}/categories", new List <Guid> { CategoryId }).Result; response.EnsureSuccessStatusCode(); harness.WaitWhileCategoryIndexed(CategoryId.ToString()); }
public async Task UploadImage(IImageStoreService imageService, Stream fileStream, string extension) { if (imageService == null) { throw new ArgumentNullException(nameof(imageService)); } if (fileStream == null) { throw new ArgumentNullException(nameof(fileStream)); } if (string.IsNullOrEmpty(extension)) { throw new ArgumentNullException(nameof(extension)); } var path = await imageService.SaveImage(fileStream, CategoryId.ToString(), $"{Id.ToString()}.{extension}"); Update(new ImageUploaded { ImagePath = path }); }
public override NameValueCollection GetParameters() { var nvc = base.GetParameters(); ParameterValidator.IsNotNull(CategoryId, "CategoryId"); nvc.Add("categoryId", CategoryId.ToString()); if (!ParameterValidator.IsNonEmptyInt(ProgramId)) { nvc.Add("programId", ProgramId.ToString()); } if (!ParameterValidator.IsNonEmptyInt(PaymentMethodId)) { nvc.Add("paymentMethodId", PaymentMethodId.ToString()); } if (!ParameterValidator.IsNull(ShowNotAllowedOnRegistration)) { nvc.Add("ShowNotAllowedOnRegistration", ((bool)ShowNotAllowedOnRegistration) ? "1" : "0"); } return(nvc); }
internal RequestSettings Serialize() { var parameters = new RequestSettings(); if (LanguageId != Language.NotSet) { parameters.Add("language_id", (int)LanguageId); } if (CategoryId != 0) { parameters.Add("category_id", CategoryId.ToString()); } if (ShowOnlyAvailableToCurrentUser.HasValue) { parameters.Add("show_only_available_to_current_user", ShowOnlyAvailableToCurrentUser.Value); } parameters.Add("fields", new List <string> { "language_id", "title", "short_description", "long_description", "is_available_to_current_user", "is_featured", "is_certified", "page_count", "question_count", "preview_url", "category_id", "category_name", "category_description", "date_modified", "date_created" }); return(parameters); }
public void WhenIProcessTheFile() { //Arrange var handler = new ImageScalingHandler { Parameters = new WorkItemBase.WorkItemParameters { RuntimeData = new Dictionary <string, string> { { "ExhibitId", ExhibitId.ToString(CultureInfo.InvariantCulture) }, { "FileId", FileId.ToString(CultureInfo.InvariantCulture) }, { "FileCategoryId", CategoryId.ToString(CultureInfo.InvariantCulture) }, } }, WorkItemDataStream = ImageMemoryStream }; //Act using (new Performance("ImageScaling")) { HandlerOutcome = handler.Execute(); } }
public string PictureURL() { return(Constant.S3_BUCKET_URL + "Category/" + CategoryId.ToString() + "/" + Picture); }
public ActionResult CategoryView(string prm = "") { HomeCategoryViewModel objHomeCategoryViewModel = new HomeCategoryViewModel(); //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int CategoryId; //decrypt parameter and set in CategoryId variable int.TryParse(CommonUtils.Decrypt(prm), out CategoryId); //Get Category detail by Category Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Home + "/GetCategoryList?CategoryId=" + CategoryId.ToString()); objHomeCategoryViewModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <HomeCategoryViewModel>().Result : null; } return(View(objHomeCategoryViewModel)); }
public ActionResult SaveCategory(string prm = "") { CategoryModel objCategoryModel = new CategoryModel(); try { //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int CategoryId; //decrypt parameter and set in CategoryId variable int.TryParse(CommonUtils.Decrypt(prm), out CategoryId); //Get Category detail by Category Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Category + "/GetCategoryById?CategoryId=" + CategoryId.ToString()); objCategoryModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <CategoryModel>().Result : null; } FillQuickLinks(objCategoryModel.QuickLinks, objCategoryModel.CategoryID); } catch (Exception ex) { ErrorLog(ex, "Category", "SaveCategory Get"); } return(View("SaveCategory", objCategoryModel)); }
public ActionResult ActivateDeactivateCategory(string prm = "") { CategoryModel objCategoryModel = new CategoryModel(); try { //if prm(Paramter) is empty means Add condition else edit condition if (!String.IsNullOrEmpty(prm)) { int CategoryId; int Status; //decrypt parameter and set in CategoryId variable int.TryParse(CommonUtils.Decrypt(prm.Split('~')[0]), out CategoryId); int.TryParse(prm.Split('~')[1], out Status); //Get Category detail by Category Id serviceResponse = objUtilityWeb.GetAsync(WebApiURL.Category + "/UpdateCategoryStatusByID?CategoryId=" + CategoryId.ToString() + "&status=" + Status); objCategoryModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <CategoryModel>().Result : null; //serviceResponse = objUtilityWeb.GetAsync(WebApiURL.UserLogin + "/GetUserListById?UserId=" + UserId.ToString()); //objUserLogin = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync<UserLogin>().Result : null; //if (objUserLogin != null) //{ // serviceResponse = objUtilityWeb.GetAsync(WebApiURL.UserLogin + "/UpdateUserStatusByID?UserId=" + CategoryId.ToString() + "&status=" + Status); // objUserLogin = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync<UserLogin>().Result : null; // //Admin_UpdateUserStatusByID //} } } catch (Exception ex) { ErrorLog(ex, "Category", "ViewCategory"); } return(RedirectToAction("ViewCategory")); }
/// <summary> /// Save cookie to client /// </summary> public void Save() { #region "Get temp filename" var tempfilename = ""; if (_storageType == DataStorageType.SessionMemory) { if (HttpContext.Current.Session[_cookieName + "tempname"] != null) { tempfilename = (String)HttpContext.Current.Session[_cookieName + "tempname"]; } } else { tempfilename = Cookie.GetCookieValue(_portalId, _cookieName, "tempname", ""); } if (tempfilename == "") { tempfilename = Utils.GetUniqueKey(12); } if (_storageType == DataStorageType.SessionMemory) { HttpContext.Current.Session[_cookieName + "tempname"] = tempfilename; } else { Cookie.SetCookieValue(_portalId, _cookieName, "tempname", tempfilename, 1, ""); } #endregion var nbi = new NBrightInfo(true); if (XmlData != "") { nbi.XMLData = XmlData; } nbi.SetXmlProperty("genxml/Criteria", _criteria); nbi.SetXmlProperty("genxml/PageModuleId", PageModuleId); nbi.SetXmlProperty("genxml/PageNumber", PageNumber); nbi.SetXmlProperty("genxml/PageName", PageName); nbi.SetXmlProperty("genxml/PageSize", PageSize); nbi.SetXmlProperty("genxml/OrderBy", OrderBy); nbi.SetXmlProperty("genxml/CategoryId", CategoryId.ToString("D")); nbi.SetXmlProperty("genxml/RecordCount", RecordCount); nbi.SetXmlProperty("genxml/Mode", Mode); nbi.SetXmlProperty("genxml/OrderByIdx", OrderByIdx); if (!String.IsNullOrEmpty(SearchFormData)) { nbi.RemoveXmlNode("genxml/SearchFormData"); nbi.SetXmlProperty("genxml/SearchFormData", "", TypeCode.String, false); nbi.AddXmlNode(SearchFormData, "genxml", "genxml/SearchFormData"); } var filePath = StoreSettings.Current.FolderTempMapPath + "\\" + tempfilename; Utils.SaveFile(filePath, nbi.XMLData); Exists = true; }
private void ConfigureAddLink() { if (TopLevelId == -1) { string s = cboCategories.SelectedValue; int categoryId = (Utility.HasValue(s) ? Convert.ToInt32(s, CultureInfo.InvariantCulture) : -1); if (categoryId == -1) { if (CategoryId > -1) { lnkAddNewArticle.NavigateUrl = BuildLinkUrl("&ctl=" + Utility.AdminContainer + "&mid=" + ModuleId.ToString(CultureInfo.InvariantCulture) + "&adminType=articleEdit&topLevelId=" + CategoryId.ToString(CultureInfo.InvariantCulture) + "&parentId=" + CategoryId.ToString(CultureInfo.InvariantCulture)); lnkAddNewArticle.Visible = true; } else { lnkAddNewArticle.NavigateUrl = BuildLinkUrl("&ctl=" + Utility.AdminContainer + "&mid=" + ModuleId.ToString(CultureInfo.InvariantCulture) + "&adminType=articleEdit"); lnkAddNewArticle.Visible = false; } } else { lnkAddNewArticle.NavigateUrl = BuildLinkUrl("&ctl=" + Utility.AdminContainer + "&mid=" + ModuleId.ToString(CultureInfo.InvariantCulture) + "&adminType=articleEdit&topLevelId=" + categoryId.ToString(CultureInfo.InvariantCulture) + "&parentId=" + categoryId.ToString(CultureInfo.InvariantCulture)); lnkAddNewArticle.Visible = true; } } else { lnkAddNewArticle.NavigateUrl = BuildLinkUrl("&ctl=" + Utility.AdminContainer + "&mid=" + ModuleId.ToString(CultureInfo.InvariantCulture) + "&adminType=articleEdit&topLevelId=" + TopLevelId.ToString(CultureInfo.InvariantCulture) + "&parentId=" + CategoryId.ToString(CultureInfo.InvariantCulture)); lnkAddNewArticle.Visible = true; } }
public override void LoadSettings() { try { //we want to allow for both articles and categories to be selected here, all the time CJH //if (CategoryId != -1) //{ DataBindItemTypeList(); ListItem li = ddlItemTypeList.Items.FindByValue(ItemTypeId.ToString(CultureInfo.InvariantCulture)); if (li != null) { li.Selected = true; } //} ////if the category is top level, only allow Category for the item type, there are only categories under top level. BD //else //{ // ddlItemTypeList.Items.Add(new ListItem(ItemType.Category.Name, ItemType.Category.GetId().ToString(CultureInfo.InvariantCulture))); //} ddlDataType.Items.Add(new ListItem(Localization.GetString("ItemListing", LocalResourceFile), "Item Listing")); if (ModuleBase.IsViewTrackingEnabledForPortal(PortalId)) { ddlDataType.Items.Add(new ListItem(Localization.GetString("MostPopular", LocalResourceFile), "Most Popular")); } ddlDataType.Items.Add(new ListItem(Localization.GetString("MostRecent", LocalResourceFile), "Most Recent")); li = ddlDataType.Items.FindByValue(DataType); if (li != null) { li.Selected = true; } ddlDisplayFormat.Items.Add(new ListItem(Localization.GetString(ArticleViewOption.Title.ToString(), LocalResourceFile), ArticleViewOption.Title.ToString())); ddlDisplayFormat.Items.Add(new ListItem(Localization.GetString(ArticleViewOption.Abstract.ToString(), LocalResourceFile), ArticleViewOption.Abstract.ToString())); ddlDisplayFormat.Items.Add(new ListItem(Localization.GetString(ArticleViewOption.TitleAndThumbnail.ToString(), LocalResourceFile), ArticleViewOption.TitleAndThumbnail.ToString())); ddlDisplayFormat.Items.Add(new ListItem(Localization.GetString(ArticleViewOption.Thumbnail.ToString(), LocalResourceFile), ArticleViewOption.Thumbnail.ToString())); li = ddlDisplayFormat.Items.FindByValue(DataDisplayFormat); if (li != null) { li.Selected = true; } txtMaxItems.Text = MaxDisplayItems.ToString(CultureInfo.CurrentCulture); ItemRelationship.DisplayCategoryHierarchy(ddlCategory, -1, PortalId, false); ddlCategory.Items.Insert(0, new ListItem(Localization.GetString("NoCategory", LocalResourceFile), "-1")); ListItem liCat = ddlCategory.Items.FindByValue(CategoryId.ToString(CultureInfo.InvariantCulture)); if (liCat != null) { liCat.Selected = true; } if (ddlDataType.SelectedValue == "Most Recent") { chkEnableRss.Visible = true; lblEnableRss.Visible = true; } else { chkEnableRss.Visible = false; lblEnableRss.Visible = false; } chkEnableRss.Checked = EnableRss; if (ddlCategory.SelectedValue == "-1") { lblShowParent.Visible = false; chkShowParent.Visible = false; } else { lblShowParent.Visible = true; chkShowParent.Visible = true; } chkShowParent.Checked = ShowParent; } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private void ConfigureAddLink() { //has a top level been selected? if (TopLevelId == -1) { string s = cboItemType.SelectedValue; int id = (Utility.HasValue(s) ? Convert.ToInt32(s, CultureInfo.InvariantCulture) : -1); lnkAddNewCategory.NavigateUrl = id == -1 ? BuildLinkUrl("&ctl=" + Utility.AdminContainer + "&mid=" + ModuleId.ToString(CultureInfo.InvariantCulture) + "&adminType=categoryEdit") : BuildLinkUrl("&ctl=" + Utility.AdminContainer + "&mid=" + ModuleId.ToString(CultureInfo.InvariantCulture) + "&adminType=categoryEdit&topLevelId=" + id.ToString(CultureInfo.InvariantCulture) + "&parentId=" + id.ToString(CultureInfo.InvariantCulture)); } else { lnkAddNewCategory.NavigateUrl = BuildLinkUrl("&ctl=" + Utility.AdminContainer + "&mid=" + ModuleId.ToString(CultureInfo.InvariantCulture) + "&adminType=categoryEdit&topLevelId=" + TopLevelId.ToString(CultureInfo.InvariantCulture) + "&parentId=" + CategoryId.ToString(CultureInfo.InvariantCulture)); } }
/// <summary> /// Save cookie to client /// </summary> public void Save() { #region "Get temp filename" var tempfilename = ""; if (_storageType == DataStorageType.SessionMemory) { if (HttpContext.Current.Session[_cookieName + "tempname"] != null) tempfilename = (String)HttpContext.Current.Session[_cookieName + "tempname"]; } else { tempfilename = Cookie.GetCookieValue(_portalId, _cookieName, "tempname", ""); } if (tempfilename == "") tempfilename = Utils.GetUniqueKey(12); if (_storageType == DataStorageType.SessionMemory) { HttpContext.Current.Session[_cookieName + "tempname"] = tempfilename; } else { Cookie.SetCookieValue(_portalId, _cookieName, "tempname", tempfilename, 1, ""); } #endregion var nbi = new NBrightInfo(true); if (XmlData != "") nbi.XMLData = XmlData; nbi.SetXmlProperty("genxml/Criteria", _criteria); nbi.SetXmlProperty("genxml/PageModuleId", PageModuleId); nbi.SetXmlProperty("genxml/PageNumber", PageNumber); nbi.SetXmlProperty("genxml/PageName", PageName); nbi.SetXmlProperty("genxml/PageSize", PageSize); nbi.SetXmlProperty("genxml/OrderBy", OrderBy); nbi.SetXmlProperty("genxml/CategoryId", CategoryId.ToString("D")); nbi.SetXmlProperty("genxml/RecordCount", RecordCount); nbi.SetXmlProperty("genxml/Mode", Mode); nbi.SetXmlProperty("genxml/OrderByIdx", OrderByIdx); nbi.SetXmlProperty("genxml/FilterPropertyList", FilterPropertyList); var filterCSV = ""; foreach (var f in _filterPropertiesByProduct) { filterCSV += f.ToString() + ","; } nbi.SetXmlProperty("genxml/filterpropertycsv", filterCSV.TrimEnd(',')); if (!String.IsNullOrEmpty(SearchFormData)) { nbi.RemoveXmlNode("genxml/SearchFormData"); nbi.SetXmlProperty("genxml/SearchFormData", "", TypeCode.String, false); nbi.AddXmlNode(SearchFormData, "genxml", "genxml/SearchFormData"); } var filePath = StoreSettings.Current.FolderTempMapPath + "\\" + tempfilename; try { Utils.SaveFile(filePath, nbi.XMLData); } catch (Exception e) { // this is because the file's in use sometimes // we call it bad luck in those cases } Exists = true; }