public async Task <IActionResult> Edit(int id, [Bind("AddendumId,LotId,AddendumTypeId,Attachment,Remarks,ExpiryDate")] Addendum addendum) { if (id != addendum.AddendumId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(addendum); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddendumExists(addendum.AddendumId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AddendumTypeId"] = new SelectList(_context.Set <AddendumType>(), "AddendumTypeId", "AddendumTypeId", addendum.AddendumTypeId); ViewData["LotId"] = new SelectList(_context.Lot, "lotId", "lotId", addendum.LotId); return(View(addendum)); }
public AddendumWindow(Addendum addendum, InvoicesContext context) { InitializeComponent(); this.context = context; DataContext = addendum; }
public async Task <IActionResult> Create([Bind("AddendumId,LotId,AddendumTypeId,Attachment,Remarks,ExpiryDate")] Addendum addendum) { if (ModelState.IsValid) { _context.Add(addendum); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AddendumTypeId"] = new SelectList(_context.Set <AddendumType>(), "AddendumTypeId", "AddendumTypeId", addendum.AddendumTypeId); ViewData["LotId"] = new SelectList(_context.Lot, "lotId", "lotId", addendum.LotId); return(View(addendum)); }
public async Task <IActionResult> Create(int id, short AID, [Bind("AddendumId,LotId,AddendumTypeId,Attachment,Remarks,ExpiryDate")] Addendum addendum, IFormFile Attachment) { if (ModelState.IsValid) { if (Attachment != null) { var rootPath = Path.Combine( Directory.GetCurrentDirectory(), "wwwroot\\Documents\\Procurement\\"); string fileName = Path.GetFileName(Attachment.FileName); fileName = fileName.Replace("&", "n"); string AName = _context.Lot.Include(a => a.Activity).Where(a => a.lotId == id).Select(a => a.Activity.Name).FirstOrDefault().ToString(); AName = AName.Replace("&", "n"); var PPName = _context.ProcurementPlan.Find(_context.Activity.Find(AID).ProcurementPlanID).Name; int NextID = (_context.Addendum.Max(a => (int?)a.AddendumId) ?? 1) + 1; addendum.Attachment = Path.Combine("/Documents/Procurement/", PPName + "/" + "//" + AName + "//Addendum//" + NextID.ToString() + "//" + fileName);//Server Path string sPath = Path.Combine(rootPath + PPName + "/" + AName + "//Addendum//" + NextID.ToString()); if (!System.IO.Directory.Exists(sPath)) { System.IO.Directory.CreateDirectory(sPath); } string FullPathWithFileName = Path.Combine(sPath, fileName); using (var stream = new FileStream(FullPathWithFileName, FileMode.Create)) { await Attachment.CopyToAsync(stream); } } if (addendum.AddendumTypeId == 1) { addendum.ExpiryDate = _context.ActivityDetail.Include(a => a.Step).Where(a => a.ActivityID == AID && a.Step.SerailNo == 9).Select(a => a.ActualDate).FirstOrDefault(); } _context.Add(addendum); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Create), new { id, AID })); } ViewData["AddendumTypeId"] = new SelectList(_context.Set <AddendumType>(), "AddendumTypeId", "AddendumTypeId", addendum.AddendumTypeId); ViewData["LotId"] = new SelectList(_context.Lot, "lotId", "lotId", addendum.LotId); return(View(addendum)); }
public Addendum UpdateAddendum(Addendum addendum, string headerText, string footerText, string contentText) { return(addendum.Update(addendum, headerText, footerText, contentText)); }
public Addendum AddAddendum(int leaseId, Addendum addendum) { var added = new Addendum(leaseId, addendum.HeaderText, addendum.FooterText, addendum.ContentText); return(added); }
private void LoadAddendum() { if (IsQueryStringMissingParameter(X_ID)) { RedirectToPortalSelectionScreen(); } else { _addendumId = GetDecryptedEntityId(X_ID); _addendumIdEncrypted = EntityIdEncrypted; var key = "Addendum_" + _addendumId; if (!RecordExistsInCache(key)) { _selectedAddendum = Addendum.GetAddendumByID(_addendumId); if(_selectedAddendum != null) Base.Classes.Cache.Insert(key, _selectedAddendum); else { SessionObject.RedirectMessage = "Could not find the addendum."; Response.Redirect("~/PortalSelection.aspx", true); } } else _selectedAddendum = (Addendum)Cache[key]; // Set the page title text. _addendumTitle = _selectedAddendum.Addendum_Name ?? string.Empty; } }