Пример #1
0
        private void cmdExperienciaSC_Click(object sender, EventArgs e)
        {
            DataSet   DSDevuelveID         = new DataSet();
            DataTable DTDevuelveID         = new DataTable();
            DataSet   DSDevuelveValidacion = new DataSet();
            DataTable DTDevuelveValidacion = new DataTable();
            String    strResultado         = "";
            Int32     intResultado         = 0;

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

            if (txtCertificacion.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar el detalle de la certificación", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCertificacion.Focus();
                return;
            }

            if (txtEntidad.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar la entidad certificadora", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEntidad.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.ActualizaCertificacionesEmpresa(mdlGenerales.Conexion,
                                                                 txtNumeroRuc.Text.ToString(), lblItem.Text.ToString(),
                                                                 txtCertificacion.Text.ToString(), dtpVencimiento.Value.ToString("yyyy/MM/dd"),
                                                                 txtEntidad.Text.ToString(), "",
                                                                 mdlGenerales.STRUsuario);

            DTDevuelveID = DSDevuelveID.Tables[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(txtNumeroRuc.Text.ToString(), txtRazonSocial.Text.ToString(),
                          txtNRP.Text.ToString(), txtCapacidad.Text.ToString());
            }
            else
            {
                MessageBoxAdv.Show(strResultado, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void cmdConstancia_Click(object sender, EventArgs e)
        {
            WSLicitaciones.WSLicitaciones WSLic = new WSLicitaciones.WSLicitaciones();
            WSLic.Url = mdlGenerales.DireccionWS + "FazServices/WSLicitaciones.asmx";
            DataSet   DSDevuelveID         = new DataSet();
            DataTable DTDevuelveID         = new DataTable();
            DataSet   DSDevuelveValidacion = new DataSet();
            DataTable DTDevuelveValidacion = new DataTable();
            String    strResultado         = "";
            Int32     intResultado         = 0;
            string    strConsorcio         = "";
            string    strTipoCambio        = "";

            /*************************
            * Validación de  datos
            *************************/

            if (txtCertificacion.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar el detalle de la certificación", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCertificacion.Focus();
                return;
            }

            if (txtEntidad.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar la entidad certificadora", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEntidad.Focus();
                return;
            }

            /*try
            *  {
            *   if (txtArchivo.Text != "")
            *       DeleteFile(txtArchivo.Text);
            *  }
            *  catch
            *  { }*/
            string NombreArchivo = string.Concat("E_C_", txtNumeroRuc.Text.ToString(), "_", txtEntidad.Text.ToString(), "_", dtpVencimiento.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();
            }

            Int32 Consorcio = 0;

            /************************************
            * Registrando experiencia en BD
            ************************************/
            DSDevuelveID = WSLic.ActualizaCertificacionesEmpresa(mdlGenerales.Conexion,
                                                                 txtNumeroRuc.Text.ToString(), lblItem.Text.ToString(),
                                                                 txtCertificacion.Text.ToString(), dtpVencimiento.Value.ToString("yyyy/MM/dd"),
                                                                 txtEntidad.Text.ToString(), NombreArchivo + extension,
                                                                 mdlGenerales.STRUsuario);
            DTDevuelveID = DSDevuelveID.Tables[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(txtNumeroRuc.Text.ToString(), txtRazonSocial.Text.ToString(),
                          txtNRP.Text.ToString(), txtCapacidad.Text.ToString());
            }
            else
            {
                MessageBoxAdv.Show(strResultado, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }