//DELETE public bool Delete(string productID) { bool flag = false; CMART0Entities db = new CMART0Entities(); ProposeReceiptDetail pR = db.ProposeReceiptDetails.Single(x => x.ProductID == productID); try { db.ProposeReceiptDetails.Remove(pR); //db.usp_Account_Delete(accountID); db.SaveChanges(); flag = true; } catch { flag = false; } return(flag); }
private void lstDetails_DoubleClick(object sender, EventArgs e) { ProposeReceiptDetail detail = new ProposeReceiptDetail(); CMART0Entities db = new CMART0Entities(); if (lstDetails.SelectedRows.Count == 1) { var row = lstDetails.SelectedRows[0]; var cellProduct = row.Cells["ProductID"]; var cellQuantity = row.Cells["Quantity"]; string product = (string)cellProduct.Value; string productName = db.Products.Single(x => x.ProductID == product).Name; int quantity = int.Parse(cellQuantity.Value.ToString()); cboProduct.Text = productName; nmrQuantity.Text = quantity.ToString(); } cboProduct.Enabled = false; btnAdd.Enabled = false; lstProduct.Enabled = false; btnDeleteProduct.Enabled = false; btnCreate.Enabled = false; btnClean.Enabled = false; btnUpdate.Enabled = true; }