public void CargarComboNotaCredito(string usuario) { List <NotaCredito> lista = GestorNC.ObtenerImporteNC(usuario); lista.Insert(0, new NotaCredito { Importe = Constantes.SeleccionarNC }); listNotaCred.DataSource = lista; listNotaCred.DataTextField = "Importe"; listNotaCred.DataValueField = "Importe"; listNotaCred.DataBind(); }
protected void confirmar_Click(object sender, EventArgs e) { string DetalleFC = detalle.Text.Trim(); string DetalleNC = detalleNC.Text.Trim(); var NumFactura = Session["NroFactura"].ToString(); var importe = Session["PrecioTotal"].ToString(); GestorFactura.ModificarFactura(int.Parse(NumFactura), "Anulado", DetalleFC); bool Generado = GestorNC.AgregarNC(int.Parse(NumFactura), DetalleNC, importe, ""); if (Generado) { Response.Write("<script>alert('Los cambios se guardaron correctamente')</script>"); } }
public void ConfirmarCompra(string Nombre, string Total) { var UserCliente = $"{((BE.Usuario)Session["usuarioCliente"])?.User}"; try { //var UserCliente = $"{((BE.Usuario)Session["usuarioCliente"])?.User}"; Nombre = Nombre.TrimEnd(','); var Productos = new List <string>(Nombre.Split(',')); var NPGenerada = GestorNP.AgregarNP(UserCliente, Total); var nroNC = GestorNC.ObtenerNC(UserCliente); if (NPGenerada) { var NP = GestorNP.ObtenerNP(UserCliente, Total); GestorNP.ModificarEstado(NP, "Cobrado"); foreach (var item in Productos) { GestorNP.AgregarProdNP(NP, item); } if (nroNC.Count != 0) { GestorNC.ModificarEstadoNC("Aplicado", nroNC[0].NroNotaC); } } } catch (Exception) { Response.Redirect("Default"); } var email = GestorCliente.ObtenerEmailCliente(UserCliente); EnvioEmails.EnviarMailConfirmacionCompra(email.Email, ""); Response.Redirect("ConfirmacionCompra"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["usuarioCliente"] == null) { Session["ProductosActuales"] = null; Response.Redirect("Login"); } else { if (Session["ProductosActuales"] == null || (string)Session["ProductosActuales"] == "") { Session["ProductosActuales"] = Request.QueryString["Nombre"]?.ToString(); } this.PrecioCompra.Text = Request.QueryString["total"]?.ToString(); Session["Total"] = Request.QueryString["total"].ToString(); string Total = (string)Session["Total"]; var UserCliente = $"{((BE.Usuario)Session["usuarioCliente"])?.User}"; var ImporteNC = GestorNC.ObtenerImporteNC(UserCliente); double total = double.Parse(Total); if (ImporteNC != null && ImporteNC.Count != 0) { double nc = double.Parse(ImporteNC[0].Importe); double aPagar = total - nc; CargarComboNotaCredito(UserCliente); precioAPagar.Text = aPagar.ToString(); } } } else { if (string.IsNullOrEmpty((string)Session["ProductosActuales"]) || string.IsNullOrEmpty((string)Session["Total"])) { Response.Redirect("Default"); } string Productos = (string)Session["ProductosActuales"]; string Total = (string)Session["Total"]; var UserCliente = $"{((BE.Usuario)Session["usuarioCliente"])?.User}"; var ImporteNC = GestorNC.ObtenerImporteNC(UserCliente); if (ImporteNC.Count != 0) { double total = double.Parse(Total); double nc = double.Parse(ImporteNC[0].Importe); double aPagar = total - nc; var opcionNC = Constantes.SeleccionarNC; if (listNotaCred.SelectedValue != opcionNC) { precioAPagar.Text = aPagar.ToString(); } else { precioAPagar.Text = Total; } } else { precioAPagar.Text = Total; } Session["ProductosActuales"] = null; Session["Total"] = null; ConfirmarCompra(Productos, precioAPagar.Text); } }