-
Notifications
You must be signed in to change notification settings - Fork 0
/
CambiarEstado.aspx.cs
48 lines (45 loc) · 1.48 KB
/
CambiarEstado.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dominio;
using Negocio;
namespace TPC_Juarez
{
public partial class CambiarEstado : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Usuario usuario = new Usuario();
if (Session["userSession"] == null)
{
Response.Redirect("Login.aspx");
}
}
protected void btnCambioEstado_Click(object sender, EventArgs e)
{
EstadoNegocio negocio = new EstadoNegocio();
Estado estado = new Estado();
VentaNegocio ventaNegocio = new VentaNegocio();
Venta venta = new Venta();
venta.estadoVenta = new Estado();
int idVenta = Convert.ToInt32(txtEstado.Text);
venta = ventaNegocio.Listar().Find(x => x.id == idVenta);
if (venta != null)
{
if (venta.estadoVenta.idEstado == 1)
{
ventaNegocio.cambiarEstado(venta);
Response.Redirect("VentaRealizada.aspx");
}
else if (venta.estadoVenta.idEstado == 2)
{
ventaNegocio.cambiarEstado2(venta);
Response.Redirect("VentaPendiente.aspx");
}
}
}
}
}