public IActionResult SetDefaultUpdateByForStatusHistory(string username) { try { username = username?.Trim() ?? ""; if (HttpContext.User.Identity.Name.Equals("sachin") && username.Length > 0) { foreach (CategoryEntity category in CacheHelper.GetCategoryList(Constants.BASE_CATEGORY)) { IEnumerable <TechnologyStatusEntity> statuses = TableStorageHelper.RetrieveByRangeAsync <TechnologyStatusEntity>(Constants.TABLE_TECHNOLOGY, category.ID, "ge", "S", "lt", "T").Result; foreach (TechnologyStatusEntity status in statuses) { if (string.IsNullOrEmpty(status?.Username?.Trim())) { status.Username = username; } } TableStorageHelper.BatchAsync(Constants.TABLE_TECHNOLOGY, null, null, statuses.ToArray()).Wait(); } ViewData["ExecutionStatus"] = "Succeed."; } else { ViewData["ExecutionStatus"] = "Failed."; } } catch { ViewData["ExecutionStatus"] = "Failed."; } return(View()); }
// GET: /<controller>/ public IActionResult Index([FromQuery] string CurrentCategoryID, [FromQuery] int?Priority, [FromQuery] int?Top, [FromQuery] string Tag, [FromQuery] string errorCode) { DashboardModel data = new DashboardModel(); data.StyleIDForTags = new HashSet <string>(); data.Categories = CacheHelper.GetCategoryList(Constants.BASE_CATEGORY).Where(cat => cat.Visibility == (int)Visibility.True); data.Technologies = new Dictionary <string, IEnumerable <TechnologyEntity> >(); data.Subcategories = new Dictionary <string, IEnumerable <CategoryEntity> >(); foreach (CategoryEntity category in data.Categories) { data.Technologies.Add(category.ID, TableStorageHelper.RetrieveByRangeAsync <TechnologyEntity>(Constants.TABLE_TECHNOLOGY, category.ID, "ge", "T", "lt", "U").Result.Where(tech => tech.Visibility == (int)Visibility.True)); data.Subcategories.Add(category.ID, CacheHelper.GetCategoryList(category.ID).Where(cat => cat.Visibility == (int)Visibility.True)); } data.TagList = CacheHelper.GetTagList(); data.CurrentCategoryID = data.Categories.FirstOrDefault(c => c.ID.Equals(CurrentCategoryID?.Trim() ?? ""))?.ID ?? data.Categories.FirstOrDefault()?.ID ?? ""; data.Priority = Priority ?? 0; data.Top = Top?.ToString() ?? ""; data.Tag = Tag?.Trim() ?? ""; if (!string.IsNullOrEmpty(errorCode)) { ViewData["errorCode"] = errorCode; } return(View(data)); }
public IActionResult StatusHistory(string PartitionKey, string RowKey) { ViewData["divID"] = (PartitionKey ?? "") + "_" + (RowKey ?? ""); string technologyID = (RowKey ?? "T_ASDF_-12345").Split('_')[2]; string value1 = "S_" + technologyID; string value2 = "S_" + (int.Parse(technologyID) + 1).ToString(Constants.PADDING_TECHNOLOGYID); IEnumerable <TechnologyStatusEntity> statusList = TableStorageHelper.RetrieveByRangeAsync <TechnologyStatusEntity>(Constants.TABLE_TECHNOLOGY, PartitionKey ?? "", "ge", value1, "lt", value2).Result; return(PartialView(statusList)); }
public IActionResult Index([FromQuery] int?category, [FromQuery] int?subcategory, [FromQuery] int?technology, [FromQuery] string errorCode) { TechnologyViewModel data = new POCO.TechnologyViewModel(); data.CategoryID = category?.ToString(Constants.PADDING_CATEGORYID); data.SubcategoryID = subcategory?.ToString(Constants.PADDING_CATEGORYID); data.TechnologyID = technology?.ToString(Constants.PADDING_TECHNOLOGYID); if (category != null) { string value1 = (subcategory != null ? "T_" + ((int)subcategory).ToString(Constants.PADDING_CATEGORYID) : "T"); string value2 = (subcategory != null ? "T_" + ((int)subcategory + 1).ToString(Constants.PADDING_CATEGORYID) : "U"); data.Technologies = TableStorageHelper.RetrieveByRangeAsync <TechnologyEntity>(Constants.TABLE_TECHNOLOGY, ((int)category).ToString(Constants.PADDING_CATEGORYID), "ge", value1, "lt", value2).Result; data.Subcategories = CacheHelper.GetCategoryList(((int)category).ToString(Constants.PADDING_CATEGORYID)); data.TagList = CacheHelper.GetTagList(); data.Active = new Microsoft.AspNetCore.Mvc.Rendering.SelectListGroup() { Name = "Active" }; data.Inactive = new Microsoft.AspNetCore.Mvc.Rendering.SelectListGroup() { Name = "Inactive" }; data.CategoryName = CacheHelper.GetCategoryList(Constants.BASE_CATEGORY).FirstOrDefault(cat => cat.ID.Equals(((int)category).ToString(Constants.PADDING_CATEGORYID)))?.Name ?? ""; if (subcategory != null) { data.SubcategoryName = CacheHelper.GetCategoryList(((int)category).ToString(Constants.PADDING_CATEGORYID)).FirstOrDefault(cat => cat.ID.Equals(((int)subcategory).ToString(Constants.PADDING_CATEGORYID)))?.Name ?? ""; } } data.Categories = CacheHelper.GetCategoryList(Constants.BASE_CATEGORY); if (!string.IsNullOrEmpty(errorCode)) { ViewData["errorCode"] = errorCode; } return(View(data)); }