private InboxDocumentModel ToModel(InboxDocument model) { var result = new InboxDocumentModel(); result.Annotations = model.Annotations; result.AssignedByLogin = model.AssignedByLogin; result.AssignedByName = model.AssignedByName; result.AssignedToCCControl = model.AssignedToCCControl; result.AssignedToCCLogin = model.AssignedToCCLogin; result.AssignedToCCName = model.AssignedToCCName; result.AssignedToControl = model.AssignedToControl; result.AssignedToLogin = model.AssignedToLogin; result.AssignedToName = model.AssignedToName; result.AssignmentDate = model.AssignmentDate.HasValue ? model.AssignmentDate.Value:DateTime.MinValue; result.Attachment1Url = model.AttachmentUrl; result.CompanyName = model.CompanyName; result.DepartmentName = model.DepartmentName; result.DocumentCode = model.DocumentCode; result.DocumentDate = model.DocumentDate.HasValue ? model.DocumentDate.Value : DateTime.MinValue; result.DocumentStatus = model.DocumentStatus; result.DocumentSubject = model.DocumentSubject; result.FirstReminderDate = model.FirstReminderDate.HasValue ? model.FirstReminderDate.Value : DateTime.MinValue; result.FromCompany = model.FromCompany; result.FromContact = model.FromContact; result.IncomingMailboxId = model.IncomingMailboxId; result.ResponseDate = model.ResponseDate.HasValue ? model.ResponseDate.Value : DateTime.MinValue; result.SecondReminderDate = model.SecondReminderDate.HasValue ? model.SecondReminderDate.Value : DateTime.MinValue; result.SiteUrl = model.SiteUrl; return(result); }
public ActionResult DeleteConfirmed(int id) { InboxDocument inboxdocument = db.InboxDocuments.Find(id); db.InboxDocuments.Remove(inboxdocument); db.SaveChanges(); return(RedirectToAction("Index")); }
public InboxSmokeTestsHelper Expect_inbox_to_have_documents() { Assert_state(_inboxDocuments); Assert.True(_inboxDocuments.Any()); _inboxDocument = _inboxDocuments.First(); return(this); }
// GET: /InboxDocument/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InboxDocument inboxdocument = db.InboxDocuments.Find(id); if (inboxdocument == null) { return(HttpNotFound()); } return(View(inboxdocument)); }
public ActionResult Edit([Bind(Include = "Id,Sender,SenderNum,SenderDate,ResponseOn,Reciever,DocTheme,DocState,BuildingObj,Files")] InboxDocument inboxdocument) { if (ModelState.IsValid) { db.Entry(inboxdocument).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BuildingObj = new SelectList(db.BuildinObjects, "Id", "ObjName", inboxdocument.BuildingObj); ViewBag.Sender = new SelectList(db.ContractorEmployes, "Id", "FullName", inboxdocument.Sender); ViewBag.Reciever = new SelectList(db.Employes, "Id", "FullName", inboxdocument.Reciever); ViewBag.Files = new SelectList(db.FileMetaDatas, "Id", "FileName", inboxdocument.Files); ViewBag.ResponseOn = new SelectList(db.OutboxDocuments, "Id", "OutboxNum", inboxdocument.ResponseOn); return(View(inboxdocument)); }
// GET: /InboxDocument/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InboxDocument inboxdocument = db.InboxDocuments.Find(id); if (inboxdocument == null) { return(HttpNotFound()); } ViewBag.BuildingObj = new SelectList(db.BuildinObjects, "Id", "ObjName", inboxdocument.BuildingObj); ViewBag.Sender = new SelectList(db.ContractorEmployes, "Id", "FullName", inboxdocument.Sender); ViewBag.Reciever = new SelectList(db.Employes, "Id", "FullName", inboxdocument.Reciever); ViewBag.Files = new SelectList(db.FileMetaDatas, "Id", "FileName", inboxdocument.Files); ViewBag.ResponseOn = new SelectList(db.OutboxDocuments, "Id", "OutboxNum", inboxdocument.ResponseOn); return(View(inboxdocument)); }
public async Task GetById_ShouldReturnCorrectValues() { //arrange var expectedRequestUri = new Uri("/api/inbox-documents/729809", UriKind.Relative); const string responseBody = "{\"inbox-document\":{\"id\":\"729809\",\"created\":\"2019-12-20T12:17:35+01:00\",\"updated\":\"2019-12-20T13:32:46+01:00\",\"user_id\":\"52821\",\"filename\":\"inbox_729809.pdf\",\"mimetype\":\"image\\/jpeg\",\"document_type\":\"RECEIPT\",\"filesize\":\"152214\",\"page_count\":\"1\",\"base64file\":\"VGVzdA==\",\"metadata\":{\"data\":[{\"key\":\"TOTAL_NET\",\"value\":\"25.5\"},{\"key\":\"CURRENCY_CODE\",\"value\":\"EUR\"},{\"key\":\"recipient\",\"value\":\"Modefriseur eG K\\u00f6nigsbr\\u00fccker Stra\\u00dfe 66 01099 Dresden\"},{\"key\":\"recipientStreet\",\"value\":\"K\\u00f6nigsbr\\u00fccker Stra\\u00dfe:66\"}]},\"customfield\":\"\"}}"; var expectedResult = new InboxDocument { Id = 729809, Created = DateTime.Parse("2019-12-20T12:17:35+01:00", CultureInfo.InvariantCulture), Updated = DateTime.Parse("2019-12-20T13:32:46+01:00", CultureInfo.InvariantCulture), UserId = 52821, PageCount = 1, FileName = "inbox_729809.pdf", MimeType = "image/jpeg", FileContent = new[] { (byte)0x54, (byte)0x65, (byte)0x73, (byte)0x74 }, Metadata = new Dictionary <string, string> { { "TOTAL_NET", "25.5" }, { "CURRENCY_CODE", "EUR" }, { "recipient", "Modefriseur eG Königsbrücker Straße 66 01099 Dresden" }, { "recipientStreet", "Königsbrücker Straße:66" } }, FileSize = 152214, DocumentType = InboxDocumentType.Receipt }; var http = A.Fake <IHttpClient>(); A.CallTo(() => http.GetAsync(expectedRequestUri, A <CancellationToken> .Ignored)) .Returns(Task.FromResult(responseBody)); var sut = GetSystemUnderTest(http); //act var result = await sut.GetByIdAsync(729809); //assert A.CallTo(() => http.GetAsync(expectedRequestUri, A <CancellationToken> .Ignored)) .MustHaveHappenedOnceExactly(); result.Should().BeEquivalentTo(expectedResult); }
public void InboxDocument() { const string contentType = "txt"; const string content = "http://contenturi.no"; const string deleteUri = "http://deletecontenturi.no"; var firstAccessed = DateTime.Today.AddDays(2); var deliveryTime = DateTime.Today; const int id = 123456789; const string sender = "sender"; var source = new inboxdocument { attachment = new inboxdocument[0], authenticationlevel = authenticationlevel.PASSWORD, contenttype = contentType, contenturi = content, deleteuri = deleteUri, deliverytime = deliveryTime, firstaccessed = firstAccessed, firstaccessedSpecified = true, id = id, sender = sender }; var expected = new InboxDocument { AuthenticationLevel = AuthenticationLevel.Password, ContentType = contentType, Content = new Uri(content), Delete = new Uri(deleteUri), DeliveryTime = deliveryTime, FirstAccessed = firstAccessed, Id = id, Sender = sender }; var actual = InboxDataTransferObjectConverter.FromDataTransferObject(source); Comparator.AssertEqual(expected, actual); }