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

            if (txtRuc.Text.ToString().Replace(" ", "") == "")
            {
                MessageBoxAdv.Show("El Ruc debe de tener 11 digitos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRuc.Focus();
                return;
            }

            if (txtRuc.Text.ToString().Length != 11)
            {
                MessageBoxAdv.Show("Debe de registrar el número de Ruc de la empresa", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRuc.Focus();
                return;
            }

            if (ValidarSoloNumeros(txtRuc.Text.ToString()) == false)
            {
                MessageBoxAdv.Show("El Número de documento solo debe de contener números", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRuc.Focus();
                return;
            }


            if (txtNRP.Text.ToString().Replace(" ", "") == "")
            {
                MessageBoxAdv.Show("Debe de registrar el número de NRP", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtNRP.Focus();
                return;
            }
            if (txtRazonSocial.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar la Razón Social de la empresa", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRazonSocial.Focus();
                return;
            }

            if (MayorACero(txtCapacidad.Text.ToString()) == false)
            {
                MessageBoxAdv.Show("La capacidad debe de ser un valor númerico mayor a 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCapacidad.Focus();
                return;
            }
            if (chkPendiente.Checked == true)
            {
                if (txtObservaciones.Text == "")
                {
                    MessageBoxAdv.Show("Debe de registrar en observaciones que es lo que tiene pendiente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtDireccion.Focus();
                    return;
                }
                Spendiente = "1";
            }
            else
            {
                Spendiente = "0";
            }

            WSLicitaciones.WSLicitaciones WSLic = new WSLicitaciones.WSLicitaciones();
            WSLic.Url    = mdlGenerales.DireccionWS + "FazServices/WSLicitaciones.asmx";
            DSDevuelveID = WSLic.ActualizaEmpresaLic(mdlGenerales.Conexion,
                                                     txtRuc.Text.ToString().Replace(" ", ""), txtNRP.Text.ToString().Replace(" ", ""),
                                                     txtRazonSocial.Text.ToString(), txtCapacidad.Text.ToString(), dptFechaCreacion.Value.ToString("yyyy/MM/dd"),
                                                     txtDireccion.Text.ToString(), txtTelefono1.Text.ToString(), txtTelefono2.Text.ToString(),
                                                     txtEmail.Text.ToString(), txtObservaciones.Text, Spendiente, txtRepresentante.Text.ToString(), mdlGenerales.STRUsuario);
            DTDevuelveID = DSDevuelveID.Tables[0];
            Limpiar();
            MessageBoxAdv.Show("Se actualizo el personal", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
            CargaGrid();
        }
Пример #2
0
        private void cmdSubirCurriculum_Click(object sender, EventArgs e)
        {
            DataSet   DSDevuelveID = new DataSet();
            DataTable DTDevuelveID = new DataTable();
            String    Spendiente   = "";

            if (ValidarSoloNumeros(txtRuc.Text.ToString()) == false)
            {
                MessageBoxAdv.Show("El Número de documento solo debe de contener números", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRuc.Focus();
                return;
            }

            if (txtRuc.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar el número de Ruc de la empresa", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRuc.Focus();
                return;
            }
            if (txtNRP.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar el número de NRP", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtNRP.Focus();
                return;
            }
            if (txtRazonSocial.Text.ToString() == "")
            {
                MessageBoxAdv.Show("Debe de registrar la Razón Social de la empresa", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRazonSocial.Focus();
                return;
            }
            if (MayorACero(txtCapacidad.Text.ToString()) == false)
            {
                MessageBoxAdv.Show("La capacidad debe de ser un valor númerico mayor a 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCapacidad.Focus();
                return;
            }
            if (chkPendiente.Checked == true)
            {
                if (txtObservaciones.Text == "")
                {
                    MessageBoxAdv.Show("Debe de registrar en observaciones que es lo que tiene pendiente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtDireccion.Focus();
                    return;
                }
                Spendiente = "1";
            }
            else
            {
                Spendiente = "0";
            }

            WSLicitaciones.WSLicitaciones WSLic = new WSLicitaciones.WSLicitaciones();
            WSLic.Url    = mdlGenerales.DireccionWS + "FazServices/WSLicitaciones.asmx";
            DSDevuelveID = WSLic.ActualizaEmpresaLic(mdlGenerales.Conexion,
                                                     txtRuc.Text.ToString().Replace(" ", ""), txtNRP.Text.ToString().Replace(" ", ""), txtRazonSocial.Text.ToString(),
                                                     txtCapacidad.Text.ToString(), dptFechaCreacion.Value.ToString("yyyy/MM/dd"),
                                                     txtDireccion.Text.ToString(), txtTelefono1.Text.ToString(), txtTelefono2.Text.ToString(),
                                                     txtEmail.Text.ToString(), txtObservaciones.Text, Spendiente, txtRepresentante.Text.ToString(), mdlGenerales.STRUsuario);
            DTDevuelveID = DSDevuelveID.Tables[0];

            DataSet   DSDevuelveValidacion = new DataSet();
            DataTable DTDevuelveValidacion = new DataTable();
            String    strResultado         = "";
            Int32     intResultado         = 0;

            /*************************
            * Validación de  datos
            *************************/
            /*try
            *  {
            *   if (txtArchivo.Text != "")
            *       DeleteFile(txtArchivo.Text);
            *  }
            *  catch
            *  { }*/
            string NombreArchivo = string.Concat("C1V3E2_" + txtRuc.Text.ToString());

            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;
            }

            /************************************
            * Registrando experiencia en BD
            ************************************/
            DSDevuelveID = WSLic.ActualizaEmpresaLicArchivo(mdlGenerales.Conexion,
                                                            txtRuc.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();
            }
            else
            {
                MessageBoxAdv.Show(strResultado, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }