From f3130d1f8900a8b5a847d0c817e153fc033c8e58 Mon Sep 17 00:00:00 2001 From: jnunez Date: Thu, 28 Jun 2018 17:44:24 +0000 Subject: [PATCH] git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C137 --- .../Controllers/AccountController.cs | 2 +- .../AYA.SlnSynor.Mantenimientos/Web.config | 32 +- AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs | 4 + AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs | 34 ++ .../AYA.SlnSynor/AYA.SlnSinort.csproj | 24 +- .../AYA.SlnSynor/App_Start/BundleConfig.cs | 9 +- .../Controllers/BaseController.cs | 2 + .../FileUploadHandler/FileUploadHandler.ashx | 1 + .../FileUploadHandler.ashx.cs | 104 +++++++ .../AYA.SlnSynor/Sinort-Scripts/Global.js | 1 + .../PropuestaNormativa/PropuestaNormativa.js | 291 +++++++++++++++++- .../Views/Account/ConfirmEmail.cshtml | 10 + .../Account/ExternalLoginConfirmation.cshtml | 36 +++ .../Views/Account/ExternalLoginFailure.cshtml | 8 + .../Views/Account/ForgotPassword.cshtml | 29 ++ .../Account/ForgotPasswordConfirmation.cshtml | 13 + .../AYA.SlnSynor/Views/Account/Login.cshtml | 63 ++++ .../Views/Account/Register.cshtml | 41 +++ .../Views/Account/ResetPassword.cshtml | 42 +++ .../Account/ResetPasswordConfirmation.cshtml | 12 + .../Views/Account/SendCode.cshtml | 24 ++ .../Views/Account/VerifyCode.cshtml | 38 +++ .../Account/_ExternalLoginsListPartial.cshtml | 28 ++ .../Views/Catalogos/EmisorPN.cshtml | 2 +- .../Normativa_Reglamentacion_Tecnica.cshtml | 5 +- .../Views/PropuestaNormativa/Index.cshtml | 117 ++++++- .../AYA.SlnSynor/Views/Shared/_Layout.cshtml | 2 + AYA.SlnSynor/AYA.SlnSynor/Views/Web.config | 7 + AYA.SlnSynor/AYA.SlnSynor/Web.config | 35 +++ .../AYA.SlnSynorModel/Entidades/Json.cs | 9 + .../AYA.SlnSynorModel/Sinort/SinortContex.cs | 1 + 31 files changed, 1007 insertions(+), 19 deletions(-) create mode 100644 AYA.SlnSynor/AYA.SlnSynor/FileUploadHandler/FileUploadHandler.ashx create mode 100644 AYA.SlnSynor/AYA.SlnSynor/FileUploadHandler/FileUploadHandler.ashx.cs create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/ConfirmEmail.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/ExternalLoginConfirmation.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/ExternalLoginFailure.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/ForgotPassword.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/ForgotPasswordConfirmation.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/Login.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/Register.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/ResetPassword.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/ResetPasswordConfirmation.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/SendCode.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/VerifyCode.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Account/_ExternalLoginsListPartial.cshtml diff --git a/AYA.SlnSynor/AYA.SlnSynor.Mantenimientos/Controllers/AccountController.cs b/AYA.SlnSynor/AYA.SlnSynor.Mantenimientos/Controllers/AccountController.cs index 7594ea5f9..705a9c7c3 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.Mantenimientos/Controllers/AccountController.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.Mantenimientos/Controllers/AccountController.cs @@ -57,7 +57,7 @@ namespace AYA.SlnSinort.Mantenimientos.Controllers [AllowAnonymous] public ActionResult Login(string returnUrl) { - ViewBag.ReturnUrl = returnUrl; + //ViewBag.ReturnUrl = returnUrl; return View(); } diff --git a/AYA.SlnSynor/AYA.SlnSynor.Mantenimientos/Web.config b/AYA.SlnSynor/AYA.SlnSynor.Mantenimientos/Web.config index 60e4e74bb..ab658b0a0 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.Mantenimientos/Web.config +++ b/AYA.SlnSynor/AYA.SlnSynor.Mantenimientos/Web.config @@ -1,4 +1,4 @@ - + + + - + + + + + + + + + - + + + + + + + + + + diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs index e7154e73b..f5aa6fea6 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs @@ -29,7 +29,11 @@ namespace AYA.SlnSinort.WCF [OperationContract] ProyectoNormativoJSON GuardarComentarioProyectoNormativo(ProyectoNormativoJSON model); + //[OperationContract] //ProyectoNormativoJSON EliminarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model); + + [OperationContract] + AdjuntosJSON RemoverAdjunto(AdjuntosJSON model); } } diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs index 677861253..3123eb486 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Data; using System.DirectoryServices; using System.DirectoryServices.ActiveDirectory; +using System.IO; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; @@ -223,5 +224,38 @@ namespace AYA.SlnSinort.WCF return respuesta; } #endregion + + #region Adjuntos + + public AdjuntosJSON RemoverAdjunto(AdjuntosJSON model) + { + + string Serverpath = HttpContext.Current.Server.MapPath("DocumentosSINORT"); + Serverpath += "\\" + model.Carpeta; + try + { + string file; + string fileDirectory = Serverpath; + file = model.Nombre.Replace(" ", "_"); + fileDirectory = fileDirectory + "\\" + file; + if (File.Exists(fileDirectory)) + { + File.Delete(fileDirectory); + } + + } + catch (Exception ex) + { + log.Error(ex); + model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + } + return model; + } + + + #endregion + + + } } diff --git a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj index 136b547da..9e11abbe4 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj +++ b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj @@ -196,6 +196,9 @@ + + FileUploadHandler.ashx + Global.asax @@ -7592,6 +7595,7 @@ + @@ -7688,14 +7692,18 @@ - + + Designer + Web.config Web.config - + + Designer + @@ -7724,6 +7732,18 @@ + + + + + + + + + + + + diff --git a/AYA.SlnSynor/AYA.SlnSynor/App_Start/BundleConfig.cs b/AYA.SlnSynor/AYA.SlnSynor/App_Start/BundleConfig.cs index 56e41b8a0..7e226e1fa 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/App_Start/BundleConfig.cs +++ b/AYA.SlnSynor/AYA.SlnSynor/App_Start/BundleConfig.cs @@ -22,7 +22,11 @@ namespace AYA.SlnSinort bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap.min.js")); bundles.Add(new ScriptBundle("~/bundles/moment").Include("~/Scripts/moment.js").Include("~/Scripts/moment-with-langs.js")); bundles.Add(new ScriptBundle("~/bundles/toastr").Include("~/Scripts/toastr.js")); - bundles.Add(new ScriptBundle("~/bundles/jquery-dataTables").Include("~/Scripts/DataTables-1.10.0/jquery.dataTables.min.js")); + bundles.Add(new ScriptBundle("~/bundles/jquery-dataTables").Include("~/Scripts/DataTables-1.10.0/jquery.dataTables.js")); + bundles.Add(new ScriptBundle("~/bundles/jquery-fileupload") + .Include("~/Scripts/jQuery.FileUpload/jquery.fileupload.js") + .Include("~/Scripts/jQuery.FileUpload/jquery.fileupload-process.js") + .Include("~/Scripts/jQuery.FileUpload/jquery.fileupload-validate.js")); bundles.Add(new ScriptBundle("~/bundles/timepicki").Include("~/Scripts/timepicki.js")); bundles.Add(new StyleBundle("~/Content/css") @@ -45,7 +49,8 @@ namespace AYA.SlnSinort bundles.Add(new StyleBundle("~/Content/sinort-css") .Include("~/Content/themes/base/jquery.ui.css") .Include("~/Content/toastr.css") - .Include("~/Content/DataTables-1.10.0/css/jquery.dataTables.css")); + .Include("~/Content/DataTables-1.10.0/css/jquery.dataTables.css") + .Include("~/Content/jQuery.FileUpload/css/jquery.fileupload.css")); bundles.Add(new ScriptBundle("~/Script-Global") .Include("~/Sinort-Scripts/ROTn.js") diff --git a/AYA.SlnSynor/AYA.SlnSynor/Controllers/BaseController.cs b/AYA.SlnSynor/AYA.SlnSynor/Controllers/BaseController.cs index 8ef2ce1ee..f15859c3c 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Controllers/BaseController.cs +++ b/AYA.SlnSynor/AYA.SlnSynor/Controllers/BaseController.cs @@ -21,10 +21,12 @@ namespace AYA.SlnSinort.Controllers //parametros.GetValueKeyRegedit("SinortWCF", false); var SinortCatalogosWCF = "http://localhost/AYA.SlnSinort.WCF/SinortCatalogos.svc"; //parametros.GetValueKeyRegedit("SinortCatalogosWCF",false); + var Adjuntos = "http://localhost/AYA.SlnSinort/FileUploadHandler"; ViewBag.SinortWCF = SinortWCF; ViewBag.SinortCatalogosWCF = SinortCatalogosWCF; ViewBag.AtesaUser = User.Identity.GetUserName(); + ViewBag.AdjuntosDoc = Adjuntos; } } } \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/FileUploadHandler/FileUploadHandler.ashx b/AYA.SlnSynor/AYA.SlnSynor/FileUploadHandler/FileUploadHandler.ashx new file mode 100644 index 000000000..a68c3425a --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/FileUploadHandler/FileUploadHandler.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="C#" CodeBehind="FileUploadHandler.ashx.cs" Class="webAgenciaVirtual.FileUploadHandler" %> diff --git a/AYA.SlnSynor/AYA.SlnSynor/FileUploadHandler/FileUploadHandler.ashx.cs b/AYA.SlnSynor/AYA.SlnSynor/FileUploadHandler/FileUploadHandler.ashx.cs new file mode 100644 index 000000000..fb30a6883 --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/FileUploadHandler/FileUploadHandler.ashx.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Configuration; +using System.IO; +using System.Web.Script.Serialization; + +namespace webAgenciaVirtual +{ + /// + /// Descripción breve de FileUploadHandler + /// + public class FileUploadHandler : IHttpHandler + { + + public void ProcessRequest(HttpContext context) + { + try + { + if (context.Request.QueryString["carpeta"] != null) + { + string pathrefer = context.Request.UrlReferrer.ToString(); + string Serverpath = HttpContext.Current.Server.MapPath("DocumentosSINORT"); + Serverpath += "\\" + context.Request.QueryString["carpeta"].ToString(); + + var postedFile = context.Request.Files[0]; + string ext = Path.GetExtension(postedFile.FileName); + //if (ext == ".pdf" || ext == ".PDF") + //{ + string file; + + //For IE to get file name + if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE") + { + string[] files = postedFile.FileName.Split(new char[] { '\\' }); + file = files[files.Length - 1].Replace(" ","_"); + } + else + { + file = postedFile.FileName.Replace(" ", "_"); + } + + + if (!Directory.Exists(Serverpath)) + Directory.CreateDirectory(Serverpath); + + string fileDirectory = Serverpath; + if (context.Request.QueryString["fileName"] != null) + { + file = context.Request.QueryString["fileName"].Replace(" ", "_"); + if (File.Exists(fileDirectory + "\\" + file)) + { + File.Delete(fileDirectory + "\\" + file); + } + } + + //string ext = Path.GetExtension(fileDirectory + "\\" + file); + //file = Guid.NewGuid() + ext; + + fileDirectory = Serverpath + "\\" + file; + + postedFile.SaveAs(fileDirectory); + + context.Response.AddHeader("Vary", "Accept"); + try + { + if (context.Request["HTTP_ACCEPT"].Contains("application/json")) + context.Response.ContentType = "application/json"; + else + context.Response.ContentType = "text/plain"; + } + catch + { + context.Response.ContentType = "text/plain"; + } + + //context.Response.Write("Success"); + context.Response.ContentType = "text/plain"; + context.Response.Write(file); + return; + //} + //else + //{ + // context.Response.Write("errorEXT"); + // return; + //} + } + } + catch (Exception exp) + { + context.Response.Write(exp.Message); + } + } + + public bool IsReusable + { + get + { + return false; + } + } + } +} \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js index d09c3c9d0..269ed9979 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Global.js @@ -1,5 +1,6 @@ var CatalogosWCF = $("#hiddenSinortCatalogosWCF").val(); var SinortWCF = $("#hiddenSinortWCF").val(); +var AdjuntosDoc = $("#hiddenAdjuntos").val(); var server = window.location.protocol + "//" + window.location.hostname + "/" + (window.location.pathname.split('/')[1]) + "/"; var string_empty = ""; var Atesa = {}; diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/PropuestaNormativa.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/PropuestaNormativa.js index 8c13c091f..0e9c3b41b 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/PropuestaNormativa.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/PropuestaNormativa.js @@ -1,10 +1,11 @@ var SelectedCatalog = ''; var model = {}; - +var Nombre; jQuery(document).ready(function () { - + getDataModel(); - + + }); this.getDataModel = function () { @@ -74,6 +75,14 @@ this.getDataModel = function () { $("#txtFechaInicio").datepicker(); $("#txtFechaFinalizacion").datepicker(); $("#txtFechaMaximaConfirmarParticipacion").datepicker(); + + $("#btnAdjuntar").unbind("click"); + $('#btnAdjuntar').click(function () { + AbrirAdjuntos(); + }); + + + } this.CargarEmisor = function (filtro) { @@ -377,4 +386,278 @@ this.EnviarCorreo = function () { AjaxPostData(uri, model, false, false, null, null, null); ENDREQUEST(); -} \ No newline at end of file +} + +this.AbrirAdjuntos = function () { + $('#modalAdjuntos').modal('show'); +} + + + +//$(function () { +// 'use strict'; +// // Change this to the location of your server-side upload handler: +// var url = '', +// uploadButton = $(' + } +

+ + } + } +} diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/EmisorPN.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/EmisorPN.cshtml index 9c25007e2..a0a6b19cb 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/EmisorPN.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/EmisorPN.cshtml @@ -57,7 +57,7 @@ @*Descripción*@ - +
diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Home/Normativa_Reglamentacion_Tecnica.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Home/Normativa_Reglamentacion_Tecnica.cshtml index 514da952e..78a3795fd 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Home/Normativa_Reglamentacion_Tecnica.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Home/Normativa_Reglamentacion_Tecnica.cshtml @@ -6,10 +6,11 @@
-
+ @*
-
+
*@ +
diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/PropuestaNormativa/Index.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/PropuestaNormativa/Index.cshtml index 2b69e9518..9dbc5533d 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/PropuestaNormativa/Index.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/PropuestaNormativa/Index.cshtml @@ -127,7 +127,9 @@ - +
@@ -321,6 +323,119 @@   Remover + + +@*---------------------Adjuntos---------------------------------------------------------*@ + + + } @section scripts{ diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml index c6f2a5a7d..dfb6b700f 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml @@ -40,6 +40,7 @@ @Scripts.Render("~/bundles/toastr") @Scripts.Render("~/bundles/jquery-dataTables") @Scripts.Render("~/bundles/bootstrap-switch") + @Scripts.Render("~/bundles/jquery-fileupload") @* Seccion futuros scripts *@