private void UpdateItemsUC_Load(object sender, EventArgs e) { loadData(); ItemTxtLb.Text = ""; PriceTB.Hide(); CategoryTB.Hide(); }
public ActionResult DeleteConfirmed(int id) { CategoryTB categoryTB = db.CategoryTB.Find(id); db.CategoryTB.Remove(categoryTB); db.SaveChanges(); return(RedirectToAction("Index")); }
private void UpdateItemsUC_Leave(object sender, EventArgs e) { dataGridView1.ClearSelection(); PriceTB.Clear(); CategoryTB.Clear(); ItemTxtLb.Text = ""; PriceTB.Hide(); CategoryTB.Hide(); }
public ActionResult Edit([Bind(Include = "ID,CategoryID,CategoryName,ParentID,IndexOrder,CreatedDate,Status,LargeIcon,Icon,ClientType,ClientVersion,HasList,IsLocal,LayoutType,CategoryFrom,ChildrenCount,JumpType,JumpUrl,Description,AppDownloadUrl,FeedbackUrl,OriginalID,Priority,Jpop,Bdefault,ShowToolBar,StatusBarStyle,CacheMinutes,LastModifiedDate,WebViewStyle,MainClickShowContent,ListClickShowContent,ListShowDownloadIcon,AppScheme,AppVersion,BackgroundImg,CheckStatus,CategoryType,RemindType,IpPort,DayShareUrl,MonthShareUrl,DateType,CategoryStartDate,CategoryEndDate,CategoryPre,CategoryAfter,Chosen_circle_color,MonthDateChosen_color,MonthTitle_color,Item_point_color,ShowBackAndShare,KeyDateTime,KeyString,itemHeaderBgColor,ContentTypeIcon,DefaultReminder,hascity")] CategoryTB categoryTB) { if (ModelState.IsValid) { db.Entry(categoryTB).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categoryTB)); }
// GET: CategoryTBs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CategoryTB categoryTB = db.CategoryTB.Find(id); if (categoryTB == null) { return(HttpNotFound()); } return(View(categoryTB)); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { try { String name = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); String category = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); int price = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString()); ItemTxtLb.Text = name; CategoryTB.Text = category; PriceTB.Text = price.ToString(); PriceTB.Show(); CategoryTB.Show(); } catch { } }
private void UpdateBtn_Click(object sender, EventArgs e) { if (ItemTxtLb.Text == "") { MessageBox.Show("Choose an item to update", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (CategoryTB.Text == "" || PriceTB.Text == "") { MessageBox.Show("Complete all the values", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { query = "update items set category = '" + CategoryTB.Text + "', price = '" + PriceTB.Text + "' where name = '" + ItemTxtLb.Text + "'"; db.setData(query); MessageBox.Show("Data Processed Succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); loadData(); SearchTextBox.Text = "Search Item"; ItemTxtLb.Text = ""; CategoryTB.Clear(); PriceTB.Clear(); } }