Commit inicial Ventas Productivo
This commit is contained in:
139
Ecommerce/Insignias.aspx
Normal file
139
Ecommerce/Insignias.aspx
Normal file
@@ -0,0 +1,139 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Insignias.aspx.vb" Inherits="Ecommerce_Insignias" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
<link href="/Metronic/assets/global/plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Styles/Ecommerce.css" rel="stylesheet" />
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Catalogo de Insignias
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
<asp:UpdatePanel ID="UpAcciones" UpdateMode="Conditional" runat="server">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LBAgregar" OnClick="LBAgregar_Click" runat="server"> <i class="fa fa-plus"></i> Agregar Insignia</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LBBitacora" OnClick="LBBitacora_Click" runat="server"><i class="fa fa-stack-overflow"></i> Bitacora</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:GridView ID="GvDatos" DataKeyNames="CveInsignia,Insignia,Color" CssClass="table table-hover table-striped ScrollAD mysmallbtn" EmptyDataText="No se encontraron registros..." ShowHeaderWhenEmpty="true" data-sort="true" Width="100%" runat="server" GridLines="None" AutoGenerateColumns="False">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Insignia" DataField="Insignia" ItemStyle-Width="20%" />
|
||||
<asp:BoundField HeaderText="Color" DataField="Color" ItemStyle-Width="10%" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="FechaIng" ItemStyle-Width="10%" DataFormatString="{0:d}" />
|
||||
<asp:BoundField HeaderText="Usuario" DataField="Usuario" ItemStyle-Width="20%" />
|
||||
<asp:BoundField HeaderText="Fecha Modificó" DataField="FechaModifico" ItemStyle-Width="10%" DataFormatString="{0:d}" />
|
||||
<asp:BoundField HeaderText="Usuario Modificó" DataField="UsuarioModifico" ItemStyle-Width="20%" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" HeaderText="Comandos">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LBEditar" CausesValidation="False" OnClick="LBEditar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" runat="server" />
|
||||
<asp:LinkButton ID="LBEliminar" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" ToolTip="¿Está seguro que desea eliminar el registro?" data-btn-ok-label="si" runat="server" />
|
||||
<%--<asp:LinkButton ID="LBEditar" data-toggle="tooltip" title="Editar" OnClick="LnkEditar_Click" CssClass="btn btn-circle btn-sm green" runat="server" Text="<i class='fa fa-pencil'></i>"></asp:LinkButton>--%>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<%--AGREGAR--%>
|
||||
<div id="ModalAgregar" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel ID="UpAgregar" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LtAgregarTitulo" Text="Agregar" runat="server" />
|
||||
Insignia
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-group-no-margin">
|
||||
<label for="<%=TxtInsignia.ClientID.ToString()%>">Insignia:</label>
|
||||
<asp:TextBox ID="TxtInsignia" Text="" MaxLength="50" CssClass="form-control input-sm" runat="server" />
|
||||
<asp:RequiredFieldValidator ID="RFVInsignia" ControlToValidate="TxtInsignia" ValidationGroup="GrpAgregar" ErrorMessage="El campo <b>''Insignia''</b> es necesario, por favor ingréselo." CssClass="help-block text-danger" runat="server"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="<%=TxtColor.ClientID.ToString()%>">Color:</label>
|
||||
<div id="color" class="input-group colorpicker-component">
|
||||
<asp:TextBox ID="TxtColor" Text="" MaxLength="7" CssClass="form-control input-sm" runat="server" />
|
||||
<span class="input-group-addon"><i></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="CancelarAgregar" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<asp:Button Text="Insignia" ID="BtnAgregar" OnClick="BtnAgregar_Click" CssClass="btn btn-primary" ValidationGroup="GrpAgregar" runat="server" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
<%--BITACORA--%>
|
||||
<div id="ModalBitacora" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel ID="UpBitacora" class="modal-dialog modal-lg rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Bitacora</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:GridView ID="GvBitacora" CssClass="table table-hover table-striped ScrollAD mysmallbtn" EmptyDataText="No se encontraron registros..." ShowHeaderWhenEmpty="true" data-sort="true" Width="100%" runat="server" GridLines="None" AutoGenerateColumns="False">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Fecha" DataField="FechaIng" ItemStyle-Width="20%" />
|
||||
<asp:BoundField HeaderText="Usuario" DataField="Usuario" ItemStyle-Width="20%" />
|
||||
<asp:BoundField HeaderText="Descripción" DataField="Bitacora" ItemStyle-Width="60%" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="CancelarBitacora" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="/Metronic/assets/global/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js" type="text/javascript"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
InicializaColorPicker();
|
||||
});
|
||||
|
||||
function InicializaColorPicker() {
|
||||
$('#color').colorpicker({
|
||||
format: "hexa"
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
207
Ecommerce/Insignias.aspx.vb
Normal file
207
Ecommerce/Insignias.aspx.vb
Normal file
@@ -0,0 +1,207 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Ecommerce_Insignias
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region " PROPIEDADES "
|
||||
''' <summary>
|
||||
''' Define la modalidad de la entidad para el modal
|
||||
''' [False = Add]
|
||||
''' [True = Update]
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Private Property Modalidad As Boolean
|
||||
Get
|
||||
Return CType(ViewState("Modalidad"), Boolean)
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("Modalidad") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveInsignia As Integer
|
||||
Get
|
||||
Return ViewState("CveInsignia").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveInsignia") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
InicializaValores()
|
||||
CargaDatos()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub InicializaValores()
|
||||
CveInsignia = -1
|
||||
End Sub
|
||||
|
||||
#Region " CARGA DATOS "
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjEcommerce As New ClsECommerce
|
||||
If ObjEcommerce.InsigniasGet(-1, "", UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjEcommerce.DtResultados
|
||||
End If
|
||||
ObjEcommerce.Dispose()
|
||||
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " AGREGAR/EDITAR "
|
||||
|
||||
Protected Sub LBAgregar_Click(sender As Object, e As EventArgs)
|
||||
CveInsignia = -1
|
||||
Modalidad = False
|
||||
LtAgregarTitulo.Text = "Agregar"
|
||||
BtnAgregar.Text = "Agregar"
|
||||
|
||||
TxtInsignia.Text = ""
|
||||
TxtColor.Text = ""
|
||||
|
||||
UpAgregar.Update()
|
||||
RegistraScript("$('#ModalAgregar').modal();InicializaColorPicker();", "ShowModalAgregar")
|
||||
End Sub
|
||||
Protected Sub LBEditar_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
CveInsignia = GvRow.DataKey("CveInsignia").ToString.ToEntero
|
||||
Modalidad = True
|
||||
LtAgregarTitulo.Text = "Actualizar"
|
||||
BtnAgregar.Text = "Actualizar"
|
||||
|
||||
TxtInsignia.Text = GvRow.DataKey("Insignia").ToString
|
||||
TxtColor.Text = GvRow.DataKey("Color").ToString
|
||||
|
||||
UpAgregar.Update()
|
||||
RegistraScript("$('#ModalAgregar').modal();setTimeout(InicializaColorPicker(), 1000);", "ShowModalAgregar")
|
||||
End Sub
|
||||
Protected Sub BtnAgregar_Click(sender As Object, e As EventArgs)
|
||||
If Not ValidaAgregar() Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim TieneError = False
|
||||
Dim Insignia = TxtInsignia.Text.Trim
|
||||
Dim Color = TxtColor.Text.Trim
|
||||
|
||||
'AGREGAR
|
||||
If Modalidad = False Then
|
||||
Dim ObjEcommerce As New ClsECommerce
|
||||
If ObjEcommerce.InsigniasAdd(Insignia, Color, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("La Insignia se agregó correctamente.", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
ObjEcommerce.Dispose()
|
||||
End If
|
||||
|
||||
'ACTUALIZAR
|
||||
If Modalidad Then
|
||||
Dim ObjEcommerce As New ClsECommerce
|
||||
If ObjEcommerce.InsigniasUpdate(CveInsignia, Insignia, Color, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("La Insignia se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
ObjEcommerce.Dispose()
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
CargaDatos()
|
||||
RegistraScript("$('#ModalAgregar').modal('hide');", "ShowModalAgregar")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Function ValidaAgregar() As Boolean
|
||||
Dim Retorno = True
|
||||
Dim Mensaje As New StringBuilder
|
||||
|
||||
'INSIGNIA
|
||||
Dim Insignia = TxtInsignia.Text.Trim
|
||||
If Insignia.Length = 0 Then
|
||||
Mensaje.Append("- El campo <b>Insignia</b> es obligatorio. Por favor introduzcalo y vuelva a intentar. <br>")
|
||||
End If
|
||||
If Insignia.Length > 50 Then
|
||||
Mensaje.Append("- El campo <b>Insignia</b> admite maximo 50 caracteres. Por favor verifiqye y vuelva a intentar. <br>")
|
||||
End If
|
||||
|
||||
'INSIGNIA
|
||||
Dim Color = TxtColor.Text.Trim
|
||||
If Color.Length > 7 Then
|
||||
Mensaje.Append("- El campo <b>Color</b> admite maximo 7 caracteres. Por favor verifiqye y vuelva a intentar. <br>")
|
||||
End If
|
||||
|
||||
'VALIDACION
|
||||
If Mensaje.ToString.Length > 0 Then
|
||||
Retorno = False
|
||||
Alert(Mensaje.ToString, TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region " ELIMINAR "
|
||||
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
||||
Dim TieneError = False
|
||||
|
||||
Dim ObjEcommerce As New ClsECommerce
|
||||
If ObjEcommerce.InsigniasRemove(GvDatos.Rows(e.RowIndex).DataKey("CveInsignia").ToString.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("La Insignia se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
ObjEcommerce.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " BITACORA "
|
||||
Protected Sub LBBitacora_Click(sender As Object, e As EventArgs)
|
||||
CargaBitacora()
|
||||
End Sub
|
||||
Private Sub CargaBitacora()
|
||||
Dim ObjEcommerce As New ClsECommerce
|
||||
If ObjEcommerce.InsigniasGetBitacora(UsuarioActual.CveEmpresa) Then
|
||||
GvBitacora.DataSource = ObjEcommerce.DtResultados
|
||||
End If
|
||||
ObjEcommerce.Dispose()
|
||||
|
||||
GvBitacora.DataBind()
|
||||
UpBitacora.Update()
|
||||
RegistraScript("$('#ModalBitacora').modal('show');")
|
||||
End Sub
|
||||
Protected Sub GvBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvBitacora.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user