protected void btnBuscar_Click(object sender, EventArgs e) { try { Administrador a = LogicaUsuario.BuscarAdmin(txtNombre.Text); Session["admin"] = a; if (a == null) { Cliente c = LogicaUsuario.BuscarCliente(txtNombre.Text); if (c == null) { CamposAgregar(); } else { lblMsj.Text = "Existe un cliente con ese nombre"; } } else { txtNomCompleto.Text = a.NombreCompleto; txtClave.Text = a.Clave; txtCargo.Text = a.Cargo; CamposModificarEliminar(); } } catch (Exception ex) { lblMsj.Text = ex.Message; } }
protected void btnConfirmar_Click(object sender, EventArgs e) { try { Int64 ruc; int codigo, precio, cantidad; Usuario oUsu; oUsu = (Usuario)Session["Cliente"]; Cliente oCli = LogicaUsuario.BuscarCliente(oUsu.nomUsu); ruc = Convert.ToInt64(gvMedicamentos.SelectedRow.Cells[1].Text.Trim()); codigo = Convert.ToInt32(gvMedicamentos.SelectedRow.Cells[2].Text.Trim()); precio = Convert.ToInt32(gvMedicamentos.SelectedRow.Cells[5].Text.Trim()); cantidad = Convert.ToInt32(txtCantidad.Text.Trim()); Medicamento oMed = LogicaMedicamento.Buscar(ruc, codigo); Pedido oPed = new Pedido(0, cantidad, 0, oCli, oMed); LogicaPedido.Alta(oPed); } catch (Exception ex) { lblError.Text = ex.Message; } }
protected void btnBuscar_Click(object sender, EventArgs e) { string nomUsu = txtNomUsu.Text.Trim(); Cliente oCli = LogicaUsuario.BuscarCliente(nomUsu); Usuario oUsu = LogicaUsuario.BuscarEmpleado(nomUsu); if (oCli != null) { this.ActivoBotonesBM(); txtNomUsu.Text = oCli.nomUsu; txtPass.Text = oCli.pass; txtNombre.Text = oCli.nombre; txtApellido.Text = oCli.apellido; txtDireccion.Text = oCli.dirEntrega; txtTelefono.Text = Convert.ToString(oCli.Telefono); lblError.Text = "El Cliente ya existe"; } else if (oUsu != null) { lblError.Text = "Nombre en uso. Use otro."; } else { this.ActivoBotonesA(); } }
protected void gvEstadoPedido_SelectedIndexChanged(object sender, EventArgs e) { int numero = Convert.ToInt32(gvEstadoPedido.SelectedRow.Cells[1].Text.Trim()); string nomUsu = gvEstadoPedido.SelectedRow.Cells[2].Text.Trim(); Int64 rucMedicamento = Convert.ToInt64(gvEstadoPedido.SelectedRow.Cells[3].Text.Trim()); int codMedicamento = Convert.ToInt32(gvEstadoPedido.SelectedRow.Cells[4].Text.Trim()); int cantidad = Convert.ToInt32(gvEstadoPedido.SelectedRow.Cells[5].Text.Trim()); int estado = Convert.ToInt32(gvEstadoPedido.SelectedRow.Cells[6].Text.Trim()); Cliente oCli = LogicaUsuario.BuscarCliente(nomUsu); Medicamento oMed = LogicaMedicamento.Buscar(rucMedicamento, codMedicamento); Pedido oPed = new Pedido(numero, cantidad, estado, oCli, oMed); lblError.Text = oPed.ToString(); btnCambiarEstado.Enabled = true; }