Files
SIG/General/PopUpPaqueteriasGuiasInternas.aspx.cs
2020-06-02 08:14:57 -07:00

136 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Extensiones;
using System.Data;
using System.Text;
public partial class General_PopUpPaqueteriasGuiasInternas : ClsPaginas
{
private int CveVenta
{
get
{
return ViewState["CveVenta"].ToString().ToEntero();
}
set
{
ViewState["CveVenta"] = value;
}
}
private int CveSubProyecto
{
get
{
return ViewState["CveSubProyecto"].ToString().ToEntero();
}
set
{
ViewState["CveSubProyecto"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
((BaseMasterPage)this.Master).EsPopup = true;
RecuperaCve();
}
}
protected void RecuperaCve()
{
if (Request["CveVenta"] != null && !Request["CveVenta"].ToString().Equals("") && Request["CveVenta"].ToEntero() > 0)
{
ViewState["CveVenta"] = Request["CveVenta"];
}
else
{
ViewState["CveVenta"] = -1;
}
if (Request["CveSubProyecto"] != null && !Request["CveSubProyecto"].ToString().Equals("") && Request["CveSubProyecto"].ToEntero() > 0)
{
ViewState["CveSubProyecto"] = Request["CveSubProyecto"];
}
else
{
ViewState["CveSubProyecto"] = -1;
}
}
protected void LimpiaCampos()
{
DdlEstatus.SelectedValue = "1";
TxtFecha.Text = "";
TxtFechaEstimada.Text = "";
TxtNoCajas.Text = "";
TxtObservaciones.Text = "";
}
protected void AgregarNuevaGuia()
{
ClsGenerales ObjGeneral = new ClsGenerales();
Boolean TieneError = false;
ObjGeneral.IniciaTransacSQL();
int CveEstatus = DdlEstatus.SelectedValue.ToEntero();
String Fecha = TxtFecha.Text;
String FechaEstimada = TxtFechaEstimada.Text == "" ? "-1" : TxtFechaEstimada.Text;
int NoCajas = TxtNoCajas.Text.ToEntero();
String Observaciones = TxtObservaciones.Text;
int CvePaqueteriaGuia = ObjGeneral.AddPaqueteriasGuias(-1, 9, CveEstatus, CveSubProyecto, Fecha, "-1", "-1", NoCajas, 0.00, "-1", FechaEstimada, Observaciones,
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, EsEntregaInterna:true);
if (CvePaqueteriaGuia > 0)
{
if (CveVenta > 0 || CveSubProyecto > 0 )
{
TieneError = !ObjGeneral.AddPaqueteriasGuiasDetalles(CvePaqueteriaGuia, CveVenta, -1, -1, -1);
}
}
else
{
TieneError = true;
}
if (TieneError)
{
ObjGeneral.RollBack();
}else
{
ObjGeneral.Commit();
LimpiaCampos();
Alert("Se agrego la paquetería guía correctamente");
}
ObjGeneral.Dispose();
}
public void BtnAgregarGuia_Click(Object sender, EventArgs e)
{
}
public void BtnCrearGuia_Click(Object sender, EventArgs e)
{
AgregarNuevaGuia();
}
public void BtnLimpiar_Click(Object sender,EventArgs e)
{
LimpiaCampos();
}
}