Ejemplo n.º 1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            string            message = "Esta seguro que desea eliminar este registro?";
            string            title   = "Advertencia";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result  = MessageBox.Show(message, title, buttons);
            //
            int?id = GetId();

            if (result == DialogResult.Yes)
            {
                if (id != null)
                {
                    DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
                    try
                    {
                        ta.DeleteQuerySupplier((int)id);
                        Refresh();
                    }
                    catch (Exception mensaje)
                    {
                        MessageBox.Show(mensaje.ToString());
                    }
                }
            }
            else
            {
                // Do something
            }
        }
Ejemplo n.º 2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            MessageBox.Show(idd.ToString());
            DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
            MessageBox.Show(idd.ToString());
            if (string.IsNullOrWhiteSpace(txtNombre.Text))


            {
                MessageBox.Show("Verifique que todos los campos hayan sido llenados correctamente");
            }


            else
            if (idd == 0)
            {
                ta.InsertQuerySupplier(txtNombre.Text.Trim());
                txtNombre.Clear();

                idd = 0;
                Refresh();
            }
            else
            {
                ta.UpdateQuerySupplier(txtNombre.Text.Trim(), (int)idd);
                txtNombre.Clear();

                idd = 0;

                Refresh();
            }
        }
Ejemplo n.º 3
0
        private void txtProveedor_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (checkBox2.Checked)
            {
                //
                try
                {
                    DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
                    DataSet1.SupplierDataTable dt = ta.GetDataByBuscarIDProveedor(txtProveedor.Text);
                    //ta.GetDataByIdSupplier(txtBusquedaProv.Text);


                    ta.FillByBuscarIDProveedor(dt, txtProveedor.Text);


                    dgvProveedor.DataSource = dt;
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                //
            }
            else
            {
                try
                {
                    DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
                    DataSet1.SupplierDataTable dt = ta.GetDataByFilteringSupplier(txtProveedor.Text);


                    ta.FillByFilteringSupplier(dt, txtProveedor.Text);


                    dgvProveedor.DataSource = dt;
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }


            //try
            //{
            //    DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
            //    DataSet1.SupplierDataTable dt = ta.GetDataByFilteringSupplier(txtProveedor.Text);


            //    ta.FillByFilteringSupplier(dt, txtProveedor.Text);


            //    dgvProveedor.DataSource = dt;

            //}
            //catch (System.Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
        }
Ejemplo n.º 4
0
        private void RefreshSupplier()
        {
            DataSet1TableAdapters.SupplierTableAdapter ta =
                new DataSet1TableAdapters.SupplierTableAdapter();

            DataSet1.SupplierDataTable dt = ta.GetDataSupplier();

            dgvProveedor.DataSource            = dt;
            dgvProveedor.Columns[0].HeaderText = "Id";
            dgvProveedor.Columns[1].HeaderText = "Nombre";
        }
Ejemplo n.º 5
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            int?id = GetId();
            int valorcillo;

            //   MessageBox.Show(id.ToString());
            if (id != null)
            {
                DataSet1TableAdapters.ProductTableAdapter ta = new DataSet1TableAdapters.ProductTableAdapter();
                DataSet1.ProductDataTable pt = ta.GetDataByIdProduct((int)id);

                DataSet1.ProductRow row = (DataSet1.ProductRow)pt.Rows[0];
                txtNombre.Text     = row.ProductName;
                udCantidad.Value   = row.ProductQuantity;
                udUnidades.Value   = row.ProductUnits;
                txtTipoUnidad.Text = row.ProductUnitType;
                clnFechaExp.SetDate(row.ProductExpDate);


                valorcillo = row.idSupplier;
                // MessageBox.Show(valorcillo.ToString());
                //from here
                DataSet1TableAdapters.SupplierTableAdapter tas = new DataSet1TableAdapters.SupplierTableAdapter();
                DataSet1.SupplierDataTable pts = tas.GetDataByIdSupplier((int)valorcillo);
                //  DataSet1.SupplierRow rowsup = (DataSet1.SupplierRow)pts.Rows[0];
                //  txtProveedor.Text = rowsup.ToString();

                dgvProveedor.DataSource = pts;
                //   dgvProveedor.Rows[dgvProveedor.CurrentRow.Index].Cells[0].Value.Equals(valorcillo);



                //DataSet1TableAdapters.SupplierTableAdapter tas = new DataSet1TableAdapters.SupplierTableAdapter();
                //  DataSet1.SupplierDataTable pts = tas.GetDataByIdSupplier((int)iddSupplier);
                // txtProveedor.Text = pts.ToString();
                //iddSupplier= row.idSupplier;
                //  DataSet1.SupplierRow rowsup = (DataSet1.SupplierRow)pts.Rows[0];

                //  rowsup.id_Supplier = iddSupplier;

                //
                // int.Parse(dgvProveedor.Rows[dgvProveedor.CurrentRow.Index].Cells[0].Value.ToString());
                //DataSet1.SupplierRow rowsup = (DataSet1.SupplierRow)pts.Rows[0];
                //rowsup.id_Supplier = row.idSupplier;
            }
            else
            {
                MessageBox.Show("No hay registros");
            }
        }
Ejemplo n.º 6
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            int?id = GetId();

            //MessageBox.Show(id.ToString());
            if (id != null)
            {
                DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
                DataSet1.SupplierDataTable pt = ta.GetDataByIdSupplier((int)id);

                DataSet1.SupplierRow row = (DataSet1.SupplierRow)pt.Rows[0];
                txtNombre.Text = row.SupplierName;
            }
            else
            {
                MessageBox.Show("No hay registros");
            }
        }
Ejemplo n.º 7
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            int?id = GetId();
            int valorcillo;

            //     MessageBox.Show(id.ToString());
            if (id != null)
            {
                DataSet1TableAdapters.MedicineTableAdapter ta = new DataSet1TableAdapters.MedicineTableAdapter();
                DataSet1.MedicineDataTable pt = ta.GetDataByIdMedicine((int)id);

                DataSet1.MedicineRow row = (DataSet1.MedicineRow)pt.Rows[0];

                txtNombre.Text = row.MedicineName;


                udCantidad.Value = row.MedicineQuantity;
                txtPres.Text     = row.MedicineQuantityPres;
                udUnidades.Value = row.MedicineUnits;
                //  txtTipoUnidad.Text = row.MaterialUnitType;
                clnFechaExp.SetDate(row.MedicineExpDate);
                txtTipoUnidad.Text    = row.MedicineUnitsType;
                udUnidadesDosis.Value = row.MedicineDosUnits;
                udCantidadDosis.Value = row.MedicineDosQuan;

                valorcillo = row.idSupplier;
                // MessageBox.Show(valorcillo.ToString());
                //from here
                DataSet1TableAdapters.SupplierTableAdapter tas = new DataSet1TableAdapters.SupplierTableAdapter();
                DataSet1.SupplierDataTable pts = tas.GetDataByIdSupplier((int)valorcillo);
                //  DataSet1.SupplierRow rowsup = (DataSet1.SupplierRow)pts.Rows[0];
                //  txtProveedor.Text = rowsup.ToString();

                dgvProveedor.DataSource = pts;
            }
            else
            {
                MessageBox.Show("No hay registros");
            }
        }
Ejemplo n.º 8
0
        //
        private void button1_Click(object sender, EventArgs e)
        {
            int?idS = GetIdSupplier();

            //    MessageBox.Show(idS.ToString());
            if (idS != null)
            {
                DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
                DataSet1.SupplierDataTable pt = ta.GetDataByIdSupplier((int)idS);


                DataSet1.SupplierRow row = (DataSet1.SupplierRow)pt.Rows[0];
                txtProveedor.Text    = row.SupplierName;
                dgvProveedor.Enabled = false;
                txtProveedor.Enabled = false;
                btnElegir.Enabled
                    = false;
            }
            else
            {
                MessageBox.Show("No hay registros");
            }
        }
Ejemplo n.º 9
0
        private void txtBusquedaProv_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (checkBox1.Checked)
            {
                //
                try
                {
                    DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
                    DataSet1.SupplierDataTable dt = ta.GetDataByBuscarIDProveedor(txtBusquedaProv.Text);
                    //ta.GetDataByIdSupplier(txtBusquedaProv.Text);


                    ta.FillByBuscarIDProveedor(dt, txtBusquedaProv.Text);


                    dataGridView1.DataSource = dt;
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                //
            }
            else
            {
                try
                {
                    DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
                    DataSet1.SupplierDataTable dt = ta.GetDataByFilteringSupplier(txtBusquedaProv.Text);


                    ta.FillByFilteringSupplier(dt, txtBusquedaProv.Text);


                    dataGridView1.DataSource = dt;
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            //

            /*
             * try
             * {
             *  DataSet1TableAdapters.SupplierTableAdapter ta = new DataSet1TableAdapters.SupplierTableAdapter();
             *  DataSet1.SupplierDataTable dt = ta.GetDataByFilteringSupplier(txtBusquedaProv.Text);
             *
             *
             *  ta.FillByFilteringSupplier(dt, txtBusquedaProv.Text);
             *
             *
             *  dataGridView1.DataSource = dt;
             *
             * }
             * catch (System.Exception ex)
             * {
             *  MessageBox.Show(ex.Message);
             * }*/
        }