Exemplo n.º 1
0
 /// <summary>
 /// Add data
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox2.Text.Trim() != "" && textBox3.Text.Trim() != "" && textBox4.Text.Trim() != "" && textBox6.Text.Trim() != "" && textBox7.Text.Trim() != "" && textBox8.Text.Trim() != "" && textBox9.Text.Trim() != "" && maskedTextBox1.Text != "  /  /")
     {
         Array.Resize <Programador>(ref MetodosAUX.programador, MetodosAUX.programador.Length + 1);
         Programador _programador = new Programador(MetodosAUX.id + 1, textBox2.Text.Trim(), textBox3.Text.Trim(), textBox4.Text.Trim(), maskedTextBox1.Text, textBox6.Text, textBox7.Text, Int32.Parse(textBox8.Text.Trim()), double.Parse(textBox9.Text.Trim()));
         MetodosAUX.programador[MetodosAUX.id] = _programador;
         dataGridView1.Rows.Add();
         dataGridView1[0, MetodosAUX.id].Value = _programador.id;
         dataGridView1[1, MetodosAUX.id].Value = _programador.familia;
         dataGridView1[2, MetodosAUX.id].Value = _programador.nombre;
         dataGridView1[3, MetodosAUX.id].Value = _programador.snombre;
         dataGridView1[4, MetodosAUX.id].Value = _programador.fnacimiento;
         dataGridView1[5, MetodosAUX.id].Value = _programador.lenguajeP;
         dataGridView1[6, MetodosAUX.id].Value = _programador.posicion;
         dataGridView1[7, MetodosAUX.id].Value = _programador.exLaboral;
         dataGridView1[8, MetodosAUX.id].Value = _programador.salario;
         MessageBox.Show("Information added!");
         MetodosAUX.id = MetodosAUX.id + 1;
     }
     else
     {
         MessageBox.Show("Enter all the data!");
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Edit data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            String ap, nom, snom, fn, len, pos, el, sal;

            ap = Microsoft.VisualBasic.Interaction.InputBox("фамилия", "Apellido!", dataGridView1[1, e.RowIndex].Value.ToString());
            if (ap == "")
            {
                ap = dataGridView1[1, e.RowIndex].Value.ToString();
            }
            nom = Microsoft.VisualBasic.Interaction.InputBox("имя", "Nombre!", dataGridView1[2, e.RowIndex].Value.ToString());
            if (nom == "")
            {
                nom = dataGridView1[2, e.RowIndex].Value.ToString();
            }
            snom = Microsoft.VisualBasic.Interaction.InputBox("отчество", "Segundo nombre!", dataGridView1[3, e.RowIndex].Value.ToString());
            if (snom == "")
            {
                snom = dataGridView1[3, e.RowIndex].Value.ToString();
            }
            fn = Microsoft.VisualBasic.Interaction.InputBox("дата рождения", "Fecha de nacimiento!", dataGridView1[4, e.RowIndex].Value.ToString());
            if (fn == "")
            {
                fn = dataGridView1[4, e.RowIndex].Value.ToString();
            }
            len = Microsoft.VisualBasic.Interaction.InputBox("язык программирования", "Lenguaje de programacion!", dataGridView1[5, e.RowIndex].Value.ToString());
            if (len == "")
            {
                len = dataGridView1[5, e.RowIndex].Value.ToString();
            }
            pos = Microsoft.VisualBasic.Interaction.InputBox("должность", "Posicion!", dataGridView1[6, e.RowIndex].Value.ToString());
            if (pos == "")
            {
                pos = dataGridView1[6, e.RowIndex].Value.ToString();
            }
            el = Microsoft.VisualBasic.Interaction.InputBox("стаж работы", "Experencia Laboral!", dataGridView1[7, e.RowIndex].Value.ToString());
            if (el == "")
            {
                el = dataGridView1[7, e.RowIndex].Value.ToString();
            }
            sal = Microsoft.VisualBasic.Interaction.InputBox("зарплата", "Salario!", dataGridView1[8, e.RowIndex].Value.ToString());
            if (sal == "")
            {
                sal = dataGridView1[8, e.RowIndex].Value.ToString();
            }
            dataGridView1[1, e.RowIndex].Value = ap;
            dataGridView1[2, e.RowIndex].Value = nom;
            dataGridView1[3, e.RowIndex].Value = snom;
            dataGridView1[4, e.RowIndex].Value = fn;
            dataGridView1[5, e.RowIndex].Value = len;
            dataGridView1[6, e.RowIndex].Value = pos;
            dataGridView1[7, e.RowIndex].Value = el;
            dataGridView1[8, e.RowIndex].Value = sal;
            Programador progra = new Programador(e.RowIndex, dataGridView1[1, e.RowIndex].Value.ToString(), dataGridView1[2, e.RowIndex].Value.ToString(),
                                                 dataGridView1[3, e.RowIndex].Value.ToString(), dataGridView1[4, e.RowIndex].Value.ToString(), dataGridView1[5, e.RowIndex].Value.ToString(),
                                                 dataGridView1[6, e.RowIndex].Value.ToString(), Int32.Parse(dataGridView1[7, e.RowIndex].Value.ToString()), double.Parse(dataGridView1[8, e.RowIndex].Value.ToString()));

            MetodosAUX.programador[e.RowIndex] = progra;
        }