/// <summary> /// Writes the datafiles, asking the user for overwriting. /// </summary> /// <param name="gestures">Gestures list container</param> /// <param name="categories">Categories list container.</param> /// <param name="locations">Locations list container.</param> /// <param name="names">Names list container.</param> /// <param name="questions">Questions list container.</param> private static void WriteDatafiles(GestureContainer gestures, CategoryContainer categories, RoomContainer locations, NameContainer names, QuestionsContainer questions) { string path = Loader.GetPath("Gestures.xml"); if (Overwrite(path)) { Loader.Save(path, gestures); } path = Loader.GetPath("Locations.xml"); if (Overwrite(path)) { Loader.Save(path, locations); } path = Loader.GetPath("Names.xml"); if (Overwrite(path)) { Loader.Save(path, names); } path = Loader.GetPath("Objects.xml"); if (Overwrite(path)) { Loader.Save(path, categories); } path = Loader.GetPath("Questions.xml"); if (Overwrite(path)) { Loader.Save(path, questions); } }
public ActionResult Create() { var model = new CategoryModel(); model.Categories = CategoryContainer.GetCategories(); return(View(model)); }
public HttpResponseMessage Get(string tenant_id) { List <CategoryContainer> nulledcategoy = new List <CategoryContainer>(); var Categorys = CategoryService.GetAll().Where(o => o.Owner == tenant_id); if (Categorys == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "No content or wrong tenant id")); } else { foreach (Category c in Categorys) { CategoryContainer cc = new CategoryContainer(); cc.CategoryID = c.CategoryID; cc.CategoryName = c.CategoryName; cc.CategoryDescription = c.CategoryDescription; nulledcategoy.Add(cc); } return(Request.CreateResponse(HttpStatusCode.OK, nulledcategoy)); } }
public ActionResult Create() { var model = new ProductModel(); model.Categories = CategoryContainer.GetCategories(); model.Markets = MarketContainer.GetMarkets(); return(View(model)); }
public void ShouldAssignDataContextWithProvidedItem() { CategoryContainer container = new CategoryContainer(); GridEntry item = new GridEntryMock(); new CategoryItemsLayoutMock().CallPrepareContainerForItemOverride(container, item); Assert.AreEqual(item, container.DataContext); }
public void InitObject() { m_cg1 = new Category("SoftWare Engineering", "TDD"); m_cg2 = new Category("SoftWare Engineering", "Design Patterns"); m_cgContainer = new CategoryContainer(); m_cgContainer.Add(m_cg1); m_cgContainer.Add(m_cg2); m_control = new SmartController(); }
private static CategoryContainer GetCategoryContainer(RoutedEventArgs eventArgs) { FrameworkElement frameworkElement = eventArgs.OriginalSource as FrameworkElement; if (frameworkElement != null) { return(CategoryContainer.GetOwningCategoryContainer((DependencyObject)frameworkElement)); } return((CategoryContainer)null); }
private CategoryContainer BuildDomainResponse(DomainAssessmentFactor domain) { var d = new CategoryContainer() { DisplayText = domain.DomainName, AssessmentFactorName = domain.AssessmentFactorName }; return(d); }
public void ShouldAssignBindingWithProvidedItem() { CategoryContainer container = new CategoryContainer(); GridEntry item = new GridEntryMock(); new CategoryItemsLayoutMock().CallPrepareContainerForItemOverride(container, item); var expression = container.GetBindingExpression(GridEntryContainer.EntryProperty); Assert.IsNotNull(expression); }
// <summary> // Returns a SelectionPath pointing to the first visible category in the list // or null if no such category exists. // </summary> // <param name="categoryList">CategoryList for reference</param> // <returns>SelectionPath pointing to the first visible category in the list // or null if no such category exists.</returns> public SelectionPath GetDefaultSelectionPath(CategoryList categoryList) { foreach (CategoryEntry categoryEntry in categoryList) { CategoryContainer container = categoryList.FindCategoryEntryVisual(categoryEntry); if (container != null && container.Visibility == Visibility.Visible) { return(CategoryContainerSelectionPathInterpreter.Instance.ConstructSelectionPath(categoryEntry.CategoryName, false)); } } return(null); }
internal static void Update_CategoryContainer_Categories(CategoryContainer categoryContainer, CategoryCollection localCollection, CategoryCollection masterCollection) { if (localCollection == null) { categoryContainer.Categories = CategoryCollection.CreateDefault(); localCollection = categoryContainer.Categories; } localCollection.CollectionContent = masterCollection.CollectionContent; if (localCollection.OrderFilterIDList == null) { localCollection.OrderFilterIDList = new List <string>(); } }
/// <summary> /// Changes a check box of a given name to a given value. /// </summary> /// <param name="category">The category the UI control belongs to.</param> /// <param name="name">The name of the UI control containing the given setting.</param> /// <param name="value">The value of the setting to be set.</param> public void ChangeSettings(CategoryContainer category, string name, bool value) { var checkBoxMatches = category.CheckBoxes.Where(x => x.Item1 == name).ToList(); if (!checkBoxMatches.Any()) { throw new InvalidOperationException(); } var index = category.CheckBoxes.IndexOf(checkBoxMatches.First()); category.CheckBoxes[index] = (name, value); }
public ActionResult Delete(int id) { if (id < 1) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } string serverpath = Server.MapPath("~/Content/ProductsImages/"); CategoryContainer.DeleteCategory(id, serverpath); return(RedirectToAction("Index")); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var model = new CategoryModel(); model.Categories = CategoryContainer.GetSupperiorCategories(); model.Category = CategoryContainer.getCategoryById((int)id); return(View(model)); }
public static CategoryContainer getCateSession() { var cate = HttpContext.Current.Session["CateSession"]; if (cate == null) { CategoryContainer getCate = new CategoryContainer(); List <Category> list = ADODAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession()); getCate.cateList = list; SessionHelper.setCateSession(getCate); return(getCate); } return((CategoryContainer)cate); }
public ActionResult Index() { var categories = CategoryContainer.GetCategories(); foreach (var categ in categories) { if (categ.CategorieID != null) { categ.CategoryName = categories.FirstOrDefault(x => x.ID == categ.CategorieID).Nume; } } return(View(categories)); }
public ActionResult Index() { var products = ProductsContainer.GetProducts(); var categories = CategoryContainer.GetCategories(); var markets = MarketContainer.GetMarkets(); foreach (var prod in products) { prod.CategoryName = categories.Where(el => el.ID == prod.CategorieID).FirstOrDefault().Nume; prod.MarketName = markets.Where(el => el.ID == prod.MagazinID).FirstOrDefault().Denumire; } return(View(products)); }
private async void categories_categoryRelatedButton_Click(object sender, EventArgs e) { CategoryRelated api = new CategoryRelated { ApiKey = apiKey }; api.Arguments.category_id = 32073; if (fredValidationButton.Checked) { api.Arguments.Validators.Clear(); } CategoryContainer container = syncButton.Checked ? api.Fetch() : await api.FetchAsync(); ShowResults(api); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var model = new ProductModel(); model.Product = ProductsContainer.getProductById((int)id); model.Categories = CategoryContainer.GetCategories(); model.Markets = MarketContainer.GetMarkets(); return(View(model)); }
private async void series_seriesCategoriesButton_Click(object sender, EventArgs e) { SeriesCategories api = new SeriesCategories { ApiKey = apiKey }; api.Arguments.series_id = "EXJPUS"; if (fredValidationButton.Checked) { api.Arguments.Validators.Clear(); } CategoryContainer container = syncButton.Checked ? api.Fetch() : await api.FetchAsync(); ShowResults(api); }
/// <summary> /// Loads the set of GPSRObjects and Categories from the Objects.xml file. /// </summary> /// <returns>A GPSRObjectManager that contains the set of objects and categories</returns> public static ObjectManager LoadObjects(string filePath) { CategoryContainer container = Load <CategoryContainer> (filePath); if (container == null) { throw new Exception("No objects found"); } ObjectManager manager = ObjectManager.Instance; foreach (Category c in container.Categories) { manager.Add(c); } return(manager); }
public ActionResult Edit(HttpPostedFileBase postedFile, CategoryModel categoryModel) { if (ModelState.IsValid) { if (postedFile != null) { var filename = "img_" + categoryModel.Category.Nume.ToLower() + ".png"; var path = Path.Combine(Server.MapPath("~/Content/ProductsImages/"), filename); postedFile.SaveAs(path); categoryModel.Category.Imagine = "img_" + categoryModel.Category.Nume.ToLower(); } if (CategoryContainer.ValidateCode(categoryModel.Category.Cod)) { CategoryContainer.SaveCategory(categoryModel.Category); return(RedirectToAction("Index")); } } categoryModel.Categories = CategoryContainer.GetSupperiorCategories(); return(View(categoryModel)); }
public ActionResult Edit(HttpPostedFileBase postedFile, ProductModel model) { if (ModelState.IsValid) { if (postedFile != null) { var filename = "img_" + model.Product.Denumire.ToLower().Replace(' ', '_') + ".png"; var path = Path.Combine(Server.MapPath("~/Content/ProductsImages/"), filename); postedFile.SaveAs(path); model.Product.Imagine = "img_" + model.Product.Denumire.ToLower().Replace(' ', '_'); } if (model.Product.Pret > 0 && model.Product.Cantitate > 0) { ProductsContainer.SaveProduct(model.Product); return(RedirectToAction("Index")); } } model.Categories = CategoryContainer.GetCategories(); model.Markets = MarketContainer.GetMarkets(); return(View(model)); }
// GET: /Category/5?tenant-id public HttpResponseMessage Get(string tenant_id, int id) { Category c = CategoryService.GetById(id); if (c == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "Incorrect category id")); } else if (c.Owner != tenant_id) { return(Request.CreateResponse(HttpStatusCode.Forbidden, "You are not allowed, check your tenant id")); } else { CategoryContainer cc = new CategoryContainer(); cc.CategoryID = c.CategoryID; cc.CategoryName = c.CategoryName; cc.CategoryDescription = c.CategoryDescription; return(Request.CreateResponse(HttpStatusCode.OK, cc)); } }
public ActionResult GetCategories() { var categories = CategoryContainer.GetCategories(); return(View(categories)); }
/// <summary> /// Fetches data from a FRED service endpoint. /// </summary> /// <returns> /// A <see cref="CategoryContainer"/> containing FRED data. /// An abnormal fetch returns null and a message is available in the <see cref="FetchMessage"/> property. /// </returns> public CategoryContainer Fetch() { CategoryContainer result = base.Fetch <CategoryContainer>(); return(result); }
public void ShouldAssignItselfAsParentContainer() { CategoryContainer container = new CategoryContainer(); Assert.AreEqual(container, CategoryContainer.GetParentContainer(container)); }
public static void setCateSession(CategoryContainer cate) { HttpContext.Current.Session["CateSession"] = cate; }
public ActionResult Home() { if (SessionAccessor.LoggedUser == null) { return(RedirectToAction("Login")); } var model = new HomeModel(); switch (SessionAccessor.getUserRole()) { case 0: // Funizor var pendingDeliveries = DeliveryContainer.getNrOfPendingDeliveries(); model.dashboardMessage1 = "Aveti de făcut " + pendingDeliveries + (pendingDeliveries > 1 ? " livrari" : " livrare"); var initiatedDeliveries = DeliveryContainer.getNrOfInitiatedDeliveries(); var deliveredDeliveries = DeliveryContainer.getNrOfDeliveredDeliveries(); var refusedDeliveries = DeliveryContainer.getNrOfRefusedDeliveries(); model.chart = "" + initiatedDeliveries + "," + pendingDeliveries + "," + deliveredDeliveries + "," + refusedDeliveries; break; case 1: // Angajat var totalCategories = CategoryContainer.getNrOfCategories(); model.dashboardMessage1 = "Gestionaţi " + totalCategories + (totalCategories > 1 ? " categorii" : " categorie"); var primaryCategories = CategoryContainer.getNrOfPrimaryCategories(); model.chart = "" + primaryCategories + "," + (totalCategories - primaryCategories); var totalProducts = ProductsContainer.getNrOfProducts(); model.dashboardMessage2 = "Gestionaţi " + totalProducts + (totalProducts > 1 ? " produse" : " produs"); var products3 = ProductsContainer.getNrOfProductsExpiredDays(3); var products7 = ProductsContainer.getNrOfProductsExpiredDays(7); var products30 = ProductsContainer.getNrOfProductsExpiredDays(30); var products0 = ProductsContainer.getNrOfProductsExpired(); model.chart2 = "" + products3 + "," + products7 + "," + products30 + "," + products0; break; case 2: // Manager var pendingDeliveries2 = DeliveryContainer.getNrOfPendingDeliveries(); var initiatedDeliveries2 = DeliveryContainer.getNrOfInitiatedDeliveries(); var deliveredDeliveries2 = DeliveryContainer.getNrOfDeliveredDeliveries(); var refusedDeliveries2 = DeliveryContainer.getNrOfRefusedDeliveries(); model.dashboardMessage1 = "Aveti " + deliveredDeliveries2 + (deliveredDeliveries2 > 1 ? " livrari" : " livrare") + " efectuate"; model.chart = "" + initiatedDeliveries2 + "," + pendingDeliveries2 + "," + deliveredDeliveries2 + "," + refusedDeliveries2; var nrEmployees = EmployeeContainer.getNrOfEmployees(); var nrManagers = EmployeeContainer.getNrOfEmployees(); var nrBosses = EmployeeContainer.getNrOfBosses(); var nrSuppliers = EmployeeContainer.getNrOfEmployees(); model.dashboardMessage2 = "Sunteţi manager pentru " + nrEmployees + (nrEmployees > 1 ? " angajaţi" : " angajat"); model.chart2 = "" + nrEmployees + "," + nrManagers + "," + nrBosses + "," + nrSuppliers; break; case 3: // sef var suppliers = SupplierContainer.getNrOfSuppliers(); var cities = SupplierContainer.getTopSuppliersCities(5); model.chart = ""; model.cities = ""; foreach (var city in cities) { model.cities += city + ','; model.chart += SupplierContainer.getNrOfSupplierByCity(city).ToString() + ","; } if (model.cities.Length > 1) { model.cities = model.cities.Substring(0, model.cities.Length - 1); } if (model.chart.Length > 1) { model.chart = model.chart.Substring(0, model.chart.Length - 1); } model.dashboardMessage1 = "Aveti " + suppliers + (suppliers > 1 ? " furnizori" : " furnizor"); var markets = MarketContainer.getNrOfMarkets(); var marketsCities = MarketContainer.getTopMarketsCities(5); model.chart2 = ""; model.cities2 = ""; foreach (var city in marketsCities) { model.cities2 += city + ','; model.chart2 += MarketContainer.getNrOfMarketsByCity(city).ToString() + ","; } model.cities2 = model.cities2.Substring(0, model.cities2.Length - 1); model.chart2 = model.chart2.Substring(0, model.chart2.Length - 1); model.dashboardMessage2 = "Aveti " + markets + (markets > 1 ? " magazine" : " magazin"); break; } return(View(model)); }
/// <summary> /// Fetches data from a FRED service endpoint asynchronously. /// </summary> /// <returns> /// A <see cref="CategoryContainer"/> containing FRED data. /// An abnormal fetch returns null and a message is available in the <see cref="FetchMessage"/> property. /// </returns> public async Task <CategoryContainer> FetchAsync() { CategoryContainer result = await base.FetchAsync <CategoryContainer>(); return(result); }
internal static void Update_CategoryContainer_Categories(CategoryContainer categoryContainer, CategoryCollection localCollection, CategoryCollection masterCollection) { if (localCollection == null) { categoryContainer.Categories = CategoryCollection.CreateDefault(); localCollection = categoryContainer.Categories; } localCollection.CollectionContent = masterCollection.CollectionContent; if (localCollection.OrderFilterIDList == null) localCollection.OrderFilterIDList = new List<string>(); }