git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C6
This commit is contained in:
jnunez 2018-06-06 18:21:49 +00:00
parent a8016807af
commit 234836db75
21 changed files with 273 additions and 165 deletions

View file

@ -63,15 +63,20 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="Service1.svc" />
<Content Include="Sinort.svc" />
<Content Include="SinortCatalogos.svc" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Service1.svc.cs">
<DependentUpon>Service1.svc</DependentUpon>
<Compile Include="ISinortCatalogos.cs" />
<Compile Include="Sinort.svc.cs">
<DependentUpon>Sinort.svc</DependentUpon>
</Compile>
<Compile Include="IService1.cs" />
<Compile Include="ISinort.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SinortCatalogos.svc.cs">
<DependentUpon>SinortCatalogos.svc</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
@ -84,6 +89,16 @@
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AYA.SlnSynorModel.DAL\AYA.SlnSynorModel.DAL.csproj">
<Project>{6188d201-ec99-47f0-bcd5-5c48ec354cd5}</Project>
<Name>AYA.SlnSynorModel.DAL</Name>
</ProjectReference>
<ProjectReference Include="..\AYA.SlnSynorModel\AYA.SlnSynorModel.csproj">
<Project>{9ecd985b-2354-4156-ad6a-3ebd888c0241}</Project>
<Name>AYA.SlnSynorModel</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View file

@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace AYA.SlnSynor.WCF
{
// NOTA: puede usar el comando "Rename" del menú "Refactorizar" para cambiar el nombre de interfaz "IService1" en el código y en el archivo de configuración a la vez.
[ServiceContract]
public interface IService1
{
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite);
// TODO: agregue aquí sus operaciones de servicio
}
// Utilice un contrato de datos, como se ilustra en el ejemplo siguiente, para agregar tipos compuestos a las operaciones de servicio.
[DataContract]
public class CompositeType
{
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue
{
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
public string StringValue
{
get { return stringValue; }
set { stringValue = value; }
}
}
}

View file

@ -0,0 +1,20 @@
using AYA.SlnSynorModel.BD;
using AYA.SlnSynorModel.Entidades;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace AYA.SlnSynor.WCF
{
// NOTA: puede usar el comando "Rename" del menú "Refactorizar" para cambiar el nombre de interfaz "ISinort" en el código y en el archivo de configuración a la vez.
[ServiceContract]
public interface ISinort
{
}
}

View file

@ -0,0 +1,22 @@
using AYA.SlnSynorModel.BD;
using AYA.SlnSynorModel.Constantes;
using AYA.SlnSynorModel.DAL.Catalogos;
using AYA.SlnSynorModel.Entidades;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace AYA.SlnSynor.WCF
{
[ServiceContract]
public interface ISinortCatalogos
{
[OperationContract]
EmisorPNJSON ObtenerEmisoresPN(EmisorPN model);
}
}

View file

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace AYA.SlnSynor.WCF
{
// NOTA: puede usar el comando "Rename" del menú "Refactorizar" para cambiar el nombre de clase "Service1" en el código, en svc y en el archivo de configuración.
// NOTE: para iniciar el Cliente de prueba WCF para probar este servicio, seleccione Service1.svc o Service1.svc.cs en el Explorador de soluciones e inicie la depuración.
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}
}

View file

@ -1 +1 @@
<%@ ServiceHost Language="C#" Debug="true" Service="AYA.SlnSynor.WCF.Service1" CodeBehind="Service1.svc.cs" %>
<%@ ServiceHost Language="C#" Debug="true" Service="AYA.SlnSynor.WCF.Sinort" CodeBehind="Sinort.svc.cs" %>

View file

@ -0,0 +1,19 @@
using AYA.SlnSynorModel.BD;
using AYA.SlnSynorModel.Constantes;
using AYA.SlnSynorModel.Entidades;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace AYA.SlnSynor.WCF
{
public class Sinort : ISinort
{
}
}

View file

@ -0,0 +1 @@
<%@ ServiceHost Language="C#" Debug="true" Service="AYA.SlnSynor.WCF.SinortCatalogos" CodeBehind="SinortCatalogos.svc.cs" %>

View file

@ -0,0 +1,65 @@
using AYA.SlnSynorModel.BD;
using AYA.SlnSynorModel.Constantes;
using AYA.SlnSynorModel.DAL.Catalogos;
using AYA.SlnSynorModel.Entidades;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace AYA.SlnSynor.WCF
{
public class SinortCatalogos : ISinortCatalogos
{
public EmisorPNJSON ObtenerEmisoresPN(EmisorPN model)
{
EmisorPNJSON respuesta = new EmisorPNJSON();
try
{
using (CatalogosDAL DAL = new CatalogosDAL())
{
respuesta.ListaEmisores = DAL.ObtnerEmisorPN(model);
respuesta.CodigoRespuesta = EnumRespuesta.EXITOSO;
}
}
catch (Exception ex)
{
respuesta.CodigoRespuesta = EnumRespuesta.FALLIDO;
}
return respuesta;
}
public EmisorPNJSON InsertarEmisorPN(EmisorPN model)
{
EmisorPNJSON respuesta = new EmisorPNJSON();
try
{
using (CatalogosDAL DAL = new CatalogosDAL())
{
DAL.InsertarActualizarEmisorPN(model);
respuesta.CodigoRespuesta = EnumRespuesta.EXITOSO;
}
}
catch (Exception ex)
{
respuesta.CodigoRespuesta = EnumRespuesta.FALLIDO;
}
return respuesta;
}
}
}

View file

@ -11,17 +11,58 @@
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- Para evitar revelar información de los metadatos, establezca los valores siguientes en false antes de la implementación -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- Para recibir detalles de las excepciones en los fallos, con el fin de poder realizar la depuración, establezca el valor siguiente en true. Para no revelar información sobre las excepciones, establézcalo en false antes de la implementación -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="SOAPBehavior" />
<behavior name="JSONBehavior">
<webHttp />
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
</protocolMapping>
<bindings>
<wsHttpBinding>
<binding name="SOAPBinding" closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00" sendTimeout="00:50:00" bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="false" allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
<webHttpBinding>
<binding name="JSONBinding" closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00" sendTimeout="00:50:00" allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="true" contentTypeMapper="">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="AYA.SlnSynor.WCF.SinortCatalogos">
<endpoint address="soap" behaviorConfiguration="SOAPBehavior" binding="wsHttpBinding" bindingConfiguration="SOAPBinding" contract="AYA.SlnSynor.WCF.ISinortCatalogos" />
<endpoint address="api" behaviorConfiguration="JSONBehavior" binding="webHttpBinding" bindingConfiguration="JSONBinding" contract="AYA.SlnSynor.WCF.ISinortCatalogos" />
</service>
<service name="AYA.SlnSynor.WCF.Sinort">
<endpoint address="soap" behaviorConfiguration="SOAPBehavior" binding="wsHttpBinding" bindingConfiguration="SOAPBinding" contract="AYA.SlnSynor.WCF.ISinort" />
<endpoint address="api" behaviorConfiguration="JSONBehavior" binding="webHttpBinding" bindingConfiguration="JSONBinding" contract="AYA.SlnSynor.WCF.ISinort" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>

View file

@ -16,7 +16,7 @@
<AssemblyName>AYA.SlnSynor</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
@ -182,6 +182,7 @@
<Compile Include="App_Start\Startup.Auth.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\BaseController.cs" />
<Compile Include="Controllers\Catalogos\CatalogosController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ManageController.cs" />
@ -8087,6 +8088,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Views\Base\" />
<Folder Include="Views\CatalogosController\" />
</ItemGroup>
<ItemGroup>
@ -8127,7 +8129,7 @@
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7944</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7944/</IISUrl>
<IISUrl>http://localhost/AYA.SlnSynor</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>

View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;
namespace AYA.SlnSynor.Controllers
{
public class BaseController : Controller
{
public void InitControllers()
{
var SinortWCF = ConfigurationManager.AppSettings["SinortWCF"];
var SinortCatalogosWCF = ConfigurationManager.AppSettings["SinortCatalogosWCF"];
ViewBag.SinortWCF = SinortWCF;
ViewBag.SinortCatalogosWCF = SinortCatalogosWCF;
}
}
}

View file

@ -1,7 +1,4 @@
using AYA.SlnSynorModel.BD;
using AYA.SlnSynorModel.Constantes;
using AYA.SlnSynorModel.Entidades;
using AYA.SlnSynorModel.DAL.Normativa;
using System;
using System.Collections.Generic;
using System.Linq;
@ -10,38 +7,13 @@ using System.Web.Mvc;
namespace AYA.SlnSynor.Controllers.Catalogos
{
public class CatalogosController : Controller
public class CatalogosController : BaseController
{
// GET: Catalogos
public ActionResult EmisorPN()
{
InitControllers();
return View();
}
CatalogosDAL DAL = new CatalogosDAL();
public ActionResult InsertarEmisorPN(EmisorPN model)
{
DAL.InsertarActualizarEmisorPN(model);
return Json(EnumRespuesta.EXITOSO, JsonRequestBehavior.AllowGet);
}
public JsonResult ObtenerEmisorPN(EmisorPN model)
{
EmisorPNJSON respuesta = new EmisorPNJSON();
try
{
respuesta.ListaEmisores = DAL.ObtnerEmisorPN(model);
respuesta.CodigoRespuesta = EnumRespuesta.EXITOSO;
}
catch (Exception ex)
{
respuesta.CodigoRespuesta = EnumRespuesta.FALLIDO;
}
return Json(respuesta, JsonRequestBehavior.AllowGet);
}
}
}

View file

@ -6,10 +6,11 @@ using System.Web.Mvc;
namespace AYA.SlnSynor.Controllers
{
public class HomeController : Controller
public class HomeController : BaseController
{
public ActionResult Index()
{
InitControllers();
return View();
}

View file

@ -140,7 +140,7 @@ function IniciarGridEmisoresPN(data) {
}
function ObtenerEmisoresPN(filtro) {
var uri = '/Catalogos/ObtenerEmisorPN';
var uri = CatalogosWCF + '/api/ObtenerEmisoresPN';
var DTO = JSON.stringify(filtro);
$.ajax({
type: 'POST',

View file

@ -1,4 +1,7 @@
function Mensajes(mensaje) {
var CatalogosWCF = $("#hiddenSinortCatalogosWCF").val();
var SinortWCF = $("#hiddenSinortWCF").val();
function Mensajes(mensaje) {
if (mensaje.CodigoRespuesta === "1") {
toastr.options = {
"closeButton": true,

View file

@ -221,7 +221,7 @@
<li><a href="#">Compra de </br> documento técnico</a></li>
<li><a href="#">Modificación de </br> documento técnico</a></li>
<li><a href="#">Solicitudes de </br> compras abiertas</a></li>
<li><a href="@Url.Action("Configuracion_Aplicacion", "Normativa_Reglamentacion_Tecnica")"> Configuración de la </br> aplicación</a></li>
<li><a href="@Url.Action("EmisorPN", "Catalogos")"> Configuración de la </br> aplicación</a></li>
<li><a href="#">Encuestas</a></li>
</ul>
@ -393,6 +393,8 @@
<div class="control-sidebar-bg"></div>
</div>
<input type="hidden" id="hiddenSinortWCF" value="@ViewBag.SinortWCF"/>
<input type="hidden" id="hiddenSinortCatalogosWCF" value="@ViewBag.SinortCatalogosWCF" />
</body>

View file

@ -19,6 +19,8 @@
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="SinortWCF" value="http://localhost/AYA.SlnSynor.WCF/Sinort.svc"/>
<add key="SinortCatalogosWCF" value="http://localhost/AYA.SlnSynor.WCF/SinortCatalogos.svc"/>
</appSettings>
<system.web>
<authentication mode="None" />

View file

@ -52,7 +52,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Normativa\CatalogosDAL.cs" />
<Compile Include="Catalogos\CatalogosDAL.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

View file

@ -0,0 +1,43 @@
using AYA.SlnSynorModel.BD;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AYA.SlnSynorModel.DAL.Catalogos
{
public class CatalogosDAL : IDisposable
{
public string InsertarActualizarEmisorPN(EmisorPN model)
{
using (SinortContext db = new SinortContext())
{
model.fecha_creacion = System.DateTime.Now;
model.usuario_creacion = "prueba";
db.EmisorPN.Add(model);
db.SaveChanges();
db.Commit();
}
return null;
}
public List<EmisorPN> ObtnerEmisorPN(EmisorPN model)
{
List<EmisorPN> ListaEmisores = new List<EmisorPN>();
using (SinortContext db = new SinortContext())
{
ListaEmisores = db.EmisorPN.ToList();
}
return ListaEmisores;
}
public void Dispose()
{
throw new NotImplementedException();
}
}
}

View file

@ -1,41 +0,0 @@
using AYA.SlnSynorModel.BD;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AYA.SlnSynorModel.DAL.Normativa
{
public class CatalogosDAL
{
public string InsertarActualizarEmisorPN(EmisorPN model)
{
using (SinortContext db = new SinortContext())
{
model.fecha_creacion = System.DateTime.Now;
model.usuario_creacion = "prueba";
db.EmisorPN.Add(model);
db.SaveChanges();
db.Commit();
}
return null;
}
public List<EmisorPN> ObtnerEmisorPN(EmisorPN model)
{
List<EmisorPN> ListaEmisores = new List<EmisorPN>();
using (SinortContext db = new SinortContext())
{
ListaEmisores = db.EmisorPN.ToList();
}
return ListaEmisores;
}
}
}