protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string conexion = Comun.Conexion; string idCliente = HttpContext.Current.Profile.UserName; bool esAnonimo = !Request.IsAuthenticated; CH_CarritoNegocio cartNeg = new CH_CarritoNegocio(); CH_Carrito resultado = cartNeg.EliminarCuponACarrito(idCliente, esAnonimo, conexion); CultureInfo esMX = new CultureInfo("es-MX"); Result dataRes = new Result { resultado = resultado.Resultado, descuento = string.Format(esMX, "{0:c}", resultado.Descuento), total = string.Format(esMX, "{0:c}", resultado.Total), mensaje = resultado.MensajeError, subtotal = string.Empty }; var json = JsonConvert.SerializeObject(dataRes); Response.Clear(); Response.ContentType = "application/text;"; Response.Write(json); Response.End(); } else { var json = JsonConvert.SerializeObject(new Result { resultado = -10, mensaje = "Error al procesar los datos", total = string.Empty, descuento = string.Empty }); Response.Clear(); Response.ContentType = "application/text;"; Response.Write(json); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //string idPedido = HttpContext.Current.Profile.PropertyValues["IDPedido"].PropertyValue != null ? HttpContext.Current.Profile.PropertyValues["IDPedido"].PropertyValue.ToString() : string.Empty; if (Request.Form["IDProducto"] != null && Request.Form["IDTalla"] != null && Request.Form["IDColor"] != null && Request.Form["Cantidad"] != null) { string idProducto = Request.Form["IDProducto"].ToString(); int idTalla = 0, idColor = 0, cantidad = 0; int.TryParse(Request.Form["IDTalla"].ToString(), out idTalla); int.TryParse(Request.Form["IDColor"].ToString(), out idColor); int.TryParse(Request.Form["Cantidad"].ToString(), out cantidad); CH_VentaDetalle datos = new CH_VentaDetalle(); datos.Producto.IdProducto = idProducto; datos.Producto.Talla.IdTalla = idTalla; datos.Producto.Color.IdColor = idColor; datos.Cantidad = cantidad; string conexion = Comun.Conexion; string idCliente = HttpContext.Current.Profile.UserName; bool esAnonimo = !Request.IsAuthenticated; CH_CarritoNegocio cartNeg = new CH_CarritoNegocio(); int resultado = cartNeg.AgregarProductoACarrito(idCliente, esAnonimo, datos, conexion); var json = JsonConvert.SerializeObject(new Result { resultado = resultado }); Response.Clear(); Response.ContentType = "application/text;"; Response.Write(json); Response.End(); } else { var json = JsonConvert.SerializeObject(new Result { resultado = -10 }); Response.Clear(); Response.ContentType = "application/text;"; Response.Write(json); Response.End(); } } else { var json = JsonConvert.SerializeObject(new Result { resultado = -20 }); Response.Clear(); Response.ContentType = "application/text;"; Response.Write(json); Response.End(); } }
/// <summary> /// Obtener los datos para presentar la página Web de nosotros /// </summary> private CH_Carrito ObtenerDatosDinamicos() { try { string conexion = Comun.Conexion; string idCliente = HttpContext.Current.Profile.UserName; bool esAnonimo = !Request.IsAuthenticated; CH_CarritoNegocio cartNeg = new CH_CarritoNegocio(); return(cartNeg.ObtenerDatosPaginaCarrito(idCliente, esAnonimo, conexion)); } catch (Exception ex) { throw ex; } }