Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @using (Html.BeginForm("Index", "Certificates", FormMethod.Post, new { }))
- {
- {
- VAILCertificates.DAL.Entities.User Users = (VAILCertificates.DAL.Entities.User)Session["User"];
- if (Users.UserGroupID == 1 || Users.UserRoleName == "admin")
- {
- @Html.Label("Clients", htmlAttributes: new { @class = "control-label col-md-1" })
- @Html.DropDownListFor(model => model.SearchInspectionReport.Client_ID, new SelectList(ViewBag.ClientsList, "ID", "Name"),
- "-Select-",
- new { @class = "form-control" })
- }
- }
- <table id="tblCertificates" style="width:100%" class="table table-bordered table-hover mt-2">
- <thead>
- <tr class="GridHeading">
- <td>Certification No.</td>
- <td>File Name</td>
- <td>Issue Date</td>
- <td>Details</td>
- <td>Client</td>
- <td>Workshop</td>
- <td>Added By</td>
- <td>Office</td>
- <td>Station</td>
- <td>File</td>
- </tr>
- </thead>
- <tbody>
- @foreach (var certificate in this.Model.CertificatesList)
- {
- <tr>
- <td>@certificate.CertificationNo</td>
- <td>@certificate.FileName</td>
- <td>@certificate.IssueDate</td>
- <td>@certificate.Details</td>
- <td>@certificate.Client</td>
- <td>@certificate.Workshop</td>
- <td>@certificate.UserName</td>
- <td>@certificate.Office</td>
- <td>@certificate.Station</td>
- <td class="text-center">
- @*<a href="../Downloads/Certificates/@certificate.FileName" target="_blank">
- <i class="fa fa-file-text"></i>
- </a>*@
- <button class="btn btn-info btn-sm" type="submit" id="btnReview" name="btnDownload" formaction='@Url.Action("GetInspectionReportDetails", "InspectionReport", new { InspectionReportID = @certificate.InspectionReportID})'>Download</button>
- </td>
- </tr>
- }
- </tbody>
- </table>
- CertificatesDAL certificatesDAL;
- [HttpGet]
- public ActionResult Index()
- {
- User userSession = (User)Session["User"];
- if (userSession == null || userSession.UserType == (int) UserTypes.RedirectedFromCTR)
- {
- return RedirectToAction("Login", "Home");
- }
- certificatesDAL = new CertificatesDAL();
- CertificatesViewModel certificatesViewModel = new CertificatesViewModel();
- VAILCertificates.DAL.Entities.User user = new User();
- VAILCertificates.DAL.UserDAL userDAL = new DAL.UserDAL();
- user = userDAL.ValidateUser(userSession.UserName, userSession.Password);
- if (user != null)
- {
- certificatesViewModel.CertificatesList = certificatesDAL.GetCertificatesListFiltered("", user.ClientName, (user.UserGroupID == 1 || user.UserRoleName == "admin" || user.UserRoleName == "Admin") ? true : false); // 1 = admin
- }
- ClientsDAL clientsDAL = new ClientsDAL();
- ViewBag.ClientsList = clientsDAL.GetClientsList();
- //List<Certificates> l= certificatesDAL.GetClientsList();
- return View(certificatesViewModel);
- }
- <script type="text/javascript">
- $('#tblCertificates').DataTable({
- responsive: true,
- searching: true,
- ordering: false,
- });
- $("#SearchInspectionReport_Client_ID").change(function () {
- var ID = $("#SearchInspectionReport_Client_ID").val(); //Client ID
- data = { 'ID': ID } //Client ID
- table = $("#tblCertificates").DataTable();
- $('#tblCertificates tbody').empty()
- $.get("/CertificatesNew/FillCertificates", data);
- });
- </script>
- }
- [HttpGet]
- [OutputCache(NoStore = true, Duration = 0)]
- public ActionResult FillCertificates(int ID)
- {
- InspectionReportsViewModel InspectionReportsViewModel = new InspectionReportsViewModel();
- try
- {
- InspectionReportDAL InspectionReportDAL = new DAL.InspectionReportDAL();
- InspectionReportsViewModel.InspectionReportList = InspectionReportDAL.GetInspectionReportListFilteredByClientID(ID);
- ClientsDAL clientsDAL = new ClientsDAL();
- ViewBag.ClientsList = clientsDAL.GetClientsList();
- return View("Index", InspectionReportsViewModel);
- }
- catch
- {
- return View();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement