示例#1
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);
            }
        }