Exemplo n.º 1
0
 private void TButtonPedidos_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms["GestionPedidos"] != null)
     {
         Application.OpenForms["GestionPedidos"].Activate();
     }
     else
     {
         GestionPedidos F1 = new GestionPedidos();
         F1.MdiParent = this;
         F1.Show();
     }
 }
        private void TDataGridViewPedidos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {

                if (TDataGridViewPedidos.Rows[e.RowIndex].Cells[e.ColumnIndex].ColumnIndex.ToString()=="0") // la columna 0 es el checkbox de eliminiar
                {
                    string id = TDataGridViewPedidos.Rows[e.RowIndex].Cells[2].Value.ToString();

                    if (arrayid.Count == 0)
                    {
                        arrayid.Add(id);
                    }
                    else
                    {
                        bool esta = false;
                        for (int i = 0; i < arrayid.Count; i++)
                        {
                            if (arrayid[i].ToString() == id)
                            {
                                arrayid.RemoveAt(i);//para borrarlo de la array porque esto quiere decir que lo hemos deseleccionado
                                esta = true;
                            }
                        }
                        if (esta == false)
                            arrayid.Add(id);
                    }
                }
                else if (TDataGridViewPedidos.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Editar")
                {
                        arrayid.Clear();
                        string id = TDataGridViewPedidos.Rows[e.RowIndex].Cells[2].Value.ToString();
                        string proveedor = TDataGridViewPedidos.Rows[e.RowIndex].Cells[3].Value.ToString();//indice 1 para cojer el nombre
                        string marca = TDataGridViewPedidos.Rows[e.RowIndex].Cells[4].Value.ToString();
                        string modelo = TDataGridViewPedidos.Rows[e.RowIndex].Cells[5].Value.ToString();
                        string cantidad = TDataGridViewPedidos.Rows[e.RowIndex].Cells[6].Value.ToString();
                        string observaciones = TDataGridViewPedidos.Rows[e.RowIndex].Cells[7].Value.ToString();
                        string estado = TDataGridViewPedidos.Rows[e.RowIndex].Cells[8].Value.ToString();
                        string tipoenvio = TDataGridViewPedidos.Rows[e.RowIndex].Cells[9].Value.ToString();
                        string empleado = TDataGridViewPedidos.Rows[e.RowIndex].Cells[10].Value.ToString();

                        string nombrebotonguardar = "Guardar Cambios";

                        if (Application.OpenForms["GestionPedidos"] != null)
                        {
                            Application.OpenForms["GestionPedidos"].Close();

                        }
                        string editado = "";
                        editado = "SI";
                        GestionPedidos Formu = new GestionPedidos(id, proveedor, marca, modelo, cantidad, observaciones, estado, empleado, tipoenvio, nombrebotonguardar,editado);
                        Formu.StartPosition = FormStartPosition.CenterScreen;
                        Formu.MdiParent = this.MdiParent;
                        Formu.Show();

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("Error no hay valores en la fila");

            }
        }
Exemplo n.º 3
0
        private void realizarPedidoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Application.OpenForms["GestionPedidos"] != null)
            {

                Application.OpenForms["GestionPedidos"].Activate();
            }
            else
            {
                GestionPedidos formPedidos = new GestionPedidos();
                formPedidos.MdiParent = this;
                formPedidos.Show();
            }
        }