Ejemplo n.º 1
0
        private void AgregarMedicamento_Load(object sender, EventArgs e)
        {
            TransaccionClient proxy = new TransaccionClient();
            proxy.Open();
            int cantidad = proxy.ListarMedicamento().Length;
            //txtCodMedicamento.Text = (cantidad + 1).ToString();

            cboMedicamento.DataSource = null;
            cboMedicamento.DataSource = proxy.ListarTodosMedicamentos();
            cboMedicamento.DisplayMember = "NombreMedicamento";
            cboMedicamento.ValueMember = "CodMedicamento";
        }
Ejemplo n.º 2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text.Length == 0)
            {
                MessageBox.Show("Debe ingresar el Nombre...!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtPrecioUnidad.Text.Length == 0)
            {
                MessageBox.Show("Debe ingresar el Precio...!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtUnidades.Text.Length == 0)
            {
                MessageBox.Show("Debe ingresar las Unidades...!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                TransaccionClient proxy = new TransaccionClient();
                proxy.Open();
                Medicamento medi = new Medicamento();

                double precio = Double.Parse(txtPrecioUnidad.Text) / 100;
                medi.NombreMedicamento = txtNombre.Text;
                medi.PrecioUnidad = precio;
                medi.UnidadesEnExistencia = int.Parse(txtUnidades.Text);
                DialogResult Confirmacion = MessageBox.Show("Esta seguro de Guardar los Cambios?", "CONFIRMACION", MessageBoxButtons.YesNo);
                if (Confirmacion == DialogResult.Yes)
                {
                    proxy.CrearMedicamento(medi);
                    MessageBox.Show("MEDICAMENTO AGREGADO CORRECTAMENTE","EXITO",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
                    lblId.Text = "";
                    txtNombre.Text = "";
                    txtPrecioUnidad.Text = "";
                    txtUnidades.Text = "";

                    txtNombre.Enabled = false;
                    txtPrecioUnidad.Enabled = false;
                    txtUnidades.Enabled = false;
                    btnGuardar.Enabled = false;
                    btnNuevo.Enabled = true;

                }
                //else if (Confirmacion == DialogResult.No)
                //{

                //}

            }
        }
Ejemplo n.º 3
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            txtNombre.Enabled = true;
            txtPrecioUnidad.Enabled = true;
            txtUnidades.Enabled = true;
            btnGuardar.Enabled = true;
            btnNuevo.Enabled = false;

            TransaccionClient proxy = new TransaccionClient();
            proxy.Open();
            int cantidad = proxy.ListarTodosMedicamentos().Length+1;
            lblId.Text = cantidad.ToString();
        }
Ejemplo n.º 4
0
 private void ListaMedicamentos_Load(object sender, EventArgs e)
 {
     TransaccionClient proxy = new TransaccionClient();
     proxy.Open();
     dgvMedicamentos.DataSource = proxy.ListarPedido();
 }