Пример #1
0
        private void cmdCertificado_Click(object sender, EventArgs e)
        {
            DataSet   DSDevuelveID = new DataSet();
            DataTable DTDevuelveID = new DataTable();

            WSLicitaciones.WSLicitaciones WSLic = new WSLicitaciones.WSLicitaciones();
            WSLic.Url = mdlGenerales.DireccionWS + "FazServices/WSLicitaciones.asmx";

            if (txtTitulo.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar el titulo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtTitulo.Focus();
                return;
            }

            if (txtCentroEstudios.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar el centro de estudios", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCentroEstudios.Focus();
                return;
            }

            /*try
            *  {
            *   if (txtArchivo.Text != "")
            *       DeleteFile(txtArchivo.Text);
            *  }
            *  catch
            *  { }*/

            string NombreArchivo = string.Concat(txtNDoc.Text.ToString(), "_", txtTitulo.Text.ToString(), "_", txtCentroEstudios.Text.ToString(), "_", dtpExpedicion.Value.ToString("yyyyMMdd"));

            NombreArchivo = NombreArchivo.Replace(" ", "");
            string extension = "";

            /*************************
            * Subiendo Constancia
            *************************/
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK) // Test result.
            {
                FileInfo fi = new FileInfo(openFileDialog1.FileName);
                if (fi.Exists)
                {
                    extension = fi.Extension.ToString();
                    fi.CopyTo(openFileDialog1.FileName.Replace(openFileDialog1.SafeFileName, "") + NombreArchivo + extension);
                }
                Upload(openFileDialog1.FileName.Replace(openFileDialog1.SafeFileName, "") + NombreArchivo + extension, "");
                File.Delete(openFileDialog1.FileName.Replace(openFileDialog1.SafeFileName, "") + NombreArchivo + extension);
            }
            else
            {
                MessageBoxAdv.Show("Se cancelo el registro", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string Item = "";

            if (lblItem.Text.ToString() == ("0"))
            {
                Item = "0";
            }
            else
            {
                Item = lblItem.Text.ToString();
            }

            DSDevuelveID = WSLic.ActualizaPersonalLicEstudios(mdlGenerales.Conexion,
                                                              txtTipoDoc.Text.ToString(), txtNDoc.Text.ToString(), lblItem.Text,
                                                              IDTipo[Convert.ToInt32(cmbTipo.SelectedIndex.ToString())].ToString(),
                                                              txtTitulo.Text.ToString(), txtCentroEstudios.Text.ToString(),
                                                              dtpExpedicion.Value.ToString("yyyy/MM/dd"), NombreArchivo + extension, mdlGenerales.STRUsuario);
            DTDevuelveID = DSDevuelveID.Tables[0];
            String strResultado = "";
            Int32  intResultado = 0;

            foreach (DataRow Row in DTDevuelveID.Rows)
            {
                intResultado = Convert.ToInt32(Row[0].ToString());
                strResultado = Row[1].ToString();
            }

            if (intResultado != 0)
            {
                MessageBoxAdv.Show(strResultado, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Limpiar();
                CargaGrid(txtTipoDoc.Text.ToString(), txtNDoc.Text.ToString(), txtNombres.Text.ToString(),
                          txtApellidos.Text.ToString(), txtTelefono.Text.ToString(), txtEmail.Text.ToString());
            }
            else
            {
                MessageBoxAdv.Show(strResultado, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void cmdEstudioSC_Click(object sender, EventArgs e)
        {
            DataSet   DSDevuelveID = new DataSet();
            DataTable DTDevuelveID = new DataTable();

            WSLicitaciones.WSLicitaciones WSLic = new WSLicitaciones.WSLicitaciones();
            WSLic.Url = mdlGenerales.DireccionWS + "FazServices/WSLicitaciones.asmx";
            if (txtTitulo.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar el titulo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtTitulo.Focus();
                return;
            }
            if (txtCentroEstudios.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar el centro de estudios", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCentroEstudios.Focus();
                return;
            }

            /*try
            *  {
            *   if (txtArchivo.Text != "")
            *       DeleteFile(txtArchivo.Text);
            *  }
            *  catch
            *  { }*/
            string Item = "";

            if (lblItem.Text.ToString() == ("0"))
            {
                Item = "0";
            }
            else
            {
                Item = lblItem.Text.ToString();
            }
            DSDevuelveID = WSLic.ActualizaPersonalLicEstudios(mdlGenerales.Conexion,
                                                              txtTipoDoc.Text.ToString(), txtNDoc.Text.ToString(), lblItem.Text,
                                                              IDTipo[Convert.ToInt32(cmbTipo.SelectedIndex.ToString())].ToString(),
                                                              txtTitulo.Text.ToString(), txtCentroEstudios.Text.ToString(),
                                                              dtpExpedicion.Value.ToString("yyyy/MM/dd"), "", mdlGenerales.STRUsuario);
            DTDevuelveID = DSDevuelveID.Tables[0];
            String strResultado = "";
            Int32  intResultado = 0;

            foreach (DataRow Row in DTDevuelveID.Rows)
            {
                intResultado = Convert.ToInt32(Row[0].ToString());
                strResultado = Row[1].ToString();
            }

            if (intResultado != 0)
            {
                MessageBoxAdv.Show(strResultado, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Limpiar();
                CargaGrid(txtTipoDoc.Text.ToString(), txtNDoc.Text.ToString(), txtNombres.Text.ToString(),
                          txtApellidos.Text.ToString(), txtTelefono.Text.ToString(), txtEmail.Text.ToString());
            }
            else
            {
                MessageBoxAdv.Show(strResultado, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }