static public int ReturnIntFromCategory(Item_Category Category) { switch (Category) { case Item_Category.Medicine: return(0); case Item_Category.Items: return(1); case Item_Category.Pokeball: return(2); case Item_Category.TM: return(3); case Item_Category.Battle: return(4); case Item_Category.Berries: return(5); case Item_Category.Key: return(6); case Item_Category.none: return(7); default: return(0); } }
public ActionResult DeleteConfirmed(int id) { Item_Category item_Category = db.Item_Category.Find(id); db.Item_Category.Remove(item_Category); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Delete(int id) { Item_Category category = this.context.Item_Category.SingleOrDefault(x => x.Id == id); this.context.Item_Category.Remove(category); this.context.SaveChanges(); }
public void Update(Item_Category ItemCategory) { Item_Category category = this.context.Item_Category.SingleOrDefault(x => x.Id == ItemCategory.Id); category.categoryName = ItemCategory.categoryName; this.context.SaveChanges(); }
new BagData() { Category = Item_Category.Medicine, Name = "Medicine", Description = "Diggi Medicine", List = new List <ItemData>() { } },
public IActionResult Index() { Item_Category Item_Cat_id = database.Item_category_id_Generate(); ViewBag.Item_Cate_id = Item_Cat_id; return(View()); }
public ActionResult Edit([Bind(Include = "Category_ID,Cat_Name,Description,Aprroval_Needed")] Item_Category item_Category) { if (ModelState.IsValid) { db.Entry(item_Category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(item_Category)); }
public void Obs_Neg_23_Create_BadResultTimeKindB() { // Expecting an exception if result time is not in UTC var result = new Item_Category("hello"); new Observation(result) { ResultTime = DateTime.SpecifyKind(ParseDateTimeInUtc("2020-02-17T14:39:00Z"), DateTimeKind.Unspecified) }; }
public ActionResult Create([Bind(Include = "Category_ID,Cat_Name,Description,Aprroval_Needed")] Item_Category item_Category) { if (ModelState.IsValid) { db.Item_Category.Add(item_Category); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(item_Category)); }
private void Save_btn_Click(object sender, EventArgs e) { Item_Category item_Category = new Item_Category(); item_Category.Name = Name_txt.Text; dbContext.Item_Categories.Add(item_Category); dbContext.SaveChanges(); Refresh(); ClearTextBox(); }
public void Obs_Neg_23_Create_BadResultTimeKindA() { // Expecting an exception if result time is not in UTC var result = new Item_Category("hello"); new Observation(result) { ResultTime = ParseDateTimeInUtc("2020-02-17T14:39:00Z").ToLocalTime() }; }
// GET: Category/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Item_Category item_Category = db.Item_Category.Find(id); if (item_Category == null) { return(HttpNotFound()); } return(View(item_Category)); }
public void Insert_Item_Category(Item_Category ic, string Status) { using (SqlConnection conn = new SqlConnection(connectString)) { using (SqlCommand cmd = new SqlCommand("insert into Item_Category values (@Icate,@Descrption,@Status)", conn)) { conn.Open(); cmd.Parameters.AddWithValue("@Icate", ic.Item_category_id); cmd.Parameters.AddWithValue("@Descrption", ic.Descrption); cmd.Parameters.AddWithValue("@Status", Status); cmd.ExecuteNonQuery(); } } }
//Item_Category Start public Item_Category Item_category_id_Generate() { Item_Category ads = new Item_Category(); SqlConnection con = new SqlConnection(connectString); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select isnull(max(c.Icate_id),0)+1 I_Cate from Item_Category c"; cmd.Connection = con; con.Open(); SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); ads.Item_category_id = Convert.ToInt16(reader["I_Cate"]); reader.Close(); return(ads); }
public bool insertItemCategory(Guid idItem, Guid idCategory) { bool kt = false; try { Item_Category itemCategory = new Item_Category(); itemCategory.IdItem = idItem; itemCategory.IdCategory = idCategory; db.Item_Categories.InsertOnSubmit(itemCategory); db.SubmitChanges(); kt = true; } catch (Exception ex) { kt = false; } return(kt); }
public List <Item_Category> GetAllProductsCategories() { DbService db = new DbService(); DataSet DS = new DataSet(); List <Item_Category> allCat = new List <Item_Category>(); string StrSql = "SELECT * FROM product_category order by category_name "; DS = db.GetDataSetByQuery(StrSql); if (DS.Tables.Count > 0) { foreach (DataRow row in DS.Tables[0].Rows) { Item_Category Item = new Item_Category(); Item.Cat_id = int.Parse(row[0].ToString()); Item.Cat_Name = row[1].ToString(); allCat.Add(Item); } } return(allCat); }
public string AddingProductAuction(string itemName, string itemDesc, string city, string cat, string days, string assoc, string price, string user) { DbService db = new DbService(); DataSet DS = new DataSet(); JavaScriptSerializer j = new JavaScriptSerializer(); Item NewItem = new Item(); Reg_Auction Auction = new Reg_Auction(); City c = new City(int.Parse(city)); Item_Category IC = new Item_Category(int.Parse(cat)); Voluntary_association Vol = new Voluntary_association(assoc); UserT Seller = new UserT(user, true); int ProductCode = 0; NewItem.ItemName = itemName; NewItem.ItemDesc = itemDesc; NewItem.Location = c; NewItem.Item_Categories = IC; NewItem.Price = price; Auction.End_Date = DateTime.Now.AddDays(double.Parse(days)).ToString(); Auction.Vol_asc = Vol; Auction.Price = int.Parse(price); Auction.Seller = Seller; NewItem.AddItem(int.Parse(Auction.Seller.UserId)); string StrSql = "select max(product_code) from product "; DS = db.GetDataSetByQuery(StrSql); if (DS.Tables.Count > 0) { ProductCode = int.Parse(DS.Tables[0].Rows[0][0].ToString()); } Auction.AddNewAuction(ProductCode, int.Parse(assoc)); return(j.Serialize(ProductCode)); }
public List <Item_Category> ItemCat_dropdown() { List <Item_Category> DBase = new List <Item_Category>(); using (SqlConnection conn = new SqlConnection(connectString)) { using (SqlCommand cmd = new SqlCommand("select c.Icate_id,c.Description from Item_Category c", conn)) { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Item_Category emp = new Item_Category(); emp.Item_category_id = Convert.ToInt16(reader["Icate_id"]); emp.Descrption = reader["Description"].ToString(); DBase.Add(emp); } } } return(DBase); }
public JsonResult Index(Item_Category ic) { string R_Status = null; bool status = false; if (ic.Status == true) { R_Status = "Y"; } else { R_Status = "N"; } Item_Category Item_Cat_id = database.Item_category_id_Generate(); ic.Item_category_id = Item_Cat_id.Item_category_id; database.Insert_Item_Category(ic, R_Status); status = true; return(Json(new { success = status })); }
public void Insert(Item_Category Item_Category) { this.context.Item_Category.Add(Item_Category); this.context.SaveChanges(); }
public void SetCategory(int i) { Category = (Item_Category)i; SpawnSlots(); }
public void SetActiveBag(Item_Category Category) { SetActiveBag(BagData.GetBag(Category)); }
public IActionResult GetData() { Item_Category Item_Cat_id = database.Item_category_id_Generate(); return(Json(new { success = true, fetchdata = Item_Cat_id.Item_category_id })); }
public void Insert(Item_Category Item_Category) { this.data.Insert(Item_Category); }
public void Update(Item_Category Item_Category) { this.data.Update(Item_Category); }