public Product(string name, ECategory category, double price, bool inStock) { Name = name; Category = category; Price = price; InStock = inStock; }
public int GetNameId(ECategory InCat, int InIndex) { if (InIndex < 0) { return(-1); } switch (InCat) { case ECategory.AI: if (InIndex < AIJudgeIds.Count) { return(AIJudgeIds[InIndex]); } break; case ECategory.Ex: if (InIndex < ExJudgeIds.Count) { return(ExJudgeIds[InIndex]); } break; case ECategory.Diff: if (InIndex < DiffJudgeIds.Count) { return(DiffJudgeIds[InIndex]); } break; } return(-1); }
public Suggestion(string name, Guid userId, ECategory category) { Id = Guid.NewGuid(); Name = name; UserId = userId; Category = category; }
public virtual IEntity CreateSimpleObjectEntity(ECategory category, int id, int count, Vector3 position, int curDurability = 0) { var entity = _sceneObjectContext.CreateEntity(); entity.AddEntityKey(new EntityKey(_equipGenerator.GetNextEntityId(), (short)EEntityType.SceneObject)); entity.isFlagSyncNonSelf = true; entity.AddPosition(); entity.position.Value = position; if (category == ECategory.Weapon) { entity.AddWeaponObject(); entity.weaponObject.ConfigId = id; if (SingletonManager.Get <WeaponResourceConfigManager>().IsArmors(id)) { int maxDurability = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(id).Durable; if (curDurability == 0) { entity.AddArmorDurability(maxDurability, maxDurability); } else { entity.AddArmorDurability(curDurability, maxDurability); } } } entity.AddSimpleItem(id, count, (int)category); entity.AddFlagImmutability(_currentTime.CurrentTime); return(entity); }
public void Compare(ECategory category) { var winner = EPlayer.Tied; winner = Confront(category, Player1, Player2); if (winner.ToString() == EPlayer.Player1.ToString()) { MessageBox.Show("Você ganhou :D"); } if (winner.ToString() == EPlayer.Player2.ToString()) { MessageBox.Show("Você perdeu :("); } if (winner.ToString() == EPlayer.Tied.ToString()) { MessageBox.Show("EMPATE!"); } CreateCards(); MixCards(); InitializeGame(); }
public ActionResult Edit(ECategory mdel) { ModelState.Remove("ModifiedUser"); ModelState.Remove("ModifiedOn"); ModelState.Remove("CreateOn"); if (ModelState.IsValid) { ECategory cat = categoryManager.Find(x => x.Id == mdel.Id); if (cat != null) { cat.Title = mdel.Title; cat.Description = mdel.Description; if (categoryManager.Update(cat) == 0) { ModelState.AddModelError("", "DataBaseError!"); return(View(mdel)); } CacheManager.Remove("category-cache"); //HttpContext.Cache.Remove("category-cache"); return(RedirectToAction("Index", "Category")); } ModelState.AddModelError("dbNot", "DataBaseError!"); return(View(mdel)); } return(View(mdel)); }
private void BtnInsert_Click(object sender, EventArgs e) { try { string CategoryName = TxtCategoryName.Text; ECategory ParentCategoryEnum = (ECategory)CmbParentCategoryName.SelectedIndex; string ParentCategoryName = ParentCategoryEnum.ToString(); Console.WriteLine(ParentCategoryName); string Firm = TxtFirm.Text; string Unit = TxtUnit.Text; string Color = TxtColor.Text; int ExpirationDate = int.Parse(TxtExpirationDate.Text); int MinStock = int.Parse(TxtMinStock.Text); int MaxStock = int.Parse(TxtMaxStock.Text); FrmCategory.category = new EtCategory { CategoryName = CategoryName, ParentCategoryID = ParentCategoryEnum, ParentCategoryName = ParentCategoryName, Unit = Unit, Color = Color, Firm = Firm, MinStock = MinStock, MaxStock = MaxStock, ExpirationDate = ExpirationDate, IsValid = EValid.效 }; Close(); } catch (Exception) { MsgBoxUtil.ErrMsgBox("商品信息输入错误!"); } }
public static String ToString(ECategory category) { switch (category) { case ECategory.Consumption: return("Consumo"); case ECategory.Displacements: return("Cilindradas"); case ECategory.HorsePower: return("Potência"); case ECategory.Length: return("Comprimento"); case ECategory.MaxSpeed: return("Velocidade Máxima"); case ECategory.Price: return("Preço"); default: return(String.Empty); } }
public void Indicates_Selected_Category() { // Arrange // - create the mock repository Mock <IProductRepository> mock = new Mock <IProductRepository>(); mock.Setup(m => m.Products).Returns(new Product[] { new Product { ID = 1, Title = "P1", Category = ECategory.BIBS }, new Product { ID = 4, Title = "P2", Category = ECategory.DRESSES }, }.AsQueryable()); // Arrange - create the controller NavController target = new NavController(mock.Object); // Arrange - define the category to selected ECategory categoryToSelect = ECategory.BIBS; // Action string result = target.Menu(categoryOn: true, category: categoryToSelect).ViewBag.SelectedCategory; // Assert Assert.AreEqual(categoryToSelect, result); }
public Expense(Guid id, decimal value, string description, ECategory category, DateTime createdOn, DateTime?updatedOn) : base(id, createdOn, updatedOn) { Value = value; Description = description; Category = category; }
public PartialViewResult Menu(EGender gender = EGender.UNISEX, Decimal age = 0, bool categoryOn = false, ECategory category = ECategory.OTHERS, bool brandOn = false, EBrand brand = EBrand.UNKNOWN, Decimal minimumPrice = 0, Decimal maximumPrice = 0, EColorSeries colorSeries = EColorSeries.ANY, string keyword = "") { ViewBag.CategoryOn = categoryOn; ViewBag.SelectedCategory = category; IEnumerable <ECategory> categories = repository.Products.Select(x => x.Category).Distinct().OrderBy(x => x); IEnumerable <string> categoryStrings = CategoryClass.Categories.Select(x => x.Value.Item2); NavFilterViewModel navViewModel = new NavFilterViewModel() { Gender = gender, Age = age, CategoryOn = categoryOn, Category = category, BrandOn = brandOn, Brand = brand, MinimumPrice = minimumPrice, MaximumPrice = maximumPrice, ColorSeries = colorSeries, KeyWord = keyword, CategoryStrings = categoryStrings.ToArray() }; return(PartialView(categoryStrings.ToList())); }
public ICategory GetCategory(ECategory categoryType) { return(categoryType switch { ECategory.Standard => new StandardCategory(), _ => null });
public static IEnumerable GetItems <T>(this ECategory category) { return(category switch { ECategory.RepairCost => typeof(ERepairCost).GetEnumerationItems <T>(true), _ => new List <T>(), });
private void DrawTabs() { int index = (int)_categorySelected; index = GUILayout.Toolbar(index, m_categoryLabels.ToArray()); _categorySelected = m_categories[index]; }
public Skill(ECategory category_, NamedHash name_, string description_, string details_, List <Metric> metrics_) { Reference = this; Category = category_; Name = name_; Description = description_; Details = details_; Metrics = metrics_; switch (Category) { case ECategory.Ability: Material = App.Resource.Material.AbilityMaterial; break; case ECategory.Class: Material = App.Resource.Material.ClassMaterial; break; case ECategory.Kit: Material = App.Resource.Material.KitMaterial; break; } Reference = null; }
public ItemBaseConfig GetConfigById(int cat, int id, bool isSurvivalMode = false) { ECategory category = (ECategory)cat; ItemBaseConfig res = null; var dict = _dict[category]; if (dict.TryGetValue(id, out res)) { return(res); } switch (category) { case ECategory.GameItem: res = SingletonManager.Get <GameItemConfigManager>().GetConfigById(id); break; case ECategory.WeaponPart: if (isSurvivalMode) { var config = SingletonManager.Get <WeaponPartSurvivalConfigManager>().FindConfigBySetId(id); var partId = SingletonManager.Get <WeaponPartSurvivalConfigManager>().GetDefaultPartBySetId(id); var realConfig = SingletonManager.Get <WeaponPartsConfigManager>().GetConfigById(partId); if (config != null && realConfig != null) { realConfig.Name = config.Name; } res = realConfig; } else { res = SingletonManager.Get <WeaponPartsConfigManager>().GetConfigById(id); } break; case ECategory.Prop: res = SingletonManager.Get <PropConfigManager>().GetConfigById(id); break; case ECategory.Avatar: res = SingletonManager.Get <RoleAvatarConfigManager>().GetConfigById(id); break; case ECategory.Weapon: var weaponConfig = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(id); if (weaponConfig == null) { break; } var weaponAvatarConfig = SingletonManager.Get <WeaponAvatarConfigManager>() .GetConfigById(weaponConfig.AvatorId); res = weaponConfig.Copy(); if (weaponAvatarConfig != null) { res.IconBundle = weaponAvatarConfig.IconBundle; res.Icon = weaponAvatarConfig.Icon; } break; } dict[id] = res; return(res); }
private void ChangeTab() { m_lastCategory = (ECategory)m_tabController.CurrentTabIndex; NGUITools.SetActiveSelf(m_optionsGame.gameObject, m_lastCategory == ECategory.GAME); NGUITools.SetActiveSelf(m_optionsInput.gameObject, m_lastCategory == ECategory.INPUT); NGUITools.SetActiveSelf(m_optionsGraphics.gameObject, m_lastCategory == ECategory.GRAPHICS); NGUITools.SetActiveSelf(m_optionsSound.gameObject, m_lastCategory == ECategory.SOUND); }
public Product(string name, string description, double price, ECategory category) { Name = name; Description = description; Price = price; Category = category; CreatedAt = DateTime.Now; }
public override void OnUpdate() { if( m_nextCategory != m_currentCategory ) { m_currentCategory = m_nextCategory; StartCoroutine(SwitchCategory()); } }
public static List <GameObject> FindModulesByCategory(ECategory _eModuleCategory) { if (!s_mModulesByCategory.ContainsKey(_eModuleCategory)) { return(null); } return(s_mModulesByCategory[_eModuleCategory]); }
// GET: Projects //public async Task<IActionResult> Index() //{ // return View(await _context.Projects.ToListAsync()); //} public async Task <IActionResult> Index(ECategory category) { if (category != 0) { return(View(await _context.Projects.Where(p => p.Category == category).ToListAsync())); } return(View(await _context.Projects.ToListAsync())); }
private static EPlayer DetermineWinner(ECategory category, Car player1CardActive, Car player2CardActive) { var winner = EPlayer.Tied; switch (category) { case ECategory.Consumption: winner = player1CardActive.Consumption == player2CardActive.Consumption ? EPlayer.Tied : player1CardActive.Consumption > player2CardActive.Consumption ? EPlayer.Player1 : EPlayer.Player2; break; case ECategory.MaxSpeed: winner = player1CardActive.MaxSpeed == player2CardActive.MaxSpeed ? EPlayer.Tied : player1CardActive.MaxSpeed > player2CardActive.MaxSpeed ? EPlayer.Player1 : EPlayer.Player2; break; case ECategory.Length: winner = player1CardActive.Length == player2CardActive.Length ? EPlayer.Tied : player1CardActive.Length > player2CardActive.Length ? EPlayer.Player1 : EPlayer.Player2; break; case ECategory.HorsePower: winner = player1CardActive.HorsePower == player2CardActive.HorsePower ? EPlayer.Tied : player1CardActive.HorsePower > player2CardActive.HorsePower ? EPlayer.Player1 : EPlayer.Player2; break; case ECategory.Displacements: winner = player1CardActive.Displacements == player2CardActive.Displacements ? EPlayer.Tied : player1CardActive.Displacements > player2CardActive.Displacements ? EPlayer.Player1 : EPlayer.Player2; break; case ECategory.Price: winner = player1CardActive.Price == player2CardActive.Price ? EPlayer.Tied : player1CardActive.Price < player2CardActive.Price ? EPlayer.Player1 : EPlayer.Player2; break; } return(winner); }
private void CommandCPU() { Array values = Enum.GetValues(typeof(ECategory)); Random random = new Random(); ECategory randomCategory = (ECategory)values.GetValue(random.Next(values.Length)); WaitingCPU(); Compare(randomCategory); }
public static List <EtCategory> QueryByParentCategoryID(ECategory cate) { DBHelper helper = new DBHelper(); string sql = "SELECT * FROM category WHERE parentCategoryID = @parentCategoryID"; MySqlParameter[] prams = { new MySqlParameter("@parentCategoryID", cate) }; MySqlDataReader dr = helper.RunQuerySQL(sql, prams); return(GetListByDataReader(dr)); }
public int Insert(ECategory Cat) { conn.Open(); string query = "insert into Category(CategoryName)values(@CategoryName)"; SqlCommand cmd = new SqlCommand(query, conn); cmd.Parameters.AddWithValue("@CategoryName", Cat.CategoryName); int rows = cmd.ExecuteNonQuery(); return(rows); }
private static ECategory ParseNextCategoryString(string categoryString) { ECategory category = ECategory.OTHERS; if (categoryString.ToLower().Contains(@"dress")) { category = ECategory.DRESSES; } return(category); }
public int Delete(ECategory Cat) { conn.Open(); string query = @"Delete from Category where CategoryId=@CategoryId"; SqlCommand cmd = new SqlCommand(query, conn); cmd.Parameters.AddWithValue("@CategoryId", Cat.CategoryId); int rows = cmd.ExecuteNonQuery(); return(rows); }
public Transaction( DateTime createDate, string description, double value, ECategory category, EType type) { CreateDate = createDate; Description = description; Value = value; Category = category; Status = EStatus.Pendent; Type = type; }
public ActionResult Create(ECategory category) { ModelState.Remove("ModifiedUser"); ModelState.Remove("ModifiedOn"); ModelState.Remove("CreateOn"); if (ModelState.IsValid) { categoryManager.Insert(category); CacheManager.Remove("category-cache"); return(RedirectToAction("Index", "Category")); } return(View(category)); }
private void AddCategories(string beginDate, string endDate, int categoryID) { List <EtPurchase> tmpLists = new List <EtPurchase>(); ECategory parentCategoryID = (ECategory)categoryID; tmpLists = PurchaseDao.QueryByPurchaseDate(beginDate, endDate, parentCategoryID); ClsCategory category = GetClsCategory(tmpLists); if (category != null) { categories.Add(category); } }
public virtual IEntity CreateSimpleEquipmentEntity( ECategory category, int id, int count, Vector3 position) { var entity = _sceneObjectContext.CreateEntity(); entity.AddEntityKey(new EntityKey(_equipGenerator.GetNextEntityId(), (short)EEntityType.SceneObject)); entity.isFlagSyncNonSelf = true; entity.AddPosition(position); entity.AddSimpleEquipment(id, count, (int)category); entity.AddFlagImmutability(_currentTime.CurrentTime); return(entity); }
private void Browse(ECategory category) { float x = 205; float y = 200; float height = 310; UIScrollView scrollView = BrowseView.GetComponent<UIScrollView>(); foreach( Product product in ProductsManager.Instance.Products ) { if( product.Category == category ) { GameObject details = GameObject.Instantiate(ItemDetailsPrefab) as GameObject; details.transform.parent = BrowseView.transform; details.transform.localPosition = new Vector3(x, y, 0); details.transform.localScale = Vector3.one; GameObject prod = GameObject.Instantiate(product.gameObject) as GameObject; prod.transform.parent = details.transform; prod.transform.localPosition = new Vector3(0, 30, 0); prod.transform.localScale = Vector3.one; ItemDetailsController detailsController = details.GetComponent<ItemDetailsController>(); detailsController.PriceLabel.text = product.Price; detailsController.TitleLabel.text = product.Title; detailsController.ProductObject = prod; detailsController.ProductReference = product; UIEventListener.Get(detailsController.ZoomButton).onClick += (obj) => { OnZoomClicked(obj.transform.parent.gameObject); }; UIEventListener.Get(detailsController.AddCartButton).onClick += (obj) => { OnAddCartClicked(obj.transform.parent.gameObject); }; y += height; } } scrollView.ResetPosition(); }
public static List<GameObject> FindModulesByCategory(ECategory _eModuleCategory) { if (!s_mModulesByCategory.ContainsKey(_eModuleCategory)) { return (null); } return (s_mModulesByCategory[_eModuleCategory]); }
public void ChangeCategory(ECategory category) { m_nextCategory = category; }