コード例 #1
0
ファイル: Menu.cs プロジェクト: cescaba/AppCambios
        public Menu()
        {
            InitializeComponent();
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;

            DAORFC dao = new DAORFC();

            DataTable dt = new DataTable();

            DTORfc rfc_aux = new DTORfc();

            DAOEmpresa daoEmpresa = new DAOEmpresa();
            DataSet    dtEmpresa  = new DataSet();

            dtEmpresa = daoEmpresa.selectAll();

            for (int j = 0; j <= dtEmpresa.Tables[0].Rows.Count - 1; j++)
            {
                cbobusempresa.Items.Add((object)dtEmpresa.Tables[0].Rows[j][1].ToString());
            }


            rfc_aux.Estado = "Total";
            if (VariablesGlobales.TipoRol != "Gestor")
            {
                rfc_aux.Coordinador       = VariablesGlobales.nomUsu;
                rfc_aux.Estado            = "Pendiente"; //deberia ser Aceptado
                toolStripButton1.Enabled  = false;
                txtbuscoordinador.Enabled = false;
            }

            dt = dao.selectCostum(rfc_aux, new DTOSolicitud(), true, true, 1);

            if (dt == null)
            {
                MessageBox.Show("No Hay Datos");
            }
            else
            {
                dataGridView1.DataSource                         = dt;
                dataGridView1.AutoSizeColumnsMode                = DataGridViewAutoSizeColumnsMode.DisplayedCells;
                dataGridView1.Columns[0].HeaderCell.Value        = "Código";
                dataGridView1.Columns[1].HeaderCell.Value        = "Estado";
                dataGridView1.Columns[2].HeaderCell.Value        = "Tipo de Cambio";
                dataGridView1.Columns[3].HeaderCell.Value        = "Indisponibilidad";
                dataGridView1.Columns[4].HeaderCell.Value        = "Des. Cambio";
                dataGridView1.Columns[5].HeaderCell.Value        = "Fec. Prog. Inicio";
                dataGridView1.Columns[5].DefaultCellStyle.Format = "dd/MM/yyyy hh:mm:ss tt";
                dataGridView1.Columns[6].HeaderCell.Value        = "Fec. Prog. Fin";
                dataGridView1.Columns[6].DefaultCellStyle.Format = "dd/MM/yyyy hh:mm:ss tt";
                dataGridView1.Columns[7].HeaderCell.Value        = "Sistema Afectado";
                dataGridView1.Columns[8].HeaderCell.Value        = "Ambiente Afectado";
                dataGridView1.Columns[9].HeaderCell.Value        = "Empresa Afectada";
            }
        }
コード例 #2
0
        private void btnbuscar_Click(object sender, EventArgs e)
        {
            DTORfc  rfc = new DTORfc();
            DAORFC  dao = new DAORFC();
            DataSet ds  = new DataSet();

            txtcodbuscar.Text = txtcodbuscar.Text.Trim();
            int buscador = comboBox1.SelectedIndex;

            switch (buscador)
            {
            case 0:

                try
                {
                    rfc.Codigo = (Int32)Int32.Parse(txtcodbuscar.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Solo ingresa la parte númerica del código.");
                    return;
                }

                ds = dao.select(rfc);
                break;

            case 1:
                rfc.Codatenciontercero = txtcodbuscar.Text;
                ds = dao.buscarTicket(rfc, 1);
                break;

            case 2:
                rfc.Codatenciontercero = txtcodbuscar.Text;
                ds = dao.buscarTicket(rfc, 2);
                break;
            }


            if (ds != null && ds.Tables[0].Rows.Count != 0)
            {
                ReqCambios rc = new ReqCambios();
                rc.getCodigo.Text = "" + ds.Tables[0].Rows[0]["codigo"];
                rc.Show();

                Consultar k = this;
                k.Close();
            }
            else
            {
                MessageBox.Show("No existe RFC para el código ingresado.");
                return;
            }
        }
コード例 #3
0
ファイル: Menu.cs プロジェクト: cescaba/AppCambios
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            limpiarbuscador();

            //mycon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\corjsmsrv1.grupocogesa.gromero.net\Publico\PublicoCSC\#TI\Repositorio-RFC\Base de datos21.accdb");
            // mycon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Base de datos21.accdb");
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;

            DAORFC    dao     = new DAORFC();
            DTORfc    rfc_aux = new DTORfc();
            DataTable dt      = new DataTable();

            rfc_aux.Estado = "Total";
            if (VariablesGlobales.TipoRol != "Gestor")
            {
                rfc_aux.Coordinador       = VariablesGlobales.nomUsu;
                rfc_aux.Estado            = "Pendiente"; //deberia ser Aceptado
                toolStripButton1.Enabled  = false;
                txtbuscoordinador.Enabled = false;
            }

            dt = dao.selectCostum(rfc_aux, new DTOSolicitud(), true, true, 1);

            if (dt == null)
            {
                MessageBox.Show("No Hay Datos");
            }
            else
            {
                dataGridView1.DataSource                  = dt;
                dataGridView1.AutoSizeColumnsMode         = DataGridViewAutoSizeColumnsMode.DisplayedCells;
                dataGridView1.Columns[0].HeaderCell.Value = "Código";
                dataGridView1.Columns[1].HeaderCell.Value = "Estado";
                dataGridView1.Columns[2].HeaderCell.Value = "Tipo de Cambio";
                dataGridView1.Columns[3].HeaderCell.Value = "Indisponibilidad";
                dataGridView1.Columns[4].HeaderCell.Value = "Des. Cambio";
                dataGridView1.Columns[5].HeaderCell.Value = "Fec. Prog. Inicio";
                dataGridView1.Columns[6].HeaderCell.Value = "Fec. Prog. Fin";
                dataGridView1.Columns[7].HeaderCell.Value = "Sistema Afectado";
                dataGridView1.Columns[8].HeaderCell.Value = "Ambiente Afectado";
                dataGridView1.Columns[9].HeaderCell.Value = "Empresa Afectada";
            }
        }
コード例 #4
0
ファイル: Menu.cs プロジェクト: cescaba/AppCambios
        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            limpiarbuscador();
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;

            DAORFC    dao     = new DAORFC();
            DTORfc    rfc_aux = new DTORfc();
            DataTable dt      = new DataTable();


            if (VariablesGlobales.TipoRol != "Gestor")
            {
                rfc_aux.Coordinador       = VariablesGlobales.nomUsu;
                toolStripButton1.Enabled  = false;
                txtbuscoordinador.Enabled = false;
            }

            dt = dao.selectCostum(rfc_aux, new DTOSolicitud(), true, false, 1);



            if (dt == null)
            {
                MessageBox.Show("No Hay Datos");
            }
            else
            {
                dataGridView1.DataSource                  = dt;
                dataGridView1.AutoSizeColumnsMode         = DataGridViewAutoSizeColumnsMode.DisplayedCells;
                dataGridView1.Columns[0].HeaderCell.Value = "Código";
                dataGridView1.Columns[1].HeaderCell.Value = "Estado";
                dataGridView1.Columns[2].HeaderCell.Value = "Tipo de Cambio";
                dataGridView1.Columns[3].HeaderCell.Value = "Indisponibilidad";
                dataGridView1.Columns[4].HeaderCell.Value = "Des. Cambio";
                dataGridView1.Columns[5].HeaderCell.Value = "Fec. Prog. Inicio";
                dataGridView1.Columns[6].HeaderCell.Value = "Fec. Prog. Fin";
                dataGridView1.Columns[7].HeaderCell.Value = "Sistema Afectado";
                dataGridView1.Columns[8].HeaderCell.Value = "Ambiente Afectado";
                dataGridView1.Columns[9].HeaderCell.Value = "Empresa Afectada";
            }
        }
コード例 #5
0
ファイル: FormRechazo.cs プロジェクト: cescaba/AppCambios
        private void button1_Click(object sender, EventArgs e)
        {
            rq.guardar();
            DAORFC dao = new DAORFC();
            DTORfc rfc = new DTORfc();


            rfc.Codigo       = (Int32)int.Parse(rq.getCodigo.Text);
            rfc.Fecrechazo   = DateTime.Now;
            rfc.Razonrechazo = txtRechazo.Text;
            int y = dao.updateRechazar(rfc);

            if (y > 0)
            {
                rq.getEstado.Text = "Rechazado";
                rq.FormatodeUI();

                FormRechazo x = (FormRechazo)this;
                x.Close();
            }
        }
コード例 #6
0
        private void btnAprobar_Click(object sender, EventArgs e)
        {
            if (txtcorraporemer.Text == "" && txtcorraporexce.Text == "" && txtcorreocomite.Text == "")
            {
                MessageBox.Show("Adjuntar el Correo de Aprobacion");
                return;
            }
            string targetPath = "";

            if (VariablesGlobales.ambienteDestino == "PRD")
            {
                targetPath = @"\\corjsmsrv1.grupocogesa.gromero.net\Publico\PublicoCSC\#TI\Repositorio-RFC\Correos-Aprobacion";
            }
            else
            {
                targetPath = @"D:\AppCambios\Aprobacion";
            }



            string destFile = System.IO.Path.Combine(targetPath, "RFC" + rq.getCodigo.Text + ".msg");

            if (groupBoxEmergencia.Visible == true)
            {
                if (comboBoxAprobador.SelectedIndex == -1 || txtincidente.Text == "")
                {
                    MessageBox.Show("Porfavor ingresar todo los datos");
                    return;
                }

                rq.guardar();

                DAORFC dao = new DAORFC();
                DTORfc rfc = new DTORfc();
                rfc.Codigo = (Int32)int.Parse(rq.getCodigo.Text);
                rfc.Estado = "Aprobado";
                //rfc.Aprobador = comboBoxAprobador.ValueMember.ToString();
                rfc.Aprobador     = comboBoxAprobador.SelectedItem.ToString();
                rfc.Fecaprobacion = dateTimePickerAprobacion.Value;
                rfc.Motivo        = "Incidente";

                System.IO.File.Copy(txtcorraporemer.Text, destFile, true);
                rfc.Correo_aprobacion = destFile;

                if (dao.updateAprobarMenor(rfc) > 0)
                {
                    rq.getEstado.Text = "Aprobado";

                    DAOSolicitud daosolicitud = new DAOSolicitud();
                    DTOSolicitud solicitud    = new DTOSolicitud();
                    solicitud.Codigo      = rfc.Codigo;
                    solicitud.Origen      = 1;
                    solicitud.Razon       = 4;
                    solicitud.Codasociado = txtincidente.Text;

                    daosolicitud.updateEmergencia(solicitud);


                    rq.FormatodeUI();
                    cac x = (cac)this;
                    x.Close();
                }
            }
            else
            {
                if (getGrupoMedioMayor.Visible == true)
                {
                    rq.guardar();

                    DAORFC dao = new DAORFC();
                    DTORfc rfc = new DTORfc();
                    rfc.Codigo        = (Int32)int.Parse(rq.getCodigo.Text);
                    rfc.Estado        = "Aprobado";
                    rfc.Aprobador     = "CAC";
                    rfc.Fecaprobacion = dateTimePickerCAC.Value;
                    System.IO.File.Copy(txtcorreocomite.Text, destFile, true);
                    rfc.Correo_aprobacion = destFile;

                    if (dao.updateAprobarMenor(rfc) > 0)
                    {
                        rq.getEstado.Text = "Aprobado";
                        rq.FormatodeUI();
                        cac x = (cac)this;
                        x.Close();
                    }
                }
                else
                {
                    rq.guardar();

                    DAORFC dao = new DAORFC();
                    DTORfc rfc = new DTORfc();
                    rfc.Codigo = (Int32)int.Parse(rq.getCodigo.Text);
                    rfc.Estado = "Aprobado";
                    //rfc.Aprobador = comboBoxAprobadorExc.ValueMember.ToString();
                    rfc.Aprobador     = comboBoxAprobadorExc.SelectedItem.ToString();
                    rfc.Fecaprobacion = dateTimePicker1.Value;
                    rfc.Motivo        = cboMotivo.SelectedItem.ToString();
                    System.IO.File.Copy(txtcorraporexce.Text, destFile, true);
                    rfc.Correo_aprobacion = destFile;

                    if (dao.updateAprobarMenor(rfc) > 0)
                    {
                        rq.getEstado.Text = "Aprobado";
                        rq.FormatodeUI();
                        cac x = (cac)this;
                        x.Close();
                    }
                }
            }

            string titulo = rq.getCodigo.Text + " - " + rq.gettxtdescripcion.Text;


            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Coordinador: " + rq.getCoordinador.Text);
            sb.AppendLine(" Descripcion: " + rq.gettxtdescripcioncambio.Text);
            if (rq.Txtlink.Text != "")
            {
                sb.AppendLine(" Ruta del Plan: " + rq.Txtlink.Text);
            }

            if (VariablesGlobales.ambienteDestino == "PRD")
            {
                CreateMeetingRequest("*****@*****.**", titulo, sb.ToString(), rq.getIni.Value, rq.getFin.Value);
            }
        }
コード例 #7
0
ファイル: Menu.cs プロジェクト: cescaba/AppCambios
        private void button1_Click_1(object sender, EventArgs e)
        {
            DTORfc       rfc        = new DTORfc();
            DTOSolicitud solicitud  = new DTOSolicitud();
            DAORFC       dao        = new DAORFC();
            int          tipoCambio = 0;

            //Estado
            if (cbobusestado.SelectedIndex != 0 && cbobusestado.SelectedIndex != -1)
            {
                rfc.Estado = cbobusestado.SelectedItem.ToString();
            }
            else
            {
                rfc.Estado = null;
            }

            //Indisponibilidad
            if (cbobusindis.SelectedIndex != 0 && cbobusindis.SelectedIndex != -1)
            {
                rfc.Indisponibilidad = (Int32)cbobusindis.SelectedIndex;
            }
            else
            {
                rfc.Indisponibilidad = -1;
            }

            //Tipo de cambio
            if (radioButtonall.Checked)
            {
                tipoCambio = 1;
            }
            if (radioButtonMenor.Checked)
            {
                tipoCambio = 2;
            }
            if (radioButtonMed.Checked)
            {
                tipoCambio = 3;
            }
            if (radioButtonUrg.Checked)
            {
                tipoCambio = 4;
            }

            //Area del Cambio - Categoria Activo
            if (cbobusareacambio.SelectedIndex != 0 && cbobusareacambio.SelectedIndex != -1)
            {
                rfc.Cateinfra = cbobusareacambio.SelectedItem.ToString();
            }
            else
            {
                rfc.Cateinfra = null;
            }

            //Solicitante
            if (txtbussolicitante.Text != "")
            {
                solicitud.Nomsolicitante = txtbussolicitante.Text;
            }
            else
            {
                solicitud.Nomsolicitante = null;
            }

            //Coordinador
            if (txtbuscoordinador.Text != "")
            {
                rfc.Coordinador = txtbuscoordinador.Text;
            }
            else
            {
                rfc.Coordinador = null;
            }

            //Empresa Afectada
            if (cbobusempresa.SelectedIndex != 0 && cbobusempresa.SelectedIndex != -1)
            {
                solicitud.Empresa = cbobusempresa.SelectedItem.ToString();
            }
            else
            {
                solicitud.Sociedadafectada = -1;
            }

            //Area Solicitante
            if (cbobusareasoli.SelectedIndex != 0 && cbobusareasoli.SelectedIndex != -1)
            {
                solicitud.Areasolicitante = (Int32)cbobusareasoli.SelectedIndex;
            }
            else
            {
                solicitud.Areasolicitante = -1;
            }

            if (radioButtonFR.Checked)
            {
                solicitud.Fechsolicitud       = dateTimePickerbusIni.Value;
                solicitud.Fecpropuesta        = dateTimePickerbusFin.Value;
                rfc.Fecprogramadaejecucion    = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecprogramadafinalizacion = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecharealejecucion        = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecharealfinalizacion     = new DateTime(1900, 01, 01, 00, 00, 00);
            }
            else
            {
                solicitud.Fechsolicitud = new DateTime(1900, 01, 01, 00, 00, 00);
                solicitud.Fecpropuesta  = new DateTime(1900, 01, 01, 00, 00, 00);
            }

            if (radioButtonFIP.Checked)
            {
                rfc.Fecprogramadaejecucion    = dateTimePickerbusIni.Value;
                rfc.Fecprogramadafinalizacion = dateTimePickerbusFin.Value;
                rfc.Fecharealejecucion        = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecharealfinalizacion     = new DateTime(1900, 01, 01, 00, 00, 00);
                solicitud.Fechsolicitud       = new DateTime(1900, 01, 01, 00, 00, 00);
                solicitud.Fecpropuesta        = new DateTime(1900, 01, 01, 00, 00, 00);
            }
            else
            {
                rfc.Fecprogramadaejecucion    = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecprogramadafinalizacion = new DateTime(1900, 01, 01, 00, 00, 00);

                if (radioButtonFIR.Checked)
                {
                    rfc.Fecharealejecucion        = dateTimePickerbusIni.Value;
                    rfc.Fecharealfinalizacion     = dateTimePickerbusFin.Value;
                    rfc.Fecprogramadaejecucion    = new DateTime(1900, 01, 01, 00, 00, 00);
                    rfc.Fecprogramadafinalizacion = new DateTime(1900, 01, 01, 00, 00, 00);
                    solicitud.Fechsolicitud       = new DateTime(1900, 01, 01, 00, 00, 00);
                    solicitud.Fecpropuesta        = new DateTime(1900, 01, 01, 00, 00, 00);
                }
                else
                {
                    rfc.Fecharealejecucion    = new DateTime(1900, 01, 01, 00, 00, 00);
                    rfc.Fecharealfinalizacion = new DateTime(1900, 01, 01, 00, 00, 00);
                }

                if (VariablesGlobales.TipoRol != "Gestor")
                {
                    rfc.Coordinador = VariablesGlobales.nomUsu;
                }
            }
            DataTable dt = dao.selectCostum(rfc, solicitud, true, false, tipoCambio);



            if (dt == null)
            {
                MessageBox.Show("No Hay Datos");
            }
            else
            {
                //DataGridView dg = new DataGridView();
                //dg.DataSource = dt;
                dataGridView1.DataSource = dt;
            }
        }
コード例 #8
0
ファイル: Menu.cs プロジェクト: cescaba/AppCambios
        private void saveFileDialog1_FileOk_1(object sender, CancelEventArgs e)
        {
            // Get file name.
            string name = saveFileDialog1.FileName;

            //DataGrid
            DTORfc       rfc        = new DTORfc();
            DTOSolicitud solicitud  = new DTOSolicitud();
            DAORFC       dao        = new DAORFC();
            int          tipoCambio = 0;


            //Estado
            if (cbobusestado.SelectedIndex != 0 && cbobusestado.SelectedIndex != -1)
            {
                rfc.Estado = cbobusestado.SelectedItem.ToString();
            }
            else
            {
                rfc.Estado = null;
            }

            //Indisponibilidad
            if (cbobusindis.SelectedIndex != 0 && cbobusindis.SelectedIndex != -1)
            {
                rfc.Indisponibilidad = (Int32)cbobusindis.SelectedValue;
            }
            else
            {
                rfc.Indisponibilidad = -1;
            }

            //Tipo de cambio
            if (radioButtonall.Checked)
            {
                tipoCambio = 1;
            }

            if (radioButtonMenor.Checked)
            {
                tipoCambio = 2;
            }
            if (radioButtonMed.Checked)
            {
                tipoCambio = 3;
            }
            if (radioButtonUrg.Checked)
            {
                tipoCambio = 4;
            }

            //Area del Cambio - Categoria Activo
            if (cbobusareacambio.SelectedIndex != 0 && cbobusareacambio.SelectedIndex != -1)
            {
                rfc.Cateinfra = cbobusareacambio.SelectedItem.ToString();
            }
            else
            {
                rfc.Cateinfra = null;
            }

            //Solicitante
            if (txtbussolicitante.Text != "")
            {
                solicitud.Nomsolicitante = txtbussolicitante.Text;
            }
            else
            {
                solicitud.Nomsolicitante = null;
            }

            //Coordinador
            if (txtbuscoordinador.Text != "")
            {
                rfc.Coordinador = txtbuscoordinador.Text;
            }
            else
            {
                rfc.Coordinador = null;
            }

            //Empresa Afectada
            if (cbobusempresa.SelectedIndex != 0 && cbobusempresa.SelectedIndex != -1)
            {
                solicitud.Sociedadafectada = (Int32)cbobusempresa.SelectedValue;
            }
            else
            {
                solicitud.Sociedadafectada = -1;
            }

            //Area Solicitante
            if (cbobusareasoli.SelectedIndex != 0 && cbobusareasoli.SelectedIndex != -1)
            {
                solicitud.Areasolicitante = (Int32)cbobusareasoli.SelectedValue;
            }
            else
            {
                solicitud.Areasolicitante = -1;
            }

            if (radioButtonFR.Checked)
            {
                solicitud.Fechsolicitud       = dateTimePickerbusIni.Value;
                solicitud.Fecpropuesta        = dateTimePickerbusFin.Value;
                rfc.Fecprogramadaejecucion    = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecprogramadafinalizacion = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecharealejecucion        = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecharealfinalizacion     = new DateTime(1900, 01, 01, 00, 00, 00);
            }
            else
            {
                solicitud.Fechsolicitud = new DateTime(1900, 01, 01, 00, 00, 00);
                solicitud.Fecpropuesta  = new DateTime(1900, 01, 01, 00, 00, 00);
            }

            if (radioButtonFIP.Checked)
            {
                rfc.Fecprogramadaejecucion    = dateTimePickerbusIni.Value;
                rfc.Fecprogramadafinalizacion = dateTimePickerbusFin.Value;
                rfc.Fecharealejecucion        = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecharealfinalizacion     = new DateTime(1900, 01, 01, 00, 00, 00);
                solicitud.Fechsolicitud       = new DateTime(1900, 01, 01, 00, 00, 00);
                solicitud.Fecpropuesta        = new DateTime(1900, 01, 01, 00, 00, 00);
            }
            else
            {
                rfc.Fecprogramadaejecucion    = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecprogramadafinalizacion = new DateTime(1900, 01, 01, 00, 00, 00);
            }

            if (radioButtonFIR.Checked)
            {
                rfc.Fecharealejecucion        = dateTimePickerbusIni.Value;
                rfc.Fecharealfinalizacion     = dateTimePickerbusFin.Value;
                rfc.Fecprogramadaejecucion    = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecprogramadafinalizacion = new DateTime(1900, 01, 01, 00, 00, 00);
                solicitud.Fechsolicitud       = new DateTime(1900, 01, 01, 00, 00, 00);
                solicitud.Fecpropuesta        = new DateTime(1900, 01, 01, 00, 00, 00);
            }
            else
            {
                rfc.Fecharealejecucion    = new DateTime(1900, 01, 01, 00, 00, 00);
                rfc.Fecharealfinalizacion = new DateTime(1900, 01, 01, 00, 00, 00);
            }
            DataGridView dg = new DataGridView();

            if (VariablesGlobales.TipoRol != "Gestor")
            {
                rfc.Coordinador = VariablesGlobales.nomUsu;
            }

            //DataTable dt = dao.selectCostum(rfc, solicitud, false, false);



            DataTable dt = dao.selectMiguel(rfc, solicitud, tipoCambio);



            if (dt == null)
            {
                MessageBox.Show("No Hay Datos");
            }
            else
            {
                // Write to the file name selected.
                // ... You can write the text from a TextBox instead of a string literal.
                Excel.Application xlApp;
                Excel.Workbook    xlWorkBook;
                Excel.Worksheet   xlWorkSheet;
                object            misValue = System.Reflection.Missing.Value;

                xlApp       = new Excel.Application();
                xlWorkBook  = xlApp.Workbooks.Add(misValue);
                xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
                int i = 0;
                int j = 0;


                string[] columnNames = dt.Columns.Cast <DataColumn>()
                                       .Select(x => x.ColumnName)
                                       .ToArray();

                for (j = 0; j <= columnNames.Length - 1; j++)
                {
                    xlWorkSheet.Cells[1, j + 1] = columnNames[j];
                }


                for (i = 0; i <= dt.Rows.Count - 1; i++)
                {
                    for (j = 0; j <= dt.Columns.Count - 1; j++)
                    {
                        //DataGridViewCell cell = dt[j, i];
                        xlWorkSheet.Cells[i + 2, j + 1] = dt.Rows[i][j];
                    }
                }

                xlWorkBook.SaveAs(name, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);

                xlWorkBook.Close(true, misValue, misValue);
                xlApp.Quit();

                releaseObject(xlWorkSheet);
                releaseObject(xlWorkBook);
                releaseObject(xlApp);
            }
        }