예제 #1
0
        private void dataGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                DataGridViewRow row = dataGridView1.CurrentRow as DataGridViewRow;
                frmverificacion frm = new frmverificacion(op_var.a, op_var.b, this.comboBox1.Text, row.Cells[1].Value.ToString(), 7);

                frm.ShowDialog();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void dataGridView5_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (radioButton1.Checked)
            {
                if (!validacion())
                {
                    return;
                }
                if (checkBox2.Checked == false)
                {
                    op_var.a = Convert.ToDateTime(string.Concat("01", "/", Convert.ToString(comboBox5.SelectedIndex + 1).PadLeft(2, '0'), "/", comboBox6.Text));             // pongo el 1 porque siempre es el primer día obvio
                    op_var.b = Convert.ToDateTime(string.Concat("01", "/", Convert.ToString(comboBox5.SelectedIndex + 2).PadLeft(2, '0'), "/", comboBox6.Text)).AddDays(-1); //resto un día al mes y con esto obtengo el ultimo día
                }
                else
                {
                    string diai = op_sql.parametro1(@"SELECT c.`diainicial` FROM logicop.cohorte_tablas c  where tabla='entrada';");
                    string numd = op_sql.parametro1(@"SELECT c.`diafinal` FROM logicop.cohorte_tablas c where tabla='entrada';");

                    op_var.a = Convert.ToDateTime(string.Concat(diai, "/", Convert.ToString(op_var.mes(comboBox5.SelectedIndex) - 1).PadLeft(2, '0'), "/", comboBox6.Text)); // pongo el 1 porque siempre es el primer día obvio
                    op_var.b = op_var.a.AddDays(int.Parse(numd));                                                                                                            //resto un día al mes y con esto obtengo el ultimo dí
                }
                panel2.Enabled = true;
                panel3.Enabled = false;
            }
            else
            {
                ErrorProvider u = new ErrorProvider();
                if (dateTimePicker1.Value >= dateTimePicker2.Value)
                {
                    u.SetError(dateTimePicker1, "La fecha dede ser menor a la final");
                    return;
                }
                if (dateTimePicker2.Value <= dateTimePicker1.Value)
                {
                    u.SetError(dateTimePicker2, "La fecha dede ser mayor a la Inicial");
                    return;
                }

                u.SetError(dateTimePicker2, null);
                u.SetError(dateTimePicker1, null);

                op_var.a       = dateTimePicker1.Value;
                op_var.b       = dateTimePicker2.Value;
                panel2.Enabled = false;
                panel3.Enabled = true;
            }

            try
            {
                if (e.ColumnIndex >= 0)
                {
                    DataGridViewRow row = dataGridView3.CurrentRow as DataGridViewRow;
                    //this.toolStripLabel1.Text = row.Cells[0].Value.ToString();
                    if (this.dataGridView3.Columns[e.ColumnIndex].Name == "Column1") //salidasmat
                    {
                        frmverificacion frm = new frmverificacion(op_var.a, op_var.b, row.Cells[0].Value.ToString(), null, 1);
                        frm.MdiParent = this.MdiParent;
                        frm.Show();
                    }

                    if (this.dataGridView3.Columns[e.ColumnIndex].Name == "dataGridViewTextBoxColumn2") //entradasmat
                    {
                        frmverificacion frm = new frmverificacion(op_var.a, op_var.b, row.Cells[0].Value.ToString(), null, 2);
                        frm.MdiParent = this.MdiParent;
                        frm.Show();
                    }
                }
            }
            catch (MySqlException ex)
            {
                if (ex.Number == 1451)
                {
                    MessageBox.Show("El dato está siendo utilizado, por lo tanto es imposible de eliminar", Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    MessageBox.Show(ex.Message, Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }