Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

View File

@@ -0,0 +1,230 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Extensiones;
public partial class General_CatTipoCambio : ClsPaginas
{
#region "Propiedades"
private DateTime FechaInicio
{
get
{
return (DateTime)ViewState["FechaInicio"];
}
set
{
ViewState["FechaInicio"] = value;
}
}
private DateTime FechaFin
{
get
{
return (DateTime)ViewState["FechaFin"];
}
set
{
ViewState["FechaFin"] = value;
}
}
private int EsEditar
{
get
{
return ViewState["EsEditar"].ToString().ToEntero();
}
set
{
ViewState["EsEditar"] = value;
}
}
private int CveTipoCambio
{
get
{
return ViewState["CveTipoCambio"].ToString().ToEntero();
}
set
{
ViewState["CveTipoCambio"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FechaInicio = DateTime.Now.AddDays(-30);
FechaFin = DateTime.Today;
txtFechaI.Text = FechaInicio.ToString("dd/MM/yyyy");
txtFechaF.Text = FechaFin.ToString("dd/MM/yyyy");
CargaDatos();
}
if (UsuarioActual.TienePermisoProceso(210))
{
linkAgregar.Visible = true;
}
}
protected void CargaDatos()
{
ClsGenerales ObjGeneral = new ClsGenerales();
if (ObjGeneral.GetTiposCambio(FechaInicio, FechaFin))
{
GvTiposCambio.DataSource = ObjGeneral.DtResultados;
}
ObjGeneral.Dispose();
GvTiposCambio.DataBind();
UpDatos.Update();
}
protected void linkAgregar_Click(object sender, EventArgs e)
{
limpiarCamposModal();
EsEditar = 0;
BtnGuardarTC.Text = "Guardar";
UPModalTipoCambio.Update();
this.RegistraScript("$('#DvModalTipoCambio').modal('show');");
}
protected void limpiarCamposModal()
{
TxtTipoCambio.Text = "";
TxtTipoCambioEuro.Text = "";
TxtTipoCambioFIX.Text = "";
txtFecha.Text = DateTime.Today.ToString("dd/MM/yyyy");
}
protected void imgE_Click(object sender, EventArgs e)
{
limpiarCamposModal();
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
CveTipoCambio = GvRow.DataKey("CveTipoCambio").ToEntero();
EsEditar = 1;
TxtTipoCambio.Text = GvRow.DataKey("TipoCambio").ToString();
TxtTipoCambioEuro.Text = GvRow.DataKey("TipoCambioEuro").ToString();
TxtTipoCambioFIX.Text = GvRow.DataKey("TipoCambioFIX").ToString();
txtFecha.Text = GvRow.DataKey("Fecha").ToString();
BtnGuardarTC.Text = "Actualizar";
UPModalTipoCambio.Update();
this.RegistraScript("$('#DvModalTipoCambio').modal('show');");
}
protected void GvTiposCambio_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
ClsGenerales ObjGenerales = new ClsGenerales();
ObjGenerales.IniciaTransacSQL();
int CveTipoCambio = GvTiposCambio.Rows[e.RowIndex].DataKey("CveTipoCambio").ToEntero();
bool TieneError = !ObjGenerales.RemoveTipoCambio(CveTipoCambio);
if (TieneError)
{
ObjGenerales.RollBack();
Alert("Error al eliminar el tipo de cambio.", ModExtensiones.TipoMensaje.MsgError);
}
else
{
ObjGenerales.Commit();
Alert("El tipo de cambio ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion);
}
ObjGenerales.Dispose();
CargaDatos();
}
protected void BtnGuardarTC_Click(object sender, EventArgs e)
{
ClsGenerales ObjGeneral = new ClsGenerales();
double TipoCambio = TxtTipoCambio.Text.ToDouble();
double TipoCambioEuro = TxtTipoCambioEuro.Text.ToDouble();
var TipoCambioFIX = 0.0;
if (TxtTipoCambioFIX.Text != "")
{
TipoCambioFIX = TxtTipoCambioFIX.Text.ToDouble();
}
if (EsEditar == 0)
{
if (ObjGeneral.AddTipoCambio(TipoCambio, txtFecha.Text.ToDate(), TipoCambioEuro, TipoCambioFIX))
{
Alert("El Tipo de Cambio fue creado correctamente para la fecha " + txtFecha.Text + ".", ModExtensiones.TipoMensaje.MsgInformacion);
}
}
// EDITA TIPO DE CAMBIO
else
{
if (ObjGeneral.UpdateTipoCambio(CveTipoCambio, TipoCambio, TipoCambioEuro, TipoCambioFIX, txtFecha.Text.ToDate()))
{
Alert("El Tipo de Cambio fue actualizado correctamente para la fecha " + txtFecha.Text + ".", ModExtensiones.TipoMensaje.MsgInformacion);
}
else
{
Alert("Se presento un error al actualizar el tipo de cambio.", ModExtensiones.TipoMensaje.MsgError);
}
}
ObjGeneral.Dispose();
limpiarCamposModal();
this.RegistraScript("$('#DvModalTipoCambio').modal('hide');");
CargaDatos();
}
protected void BtnConsulta_Click(object sender, EventArgs e)
{
FechaInicio = txtFechaI.Text.ToDate();
FechaFin = txtFechaF.Text.ToDate();
CargaDatos();
}
protected void GvTiposCambio_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (UsuarioActual.TienePermisoProceso(212))
{
e.Row.FCLinkButton("imgD").Visible = true;
}
if (UsuarioActual.TienePermisoProceso(211))
{
e.Row.FCLinkButton("imgE").Visible = true;
}
}
}
}