protected void Page_Load(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); if ((USUARIO)Session["Usuario"] != null) { USUARIO _usuario = (USUARIO)Session["Usuario"]; if (_usuario.TIPOUSUARIO == 1) { Label1.Text = _usuario.RUTUSUARIO; Label2.Text = _usuario.NOMBREUSUARIO; Label3.Text = _usuario.APELLIDOPATERNOUSUARIO; Label4.Text = _usuario.APELLIDOMATERNOUSUARIO; Label5.Text = _usuario.CORREOUSUARIO; Label6.Text = _usuario.TELEFONOUSUARIO.ToString(); } else { string error = "Usted no tiene permiso para ingresar a esta vista"; Response.Redirect(string.Format("ERROR.aspx?error={0}", error)); } } else { string error = "Debe Inciar Sesión"; Response.Redirect(string.Format("login.aspx?error={0}", error)); } }
protected void Page_Load(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string rut = Context.Request.Params["rut"]; string codproducto = Context.Request.Params["codproducto"]; if ((USUARIO)Session["Usuario"] != null) { USUARIO _usuario = (USUARIO)Session["Usuario"]; if (_usuario.TIPOUSUARIO == 1) { var q = bdd.SELECTAGREGARALCARRO(rut, Convert.ToInt32(codproducto)); foreach (var cadaConsulta in q) { Label1.Text = cadaConsulta.NOMBRE; Label2.Text = cadaConsulta.VALOR.ToString(); Label3.Text = cadaConsulta.RUT; stock = Convert.ToInt32(cadaConsulta.STOCK); Label5.Text = cadaConsulta.STOCK.ToString(); } } else { string error = "Usted no tiene permiso para ingresar a esta vista"; Response.Redirect(string.Format("ERROR.aspx?error={0}", error)); } } else { string error = "Debe Inciar Sesión"; Response.Redirect(string.Format("login.aspx?error={0}", error)); } }
protected void Page_Load(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); if (!IsPostBack) { if ((USUARIO)Session["Usuario"] != null) { USUARIO _usuario = (USUARIO)Session["Usuario"]; if (_usuario.TIPOUSUARIO == 3) { var q = bdd.ADMHISTORIALVENTA(); GridView1.DataSource = q; GridView1.DataBind(); } else { string error = "Usted no tiene permiso para ingresar a esta vista"; Response.Redirect(string.Format("ERROR.aspx?error={0}", error)); } } else { string error = "Debe Inciar Sesión"; Response.Redirect(string.Format("login.aspx?error={0}", error)); } } }
protected void Button1_Click(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); int idComuna = Convert.ToInt32(DropDownList3.SelectedValue); bdd.UBICACIONINSERT(idProd, txtIngresar13.Text, txtIngresar11.Text, txtIngresar12.Text, idComuna); int idubicacion = 0; var q = bdd.IDUBICACIONPORIDUSUA(idProd); foreach (var cadaConsulta in q) { idubicacion = Convert.ToInt32(cadaConsulta.IDUBICACION); } bdd.GEOLOCINSERT(txtIngresar9.Text, txtIngresar10.Text, idubicacion, idProd); bdd.CUENTAUPGRADE(RUTPROD); try { bdd.SubmitChanges(); Label1.Text = "Cuenta Modificada"; } catch (Exception) { throw; } }
protected void Button1_Click1(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _usuario = (USUARIO)Session["Usuario"]; string _respuesta = txtBoleta.Text; if (!IsPostBack) { if (rbtFiltrarF.Checked == true) { DateTime f1 = Convert.ToDateTime(inputf1.Value); DateTime f2 = Convert.ToDateTime(inputf2.Value); GridView1.DataSource = bdd.HISTORIALDECOMPRAFECHA(f1, f2, _usuario.IDUSUARIO); GridView1.DataBind(); } else if (RadioButton2.Checked == true) { GridView1.DataSource = bdd.HISTORIALDECOMPRAPORID(Convert.ToInt32(txtBoleta.Text), _usuario.IDUSUARIO); GridView1.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string codproducto = Context.Request.Params["codproducto"]; if ((USUARIO)Session["Usuario"] != null) { USUARIO _usuario = (USUARIO)Session["Usuario"]; if (_usuario.TIPOUSUARIO == 3) { var q = bdd.SELECTUPDATEPRODUCTO(Convert.ToInt32(codproducto)); foreach (var cadaConsulta in q) { Label1.Text = cadaConsulta.IDPRODUCTO.ToString(); Label2.Text = cadaConsulta.NOMBREPRODUCTO; TextBox1.Text = cadaConsulta.VALORPRODUCTO.ToString(); Label5.Text = cadaConsulta.ESTADOPRODUCTO; } } else { string error = "Usted no tiene permiso para ingresar a esta vista"; Response.Redirect(string.Format("ERROR.aspx?error={0}", error)); } } else { string error = "Debe Inciar Sesión"; Response.Redirect(string.Format("login.aspx?error={0}", error)); } } }
protected void btnAceptar_Click(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); if (!txtIngrese.Text.Equals("")) { USUARIO _usuario = (USUARIO)Session["Usuario"]; if (_usuario.CLAVEUSUARIO.Equals(txtIngrese.Text)) { bdd.CUENTABLOQUEAR(_usuario.RUTUSUARIO); try { Session.Remove("Usuario"); bdd.SubmitChanges(); } catch (Exception ex) { throw; } Label2.Text = "Cuenta cerrada"; _usuario = null; } else { Label2.Text = "Contraseña incorrecta"; } } else { Label2.Text = "Ingrese contraseña"; } }
protected void Restar(object sender, GridViewDeleteEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string codPedido = GridView1.DataKeys[e.RowIndex].Value.ToString(); Response.Redirect(string.Format("restarProducto.aspx?codPedido={0}", codPedido)); }
protected void Button3_Click(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _usuario = (USUARIO)Session["Usuario"]; string _respuesta = txtBoleta.Text; if (rbtFiltrarF.Checked == true) { if (inputf1.Value != "" && inputf2.Value != "") { DateTime f1 = Convert.ToDateTime(inputf1.Value); DateTime f2 = Convert.ToDateTime(inputf2.Value); if (bdd.HISTORIALDECOMPRAFECHA(f1, f2, _usuario.IDUSUARIO).Count() > 0) { Label1.Text = ""; GridView1.DataSource = bdd.HISTORIALDECOMPRAFECHA(f1, f2, _usuario.IDUSUARIO); GridView1.DataBind(); } else { Label1.Text = "No se encontraron boletas en ese rango de fechas"; } } else { Label1.Text = "Ambas fechas son obligatorias"; var q = bdd.HISTORIALDECOMPRA(_usuario.IDUSUARIO); GridView1.DataSource = q; GridView1.DataBind(); } } else if (RadioButton2.Checked == true) { if (txtBoleta.Text != "") { if (bdd.HISTORIALDECOMPRAPORID(Convert.ToInt32(txtBoleta.Text), _usuario.IDUSUARIO).Count() > 0) { Label1.Text = ""; GridView1.DataSource = bdd.HISTORIALDECOMPRAPORID(Convert.ToInt32(txtBoleta.Text), _usuario.IDUSUARIO); GridView1.DataBind(); } else { Label1.Text = "No se encontro una boleta con ese codigo"; } } else { Label1.Text = "Ingrese un codigo boleta"; var q = bdd.HISTORIALDECOMPRA(_usuario.IDUSUARIO); GridView1.DataSource = q; GridView1.DataBind(); } } }
protected void btnAgregar_Click(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); PRODUCTO _producto = new PRODUCTO(); if ((!TextBox1.Text.Equals("")) && (!TextBox3.Text.Equals(""))) { if (!TextBox3.Text.Equals("0")) { _producto.NOMBREPRODUCTO = TextBox1.Text; _producto.VALORPRODUCTO = Convert.ToInt32(TextBox3.Text); bdd.INSERTARPRODUCTO(_producto.NOMBREPRODUCTO, "mentira", _producto.VALORPRODUCTO); Label1.Text = "Producto agregado"; try { bdd.SubmitChanges(); } catch (Exception ex) { throw; } } else { Label1.Text = "el valor debe ser mayor a 0"; } } else { Label1.Text = "Todos los campos son obligatorios"; } }
protected void btnFono_Click(object sender, EventArgs e) { if (!txtNumero.Text.Equals("")) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _usuario = (USUARIO)Session["Usuario"]; _usuario.TELEFONOUSUARIO = Convert.ToInt32(txtNumero.Text); bdd.CUENTAFONO(_usuario.IDUSUARIO, Convert.ToInt32(txtNumero.Text)); try { bdd.SubmitChanges(); } catch (Exception ex) { throw; } Label1.Text = "Telefono Acutalizado"; } else { Label1.Text = "Ingrese un numero para actualizar"; } }
protected void Seleccionar(object sender, GridViewSelectEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string codboleta = GridView1.DataKeys[e.NewSelectedIndex].Value.ToString(); Response.Redirect(string.Format("detalleBoletaAdmin.aspx?codboleta={0}", codboleta)); }
protected void upGrade(object sender, GridViewEditEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string rut = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); Response.Redirect(string.Format("upGraderAdmin.aspx?rut={0}", rut)); }
protected void Sumar(object sender, GridViewEditEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string codPedido = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); Response.Redirect(string.Format("sumarProductos.aspx?codPedido={0}", codPedido)); }
protected void Button1_Click(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _usuario = (USUARIO)Session["Usuario"]; if ((txtCActual.Text != "") && (txtCNueva.Text != "") && (txtConfirmarCNueva.Text != "")) { if (_usuario.CLAVEUSUARIO == txtCActual.Text) { if (txtCNueva.Text == txtConfirmarCNueva.Text) { bdd.CUENTACLAVE(_usuario.IDUSUARIO, txtCNueva.Text); try { _usuario.CLAVEUSUARIO = txtCNueva.Text; bdd.SubmitChanges(); Label1.Text = "Contraseña Actualizada"; } catch (Exception ex) { throw; } } } else { Label1.Text = "Contraseña actual incorrecta"; } } else { Label1.Text = "todos los campos son obligatorios"; } }
protected void btnCorreo_Click(object sender, EventArgs e) { if (!txtCorreo.Text.Equals("")) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _usuario = (USUARIO)Session["Usuario"]; _usuario.CORREOUSUARIO = txtCorreo.Text; bdd.CUENTACORREO(_usuario.IDUSUARIO, txtCorreo.Text); try { bdd.SubmitChanges(); } catch (Exception ex) { throw; } Label1.Text = "Correo Acutalizado"; } else { Label1.Text = "Ingrese un correo para actualizar"; } }
private void Comprar() { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _usuario = (USUARIO)Session["Usuario"]; int codboleta = 0; int sePuede = 1; var w = bdd.IDCODBOLETACARRITODECOMPRA(_usuario.IDUSUARIO); foreach (var cadaConsulta in w) { codboleta = Convert.ToInt32(cadaConsulta.IDDOCUMENTO); } var a = bdd.QUIENESNOPUEDEN(codboleta); if (a.Count() > 0) { sePuede = 0; } var q = bdd.SELECTCOMPRAR(codboleta); if (sePuede == 1) { foreach (var cadaConsulta in q) { bdd.COMPRARRESTARSTOCK(cadaConsulta.CANTIDADPEDIDODETALLEDOC, cadaConsulta.PRODUCTOIDPRODUCTO, cadaConsulta.USUARIOIDUSUARIO); try { bdd.SubmitChanges(); } catch (Exception ex) { throw; } } bdd.COMPRARBOLETA(codboleta); try { bdd.SubmitChanges(); string _respuesta = "Compra Exitosa"; Response.Redirect(string.Format("carritoCompra.aspx?_respuesta={0}", _respuesta)); } catch (Exception ex) { throw; } } else { GridView2.DataSource = bdd.QUIENESNOPUEDEN(codboleta); GridView2.DataBind(); Label1.Text = "Un productor no tiene suficiente stock"; } }
private void Buscar() { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _usuario = (USUARIO)Session["Usuario"]; if (rbtFiltrarF.Checked == true) { if (inputf1.Value != "" && inputf2.Value != "") { DateTime f1 = Convert.ToDateTime(inputf1.Value); DateTime f2 = Convert.ToDateTime(inputf2.Value); if (bdd.SELECHISTORIALDEVENTAFECHA(f1, f2, _usuario.IDUSUARIO).Count() > 0) { Label1.Text = ""; GridView1.DataSource = bdd.SELECHISTORIALDEVENTAFECHA(f1, f2, _usuario.IDUSUARIO); GridView1.DataBind(); } else { Label1.Text = "No se encuentran boletas en ese rango de fecha"; var q = bdd.SELECHISTORIALDEVENTA(_usuario.IDUSUARIO); GridView1.DataSource = q; GridView1.DataBind(); } } else { Label1.Text = "Ambas Fechas son obligatorias"; } } else if (RadioButton2.Checked == true) { if (txtBoleta.Text != "") { String _respuesta = txtBoleta.Text; if (bdd.SELECHISTORIALDEVENTAPORID(Convert.ToInt32(_respuesta), _usuario.IDUSUARIO).Count() > 0) { Label1.Text = ""; GridView1.DataSource = bdd.SELECHISTORIALDEVENTAPORID(Convert.ToInt32(_respuesta), _usuario.IDUSUARIO); GridView1.DataBind(); } else { Label1.Text = "No se encuentra una boleta con ese id"; var q = bdd.SELECHISTORIALDEVENTA(_usuario.IDUSUARIO); GridView1.DataSource = q; GridView1.DataBind(); } } } else { Label1.Text = "Ingrese un id para la busqueda"; } }
protected void Seleccionar(object sender, GridViewSelectEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string codproducto = GridView1.DataKeys[e.NewSelectedIndex].Value.ToString(); bdd.PRODUCTOACTIVAR(Convert.ToInt32(codproducto)); bdd.SubmitChanges(); Response.Redirect("verProductosProdAdmin.aspx"); }
protected void Activar(object sender, GridViewDeleteEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string rut = GridView1.DataKeys[e.RowIndex].Value.ToString(); bdd.CUENTAACTIVAR(rut); bdd.SubmitChanges(); Response.Redirect("verUsuarioAdmin.aspx"); }
protected void Bloquear(object sender, GridViewSelectEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string rut = GridView1.DataKeys[e.NewSelectedIndex].Value.ToString(); bdd.CUENTABLOQUEAR(rut); bdd.SubmitChanges(); Response.Redirect("verUsuarioAdmin.aspx"); }
protected void Button2_Click(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _usuario = (USUARIO)Session["Usuario"]; var q = bdd.SELECHISTORIALDEVENTA(_usuario.IDUSUARIO); GridView1.DataSource = q; GridView1.DataBind(); }
protected void Button2_Click(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); var q = bdd.ADMHISTORIALVENTA(); GridView1.DataSource = q; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if ((USUARIO)Session["Usuario"] != null) { USUARIO _usuario = (USUARIO)Session["Usuario"]; if (_usuario.TIPOUSUARIO == 1) { string rut = Context.Request.Params["rut"]; PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); var q = bdd.GEOLOCPORRUT(rut); string lat = ""; string lon = ""; foreach (var cadaConsulta in q) { lat = cadaConsulta.LATITUDGEOLOC; lon = cadaConsulta.LONGITUDGEOLOC; } //var q = bdd.GEOLOCPORRUT(); //aca recibir latitud y longitud para recibir por get string latitudAcentrar = lat; string LongitudACentrar = lon; string LatitudCliente = lat; string LongitudCliente = lon; string markers = GetMarkers(LatitudCliente, LongitudCliente); Literal1.Text = @" <script type='text/javascript'> function initialize() { var mapOptions = { center: new google.maps.LatLng(" + latitudAcentrar + ",'" + LongitudACentrar + @"'), zoom: 12, mapTypeId: google.maps.MapTypeId.HYBRID }; var myMap = new google.maps.Map(document.getElementById('mapArea'), mapOptions);" + markers + @" } </script>"; } else { string error = "Usted no tiene permiso para ingresar a esta vista"; Response.Redirect(string.Format("ERROR.aspx?error={0}", error)); } } else { string error = "Debe Inciar Sesión"; Response.Redirect(string.Format("login.aspx?error={0}", error)); } }
protected void Bloquear(object sender, GridViewDeleteEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string codproducto = GridView1.DataKeys[e.RowIndex].Value.ToString(); bdd.PRODUCTOBLOQUEAR(Convert.ToInt32(codproducto)); bdd.SubmitChanges(); Response.Redirect("verProductosProdAdmin.aspx"); }
protected void Eliminar(object sender, GridViewSelectEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string cod = GridView1.DataKeys[e.NewSelectedIndex].Value.ToString(); bdd.CARRITOELIMINAR(Convert.ToInt32(cod)); bdd.SubmitChanges(); Response.Redirect("carritoCompra.aspx"); }
protected void Eliminar(object sender, GridViewSelectEventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string codproducto = GridView1.DataKeys[e.NewSelectedIndex].Value.ToString(); bdd.STOCKELIMINAR(Convert.ToInt32(codproducto)); bdd.SubmitChanges(); Response.Redirect("misProductos.aspx"); }
private string Guardar() { string r = string.Empty; string _respuesta = lblRespuesta.Text; PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); USUARIO _registrar = new USUARIO(); if (valida.ValidaRut(TextBox1.Text)) { int p = bdd.SELECTUSUARIOSADMRUT(TextBox1.Text).Count(); if ((p == 0)) { _registrar.RUTUSUARIO = TextBox1.Text; _registrar.NOMBREUSUARIO = TextBox2.Text; _registrar.APELLIDOPATERNOUSUARIO = TextBox3.Text; _registrar.APELLIDOMATERNOUSUARIO = TextBox4.Text; _registrar.CORREOUSUARIO = TextBox5.Text; if (TextBox6.Text.Equals("")) { _registrar.TELEFONOUSUARIO = 0; } else { _registrar.TELEFONOUSUARIO = Convert.ToInt32(TextBox6.Text); } _registrar.CLAVEUSUARIO = TextBox7.Text; bdd.INSERTUSUARIO(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text, Convert.ToInt32(TextBox6.Text), TextBox7.Text, 1, "1"); try { bdd.SubmitChanges(); _respuesta = "Usuario Registrado"; r = _respuesta; } catch (Exception) { _respuesta = "Error al Registrar Usuario"; r = _respuesta; } } else { _respuesta = "Lo sentimos este rut ya esta registrado"; r = _respuesta; } } else { this.lblRespuesta.Text = "Debe ingresar un rut chileno"; r = "Debe ingresar un rut chileno"; } return(r); }
private void Filtrarr() { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string _respuesta = txtBuscar.Text; if (RadioButton1.Checked == true) { if (txtBuscar.Text != "") { if (bdd.SELECTUSUARIOSADMRUT(_respuesta).Count() != 0) { Label1.Text = ""; GridView1.DataSource = bdd.SELECTUSUARIOSADMRUT(_respuesta); GridView1.DataBind(); } else { Label1.Text = "Usuario no existe"; } } else { Label1.Text = ""; GridView1.DataSource = bdd.SELECTUSUARIOSADM(); GridView1.DataBind(); } } else if (RadioButton2.Checked == true) { if (txtBuscar.Text != "") { if (bdd.SELECTUSUARIOSADMNOMBRE(_respuesta).Count() != 0) { Label1.Text = ""; GridView1.DataSource = bdd.SELECTUSUARIOSADMNOMBRE(_respuesta); GridView1.DataBind(); } else { Label1.Text = "Usuario no existe"; } } else { Label1.Text = ""; GridView1.DataSource = bdd.SELECTUSUARIOSADM(); GridView1.DataBind(); } } else { Label1.Text = "Seleccione un filtro"; } }
protected void btnAcualizar2_Click(object sender, EventArgs e) { PORTAFOLIODataContext bdd = new PORTAFOLIODataContext(); string codproducto = Context.Request.Params["codproducto"]; string valor = TextBox1.Text; bdd.PRODUCTODESCRIPCION(Convert.ToInt32(codproducto), valor); bdd.SubmitChanges(); Response.Redirect("verProductosProdAdmin.aspx"); }