public ActionResult ActiveFrd(Frd submittedForm) { SuccessData viewModel; switch (submittedForm.SubmitType) { case Frd.ButtonsEnum.Submit: if (DB_Functions.SubmitOwnerUpdate(submittedForm)) { viewModel = new SuccessData() { Heading = "FRD updates have been submitted successfully", PrimaryParagraph = "Your active FRD has been updated successfully!", SecondaryParagraph = "The selected employees have now received your updated version", LastParagraph = "The updated FRD can be found in the 'Active Requests' page.", ButtonText = "GO TO ACTIVE REQUESTS", ButtonLink = "Request/Active" }; ViewBag.helpMessage = "No Information. \n"; return(View("Success", viewModel)); } else { return(RedirectToAction("ActiveFrd", new { id = submittedForm.Panel0.Hashed_Id, error = "Changes have to be made in order to submit an updated version of the FRD" })); } case Frd.ButtonsEnum.Reject: if (DB_Functions.OwnerClose(submittedForm.Panel0.Id)) { viewModel = new SuccessData() { Heading = "FRD has been closed successfully", PrimaryParagraph = "Your active FRD has been closed successfully!", SecondaryParagraph = "", LastParagraph = "The closed FRD can be found in the 'Closed Requests' page.", ButtonText = "GO TO Closed REQUESTS", ButtonLink = "Request/Closed" }; ViewBag.helpMessage = "No Information. \n"; return(View("Success", viewModel)); } else { } break; } ViewBag.helpMessage = "This FRD has been approved by your manager and is now awaiting the recepients' feedback and approval/rejection. \n" + "FRDs that you have created and are still awaiting approval can be found in the 'pending requests' page."; return(View()); }
public void ToMessageWithNonMatchingDataType() { var translator = new EndpointDisconnectConverter(); var data = new SuccessData { Id = new MessageId(), InResponseTo = new MessageId(), Sender = new EndpointId("a"), }; var msg = translator.ToMessage(data); Assert.IsInstanceOf(typeof(UnknownMessageTypeMessage), msg); Assert.AreSame(data.Id, msg.Id); Assert.AreSame(data.Sender, msg.Sender); Assert.AreSame(data.InResponseTo, msg.InResponseTo); }
public void ToMessage() { var translator = new SuccessConverter(); var data = new SuccessData { Id = new MessageId(), InResponseTo = new MessageId(), Sender = new EndpointId("a"), }; var msg = translator.ToMessage(data); Assert.IsInstanceOf(typeof(SuccessMessage), msg); Assert.AreSame(data.Id, msg.Id); Assert.AreSame(data.Sender, msg.Sender); Assert.AreSame(data.InResponseTo, msg.InResponseTo); }
public void ToMessageWithNonMatchingDataType() { var serializers = new Mock <IStoreObjectSerializers>(); var translator = new CommandInvocationConverter(serializers.Object); var data = new SuccessData { Id = new MessageId(), InResponseTo = new MessageId(), Sender = new EndpointId("a"), }; var msg = translator.ToMessage(data); Assert.IsInstanceOf(typeof(UnknownMessageTypeMessage), msg); Assert.AreSame(data.Id, msg.Id); Assert.AreSame(data.Sender, msg.Sender); Assert.AreSame(data.InResponseTo, msg.InResponseTo); }
public ActionResult New(Frd submittedFrd) { if (Functions.NoSession()) { return(RedirectToAction("Login", "Authentication")); } switch (submittedFrd.SubmitType) { case Frd.ButtonsEnum.Reset: //reset DB_Functions.DeleteSavedDraft(); return(RedirectToAction("New", new { message = "The FRD data has been reset successfully!" })); case Frd.ButtonsEnum.Submit: //submit if (DB_Functions.SubmitNewFrd(submittedFrd)) { SuccessData viewModel = new SuccessData() { Heading = "FRD has been submitted successfully", PrimaryParagraph = "Your FRD has been submitted successfully!", SecondaryParagraph = "Please wait for your manager's approval.", LastParagraph = "The submitted FRD can be found in the 'Pending Requests' page.", ButtonText = "GO TO PENDING REQUESTS", ButtonLink = "Request/Pending" }; return(View("Success", viewModel)); } else { submittedFrd.Type = Frd.TypesEnum.Saved; return(RedirectToAction("New", SavedFrdHandling.ProcessInfo(submittedFrd))); } case Frd.ButtonsEnum.Save: //save DB_Functions.SaveToDraft(G_Functions.ToByteArray(submittedFrd)); return(RedirectToAction("New", new { message = "The FRD data has been saved successfully!" })); } var a = FRD_Submit.Save(submittedFrd); return(RedirectToAction("New")); }
public ActionResult ReceivedFrd(Frd document) { SuccessData viewModel; switch (document.SubmitType) { //reject, frd id is given back case Frd.ButtonsEnum.Reject: if (document.Type == Frd.TypesEnum.ReceivedManagerPending) { if (DB_Functions.ManagerReject(document.Panel0.Id, document.VersionNotes)) { viewModel = new SuccessData() { Heading = "FRD has been refuted successfully", PrimaryParagraph = "the FRD has now been closed!", SecondaryParagraph = "", LastParagraph = "The rejected FRD can be found in the 'Closed Requests' page.", ButtonText = "GO TO CLOSED REQUESTS", ButtonLink = "Request/Closed" }; ViewBag.helpMessage = "No Information. \n"; return(View("Success", viewModel)); } } else //if its others { if (DB_Functions.User_Reject(document.Panel0.Id)) { viewModel = new SuccessData() { Heading = "FRD has been refuted successfully", PrimaryParagraph = "", SecondaryParagraph = "", LastParagraph = "", ButtonText = "GO TO HOME PAGE", ButtonLink = "Home/Index" }; ViewBag.helpMessage = "No Information. \n"; return(View("Success", viewModel)); } } break; //approve, frd id is given back case Frd.ButtonsEnum.Approve: if (document.Type == Frd.TypesEnum.ReceivedManagerPending) { if (DB_Functions.ManagerApprove(document.Panel0.Id)) { viewModel = new SuccessData() { Heading = "FRD has been approved successfully", PrimaryParagraph = "the active FRD submitted has been approved successfully!", SecondaryParagraph = "The FRD has now been forwarded to the appropriate employees", LastParagraph = "You can continue viewing this FRD on the 'RECEIVED REQUESTS' page", ButtonText = "GO TO the RECEIVED REQUESTS page", ButtonLink = "request/receivedM" }; ViewBag.helpMessage = "No Information. \n"; return(View("Success", viewModel)); } else { } } else { if (DB_Functions.User_Approve(document.Panel0.Id)) { viewModel = new SuccessData() { Heading = "FRD has been approved successfully", PrimaryParagraph = "the active FRD submitted has been approved successfully!", SecondaryParagraph = "The FRD has now been forwarded to the appropriate employees", LastParagraph = "You can continue viewing this FRD on the 'RECEIVED REQUESTS' page", ButtonText = "GO TO the RECEIVED REQUESTS page", ButtonLink = "request/receivedU" }; ViewBag.helpMessage = "No Information. \n"; return(View("Success", viewModel)); } else { } } break; //submit UPDATES, frd id & list of comments are given back case Frd.ButtonsEnum.Submit: if (DB_Functions.SubmitReceiverUpdate(document)) { viewModel = new SuccessData() { Heading = "FRD updates have been submitted successfully", PrimaryParagraph = "The active FRD has been updated successfully!", SecondaryParagraph = "The appropriate employees have now received your updated version", LastParagraph = "The updated FRD can still be found in the 'Received Requests' page.", ButtonText = "GO TO RECEIVED REQUESTS", ButtonLink = "Request/ReceivedU" }; ViewBag.helpMessage = "No Information. \n"; return(View("Success", viewModel)); } else { return(RedirectToAction("ReceivedFrd", new { id = document.Panel0.Hashed_Id, error = "Changes have to be made in order to submit an updated version of the FRD" })); } default: break; } return(null); }