public ActionResult Reissueinvoice(ReissueinvoiceModel reiinv) { int accId = User.GetAccountId(); var reissueinvoiceModel = new ReissueinvoiceModel() { ListNo = ListNos() }; DateTime dateTime = DateTime.Parse(reiinv.StartUsingDate.ToString(), System.Globalization.CultureInfo. GetCultureInfo("vi-VN"). DateTimeFormat); //if (dateTime < DateTime.Now) //{ // ModelState.AddModelError(String.Empty, ReissueinvoiceResource.StartUsingDateEqua.ToString()); // return View(reissueinvoiceModel); //} if (ModelState.IsValid) { using (var scope = new TransactionScope()) { var listReleaseInvoice = new ListReleaseInvoice() { Quantity = reiinv.Quantity, StartNumber = reiinv.StartNumber, EndNumber = reiinv.EndNumber, StartUsingDate = dateTime, AccountId = accId, TemplateCode = reiinv.TemplateId, Status = 0, SerialInvoice = reiinv.SerialInvoice, No = reiinv.No }; _listReleaseInvoice.CreateListReleaseInvoices(listReleaseInvoice); for (int i = reiinv.StartNumber; i <= reiinv.EndNumber; i++) { var invoiceNumber = new InvoiceNumber() { InvoicesNumber = i, UseStatus = 0, ReleaseId = listReleaseInvoice.Id, Status = 0, AccountId = accId }; _invoiceNumber.CreateInvoiceNumbers(invoiceNumber); } scope.Complete(); } return(RedirectToAction("Index", new { message = "Phát hành hóa đơn thành công. Xem lại trên giao diện", messageType = "info" })); } else { return(View(reissueinvoiceModel)); } }
public ActionResult Reissueinvoice(string message, string messageType) { var reissueinvoiceModel = new ReissueinvoiceModel() { ListNo = ListNos() }; ViewBag.Message = message; ViewBag.MessageType = messageType; return(View("Reissueinvoice", reissueinvoiceModel)); }