public ActionResult ItemEdit(string iid, string iname, string iprice, string iclass, string icap, string ical, string iprot, string icar, string ifat, string isug, string isod, string islog1, string islog2) { ItemDb items = new ItemDb { ItemId = Convert.ToInt32(iid.Trim()), ItemName = iname, ItemUnitPrice = Convert.ToInt32(iprice.Trim()), Class = iclass, Capacity = icap, Calorles = ical, Protein = iprot, Carbohydrate = icar, Fat = ifat, Sugars = isug, Sodium = isod, Slogan1 = islog1, Slogan2 = islog2 }; db.Entry(items).State = EntityState.Modified; //db.Entry(items).Property(m => m.ItemId).IsModified = false; db.Entry(items).Property(m => m.ItemImg).IsModified = false; db.Entry(items).Property(m => m.ImgUrl).IsModified = false; db.Entry(items).Property(m => m.PayUrl).IsModified = false; try { db.SaveChanges(); } catch (Exception) { goto Redirect; } Redirect: return(RedirectToAction("ItemEdit")); }
public void BeforeEach() { _Service = new ItemService(); string filename = "guideline"; // ItemDb.Deserialize(); ItemDb.DeserializeFromFile(filename); }
public void DeleteItem(int itemId) { var itemDb = new ItemDb(); var orderC = new OrderCtrl(); orderC.DeleteOrderLineItem(itemId); // itemDb.DeleteItem(itemId); }
public void ViewUserInfo(ItemDb item) { GameObject info = GameObject.Find("Database").transform.GetChild(2).GetChild(1).gameObject; info.SetActive(true); info.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = item._surname; info.transform.GetChild(1).GetChild(1).GetComponent <Text>().text = item._firstname; info.transform.GetChild(1).GetChild(2).GetComponent <Text>().text = item._middlename; }
internal Server() { Clients = new Dictionary<int, Client>(); Rand = new Random(); Logger = new Logger(Settings.Default.LogFile); Permissions = new PermissionConfiguration(this); PluginManager = new PluginManager(Settings.Default.PluginFolder); Items = new ItemDb(Settings.Default.ItemsFile); Recipes = Recipe.FromFile(Settings.Default.RecipesFile); if (Settings.Default.IrcEnabled) InitializeIrc(); }
private void Awake() { if (Instance == null) { Instance = this; BuildItemDb(); } else { Destroy(this); } }
public async Task <IActionResult> Delete(int Id) { Item item = await ItemDb.GetItemAsync(_context, Id); BlobStorageHelper blobStorageHelper = new BlobStorageHelper(_config); await blobStorageHelper.DeletePhotoBlob(item.PhotoUrl); await blobStorageHelper.DeleteModelBlob(item.ModelUrl); await ItemDb.DeleteItemAsync(_context, item); return(RedirectToAction("Index", "Home")); }
public MainActivity() { try { clsGLB = new clsGlobal(); itemDb = new ItemDb(); //Set DBFilePath string folderPath = Path.Combine(clsGlobal.FilePath, clsGlobal.FileFolder); clsGlobal.DBFilePath = Path.Combine(folderPath, clsGlobal.DBFileName); } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } }
public void AddItem(ItemDb item) { this.AMIncrease += item.AMIncrease; this.CristUp += item.CristUp; this.DameAtk += item.DameAtk; this.DodgeIncrease += item.DodgeIncrease; this.HpIncrease += item.HpIncrease; this.MRIncrease += item.MRIncrease; this.UpAbility += item.UpAbility; this.UpCoin += item.UpCoin; this.UpCoinIncrease += item.UpCoinIncrease; this.Uplevel += item.Uplevel; this.UpMax += item.UpMax; this.Vamp += item.Vamp; }
public Server() { ServerHash = Hash.MD5(Guid.NewGuid().ToByteArray()); UseOfficalAuthentication = Settings.Default.UseOfficalAuthentication; Clients = new Dictionary<int, Client>(); Rand = new Random(); Logger = new Logger(this, Settings.Default.LogFile); PluginManager = new PluginManager(this, Settings.Default.PluginFolder); Items = new ItemDb(Settings.Default.ItemsFile); Recipes = Recipe.FromFile(Settings.Default.RecipesFile); SmeltingRecipes = SmeltingRecipe.FromFile(Settings.Default.SmeltingRecipesFile); ClientCommandHandler = new ClientCommandHandler(); ServerCommandHandler = new ServerCommandHandler(); if (Settings.Default.IrcEnabled) InitializeIrc(); }
public static void Register(HttpConfiguration config) { // Web API configuration and services var cors = new EnableCorsAttribute("*", "*", "*"); config.EnableCors(cors); // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); ItemDb.Deserialize(); }
void Start() { Player = PublicClass.Player; Items = GetComponent <item>(); Items.Load(); Name.text = Player.NameMC; Description.text = Player.Description; // ViewerAnimator = Viewer.GetComponent <Animator>(); ViewerSprite = Viewer.GetComponent <SpriteRenderer>(); ContentView.sprite = Resources.Load <Sprite>("UI/Items/Icons/ground"); ViewerAnimator.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Player/Animators/" + Player.IdMC); // Load; ItemDb item = null; hp = Player.HpDefault; am = Player.AMDefault; mr = Player.MRDefault; dodge = Player.DodgeDefault; damage = crist = vamp = 0; for (int i = 0; i < Items.Player.ItemDbList.Length; i++) { item = Items.Player.ItemDbList[i]; if (item.IdMC == Player.IdMC && item.TypeItem != 3 && item.TypeItem != 4) { hp += (hp * item.HpIncrease); am += (am * item.AMIncrease); mr += (mr * item.MRIncrease); damage += item.DameAtk; crist += item.CristUp; vamp += item.Vamp; dodge += item.DodgeIncrease; } } // HPContent.text = hp.ToString("0.") + " HP"; AMContent.text = am.ToString("0.") + " AM"; MRContent.text = mr.ToString("0.") + " MR"; DamageContent.text = (damage).ToString("0.") + " Damage"; CristContent.text = (crist * 100).ToString("0.") + "% Crist"; DodgeContent.text = (dodge * 100).ToString("0.") + "% Dodge"; VampContent.text = (vamp * 100).ToString("0.") + "% Vamp"; }
public void AddItem(int id) { ItemDb itemToAdd = database.FetchItemByID(id); for (int i = 0; i < items.Count; i++) { if (items[i].ID == -1) { items[i] = itemToAdd; GameObject itemObj = Instantiate(inventoryItem); itemObj.transform.SetParent(slots[i].transform); itemObj.GetComponent <Image>().sprite = itemToAdd.Sprite; itemObj.transform.position = Vector2.zero; itemObj.name = itemToAdd.Title; break; } } }
public IEnumerable <ModelLibrary.Item> GetMenuItems(int menuId) { var itemDb = new ItemDb(); var priceCtrl = new PriceCtrl(); var itemsDb = itemDb.GetMenuItems(menuId); var items = new List <ModelLibrary.Item>(); foreach (var item in itemsDb) { var itemi = ConvertItemToModel(item); itemi.Price = priceCtrl.GetPriceItemId(item.id); if (itemi.Price != null) { items.Add(itemi); } } return(items); }
public IEnumerable <ModelLibrary.Item> GetCatItems(int itemCatId) { var itemDb = new ItemDb(); var priceCtrl = new PriceCtrl(); var itemsDb = itemDb.GetCategoryItems(itemCatId); var items = new List <ModelLibrary.Item>(); foreach (var item in itemsDb) { var itemo = ConvertItemToModel(item); itemo.Price = priceCtrl.GetLatestPriceById(item.id); if (itemo.Price != null) { items.Add(itemo); } } return(items); }
[RequestSizeLimit(8388608)] // 8MB public async Task <IActionResult> Edit(Item item) { if (ModelState.IsValid) { IFormFile photo = item.Photo; IFormFile model = item.Model; BlobStorageHelper helper = new BlobStorageHelper(_config); if (!FileUploadHelper.IsFileEmpty(model)) { if (FileUploadHelper.IsValidExtension(model, FileUploadHelper.FileTypes.Model)) { await helper.UpdateModelBlob(model, item.ModelUrl); } else { // Add error message // return view } } if (!FileUploadHelper.IsFileEmpty(photo)) { if (FileUploadHelper.IsValidExtension(photo, FileUploadHelper.FileTypes.Photo)) { await helper.UpdatePhotoBlob(photo, item.PhotoUrl); } else { // Add error message // return view } } await ItemDb.UpdateItemAsync(_context, item); return(RedirectToAction("Item", "Home", new { id = item.Id })); } return(View(item)); }
[RequestSizeLimit(8388608)] // 8MB public async Task <IActionResult> Create(Item item) { if (ModelState.IsValid) { IFormFile photo = item.Photo; IFormFile model = item.Model; BlobStorageHelper helper = new BlobStorageHelper(_config); if (!FileUploadHelper.IsFileEmpty(model)) { if (FileUploadHelper.IsValidExtension(model, FileUploadHelper.FileTypes.Model)) { item.ModelUrl = await helper.UploadModelBlob(model); } else { // Add error message } } if (!FileUploadHelper.IsFileEmpty(photo)) { if (FileUploadHelper.IsValidExtension(photo, FileUploadHelper.FileTypes.Photo)) { item.PhotoUrl = await helper.UploadPhotoBlob(photo); } else { // Add error message // return view } } await ItemDb.AddItemAsync(_context, item); return(RedirectToAction(nameof(Index))); } return(View(item)); }
public ItemDb(ItemDb item) { this.AMIncrease = item.AMIncrease; this.CristUp = item.CristUp; this.DameAtk = item.DameAtk; this.DodgeIncrease = item.DodgeIncrease; this.HpIncrease = item.HpIncrease; this.IdItem = item.IdItem; this.IdMC = item.IdMC; this.MRIncrease = item.MRIncrease; this.NameItem = item.NameItem; this.Status = item.Status; this.TypeItem = item.TypeItem; this.UpAbility = item.UpAbility; this.UpCoin = item.UpCoin; this.UpCoinIncrease = item.UpCoinIncrease; this.Uplevel = item.Uplevel; this.UpMax = item.UpMax; this.Vamp = item.Vamp; this.Description = item.Description; }
public static Item MakeItem(ItemDb itemDb) { Item item = null; ItemData itemData = null; DataManager.itemDict.TryGetValue(itemDb.TemplateId, out itemData); if (itemData == null) { return(null); } switch (itemData.itemType) { case ItemType.Weapon: item = new Weapon(itemDb.TemplateId); break; case ItemType.Armor: item = new Armor(itemDb.TemplateId); break; case ItemType.Consumable: item = new Consumable(itemDb.TemplateId); break; } if (item != null) { item.ItemDbId = itemDb.ItemDbId; item.Count = itemDb.Count; item.Slot = itemDb.Slot; item.Equipped = itemDb.Equipped; } return(item); }
public void Create_Item_With_Price_Service_Test() { ItemCtrl itemCtrl = new ItemCtrl(); ItemDb itemDb = new ItemDb(); //Setup #region creates ModelItem, ModelPrice ModelLibrary.Price newPrice = new ModelLibrary.Price { VarPrice = 12, StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(100) }; ModelLibrary.Item newItem = new ModelLibrary.Item { Name = "testName", Description = "testDescr", Price = newPrice }; ItemService itemService = new ItemService(); PriceService priceService = new PriceService(); #endregion //Act JustFeastDbDataContext db = new JustFeastDbDataContext(); itemService.CreateItem(newItem, 1000000, 1000000); var checkItem = db.Items.SingleOrDefault(p => p.name == newItem.Name && p.description == newItem.Description); priceService.CreatePrice(newPrice, checkItem.id); //Get Item(1,1,"PerfectlyGoodName"); //Assert Assert.IsNotNull(db.Items.SingleOrDefault(p => p.id == checkItem.id)); Assert.IsNotNull(db.Prices.Where(p => p.itemId == checkItem.id).OrderByDescending(p => p.startDate).First()); }
public void GetItem(ItemDb item) { main.myMC.HpDefault += (int)( (1 + item.Uplevel * item.UpAbility) * item.HpIncrease ); //AM increase main.myMC.AMDefault += (int)( (1 + item.Uplevel * item.UpAbility) * item.AMIncrease ); //MP increase main.myMC.MRDefault += (int)( (1 + item.Uplevel * item.UpAbility) * item.MRIncrease ); //damge increase main.damgeAttack += (int)( (1 + item.Uplevel * item.UpAbility) * item.DameAtk ); //Crist Up main.Crist += (1 + item.Uplevel * item.UpAbility) * item.CristUp; main.Vamp += (1 + item.Uplevel * item.UpAbility) * item.Vamp; main.myMC.DodgeDefault += (1 + item.Uplevel * item.UpAbility) * item.DodgeIncrease; main.MyPlayer.Player.Coin -= item.UpCoin; main.MyPlayer.Save(); }
public ItemController(ItemDb itemDb) { _itemDb = itemDb; }
public async Task <IActionResult> Item(int id) { return(View(await ItemDb.GetItemAsync(_context, id))); }
public async Task <IActionResult> Index() { return(View(await ItemDb.GetItemsAsync(_context))); }
public ModelLibrary.Item GetItem(int itemId) { var itemDb = new ItemDb(); return(ConvertItemToModel(itemDb.GetItem(itemId))); }
public HomeControllerTest() { this._db = new ItemDb(); }
public void SaveToJson() { ItemDb.Serialize(); }