private void PaidInvoicePostage(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 3) { int rowIndex = e.RowIndex; string phoneNumber = grvInvoicePostage.Rows[rowIndex].Cells[0].Value.ToString(); InvoicePostage invoicePostage = invoicePostageBUS.GetByPeriodAndPhoneNumber(Convert.ToDateTime(lblPeriod.Text), phoneNumber); if (invoicePostage.PaidPostage) { MessageBox.Show("Hóa đơn này đã thanh toán"); } else { if (DialogResult.Yes == MessageBox.Show($"Thanh toán cho SĐT {phoneNumber} ở kỳ thanh toán {invoicePostage.PeriodFKNavigation.PeriodPayment.Month}/{invoicePostage.PeriodFKNavigation.PeriodPayment.Year}\nGiá cước: {invoicePostage.Total}", "", MessageBoxButtons.YesNo)) { invoicePostage.PaidPostage = true; if (invoicePostageBUS.Update(invoicePostage) != null) { MessageBox.Show("Thanh toán thành công"); List <InvoicePostage> invoicePostages = invoicePostageBUS.GetByPeriod(Convert.ToDateTime(lblPeriod.Text)); LoadInvoicePostageDetail(invoicePostages); } } } } }
public ActionResult DeleteConfirmed(int id) { InvoicePostage invoicePostage = db.InvoicePostages.Find(id); db.InvoicePostages.Remove(invoicePostage); db.SaveChanges(); return(RedirectToAction("Index")); }
public InvoicePostage Update(InvoicePostage invoicePostage) { if (invoicePostage == null) { return(null); } db.Entry(invoicePostage).State = EntityState.Modified; db.SaveChanges(); return(invoicePostage); }
private void LoadInvoicePostageDetail(InvoicePostage invoicePostage) { if (invoicePostage != null) { int n = grvInvoicePostage.Rows.Add(); grvInvoicePostage.Rows[n].Cells[0].Value = invoicePostage.PhoneNumberFKNavigation.PhoneNo; grvInvoicePostage.Rows[n].Cells[1].Value = invoicePostage.Total; grvInvoicePostage.Rows[n].Cells[2].Value = (invoicePostage.PaidPostage) ? "Đã thanh toán" : "Chưa thanh toán"; } }
public ActionResult Edit([Bind(Include = "KeyId,PaymentPeriod,PhoneNumberFK,Total,PaidPostage")] InvoicePostage invoicePostage) { if (ModelState.IsValid) { db.Entry(invoicePostage).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PhoneNumberFK = new SelectList(db.PhoneNumbers, "KeyId", "PhoneNo", invoicePostage.PhoneNumberFK); return(View(invoicePostage)); }
// GET: InvoicePostage/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InvoicePostage invoicePostage = db.InvoicePostages.Find(id); if (invoicePostage == null) { return(HttpNotFound()); } return(View(invoicePostage)); }
// GET: InvoicePostage/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InvoicePostage invoicePostage = db.InvoicePostages.Find(id); if (invoicePostage == null) { return(HttpNotFound()); } ViewBag.PhoneNumberFK = new SelectList(db.PhoneNumbers, "KeyId", "PhoneNo", invoicePostage.PhoneNumberFK); return(View(invoicePostage)); }
public InvoicePostage Update(InvoicePostage invoicePostage) { return(invoicePostageDAL.Update(invoicePostage)); }