Exemplo n.º 1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            //if (txtMotivo.Text == "") {
            //    MessageBox.Show("debe ingresar un motivo válido");
            //    return;
            //}

            DateTime dtFechaInicial = Convert.ToDateTime(this.dtInicio.Text);
            DateTime dtFechaFinal   = Convert.ToDateTime(this.dtFin.Text);


            if (dtFechaInicial > dtFechaFinal)
            {
                MessageBox.Show("Rango de fechas no válido");
                return;
            }


            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();
            int rutUsuarioGeneraPermiso        = (int)Common.rut;
            //rutUsuarioGeneraPermiso = 19;
            //int permisoFuncionario = VHWS.getAntiguedadFun(rutUsuarioGeneraPermiso);

            PermisoBLL permisoBL = new PermisoBLL();
            var        motivo    = Convert.ToInt32((((System.Data.DataRowView)(cbMotivoPermiso.SelectedValue)).Row).ItemArray[0]);

            int resultadoPermiso = permisoBL.insertarPermiso(dtFechaInicial, dtFechaFinal, (int)Common.rut, motivo);

            Common.LogTxt("Permiso Generado", Common.rut.ToString());
            MessageBox.Show("Permiso solicitado correctamente");
        }
        private void btnSituacionEmp_Click(object sender, EventArgs e)
        {
            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();

            try
            {
                string resp = VHWS.getSituacionEmpleado((int)Common.rut);
                MessageBox.Show("Estado Empleado: " + resp);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 3
0
        private void btnValidezDocumento_Click(object sender, EventArgs e)
        {
            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();

            Boolean resp = VHWS.validateDoc(txtDocValidar.Text);

            //Boolean resp = true;
            if (resp == true)
            {
                MessageBox.Show("Documento Valido. Tenga como consideración la fecha de vencimiento de este");
            }
            else
            {
                MessageBox.Show("Documento Vencido y/o Codigo Erroneo. Verifique el correcto ingreso del codigo");
            }
        }
Exemplo n.º 4
0
        private void Execution()
        {
            CheckForIllegalCrossThreadCalls = false;
            metroButton1.Invoke((MethodInvoker) delegate { spnLoad.Visible = true; lblLoad.Visible = true; metroButton1.Enabled = false; });
            Application.DoEvents();

            int    rutUsuario = Convert.ToInt32(this.txtRut.Text);
            string password   = this.txtContraseña.Text;

            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();

            Boolean resp = VHWS.Autenticate(rutUsuario, password);

            //int result = negocioUsuario.validarLoginUsuario(rutUsuario, password);
            //if (result == 1)
            if (resp)
            {
                UsuarioBLL negocio       = new UsuarioBLL();
                RolBLL     rolNegocio    = new RolBLL();
                var        usuarioActual = negocio.buscarUsuario(rutUsuario.ToString());
                //var rolAsociado =  rolNegocio.getById(rutUsuario);
                Common.direccion = usuarioActual.DIR_PARTICULAR;
                Common.email     = usuarioActual.EMAIL;
                Common.rut       = usuarioActual.RUT_USUARIO;
                //Common.cargo = usuarioActual.CARGO;
                Common.rol = (int)usuarioActual.ID_ROL;
                //txtApMat.Text = usuarioActual.AP_MATERNO;
                //txtApPat.Text = usuarioActual.AP_PATERNO;
                //txtCargo.Text = usuarioActual.CARGO;
                //txtDir.Text = usuarioActual.DIR_PARTICULAR;
                //txtEmail.Text = usuarioActual.EMAIL;
                //txtNombre.Text = usuarioActual.NOMBRE;
                //txtTelIns.Text = usuarioActual.TEL_INSTITUCIONAL;
                //txtTelPart.Text = usuarioActual.TEL_PARTICULAR;
                //txtCargo.Text = usuarioActual.CARGO;
                //txtRut.Text = usuarioActual.RUT_USUARIO.ToString();
                //cboUnidad.SelectedValue = usuarioActual.ID_UNIDAD_INTERNA;
                Common.LogTxt("Usuario Logueado", Common.rut.ToString());
                this.Hide();
                showFormBusqueda();
            }
            else
            {
                MessageBox.Show("Usuario no existe", "Error", MessageBoxButtons.OK);
                metroButton1.Invoke((MethodInvoker) delegate { spnLoad.Visible = false; lblLoad.Visible = false; metroButton1.Enabled = true; });
            }
        }
Exemplo n.º 5
0
        private void RMUnidadInterna_Load(object sender, EventArgs e)
        {
            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();

            var resp = VHWS.getResolucionAll().ToList();



            //foreach (var item in resp)
            //{
            //    item.estado = "gola";
            //    //aux.Add(item);
            //}
            var source = new BindingSource(resp, null);

            grdUnidadInterna.DataSource = source;
        }
        private void frmResumenPermisoUI_Load(object sender, EventArgs e)
        {
            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();

            var resp = VHWS.lstCantidadPermisoEstado().ToList();



            //foreach (var item in resp)
            //{
            //    item.estado = "gola";
            //    //aux.Add(item);
            //}
            var source = new BindingSource(resp, null);

            grdUnidadInterna.DataSource = source;
        }
        private void btnDescargaPdf_Click(object sender, EventArgs e)
        {
            PdfDocument         pdf = new PdfDocument();
            PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();

            htmlLayoutFormat.IsWaiting = false;
            PdfPageSettings setting = new PdfPageSettings();

            setting.Size = PdfPageSize.A4;
            Dictionary <string, string> datosFrm = new Dictionary <string, string>();
            UsuarioBLL negocioUsuario            = new UsuarioBLL();

            DAL.VS_Login.VHWServiceClient VHWS = new DAL.VS_Login.VHWServiceClient();

            var resp = VHWS.lstCantidadPermisoEstado().ToList();
            //datosFrm = negocioUsuario.frmPermisoUsuario(1061);
            //string idSolicitud = (new System.Collections.Generic.Mscorlib_DictionaryDebugView<string, string>(datosFrm)).Items[0].Value;
            //string rutFuncionario = (new System.Collections.Generic.Mscorlib_DictionaryDebugView<string, string>(datosFrm)).Items[3].Value;
            //string htmlCode = File.ReadAllText("..\\..\\2.html");
            string htmlCode = @"<h1 style='text-align: center;'><span style='text-decoration: underline;'>Resumen de permisos por unidad interna</span></h1><p>&nbsp;</p>";

            foreach (var item in resp)
            {
                htmlCode = htmlCode + @"<p style='text-align: center;'><em><strong>ID UNIDAD INTERNA: {0}</strong></em></p>
<p style='text-align: center;'>&nbsp;</p>
<p style='text-align: center;'><em><strong>CANTIDAD: {1}</strong></em></p>
<p style='text-align: center;'>&nbsp;</p>
<p style='text-align: center;'><em><strong>RECURSO LEGAL: {2}</strong></em></p>
<p>&nbsp;</p>
<p>&nbsp;</p>";
                htmlCode = string.Format(htmlCode, item.unidadInterna, item.cantidad, item.recursoLegal);
            }

            htmlCode = htmlCode.Replace(System.Environment.NewLine, string.Empty);

            Thread thread = new Thread(() =>
                                       { pdf.LoadFromHTML(htmlCode, false, setting, htmlLayoutFormat); });

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            thread.Join();

            SaveFileDialog MyFiles = new SaveFileDialog();

            MyFiles.Filter     = "PDF Files|*.pdf";
            MyFiles.Title      = "GUARDAR COMPROBANTE PERMISO";
            MyFiles.DefaultExt = "*.pdf";
            MyFiles.FileName   = "resumenPermisoUnidadInterna";
            if (MyFiles.ShowDialog() == DialogResult.OK)
            {
                if (File.Exists(MyFiles.FileName))
                {
                    File.Delete(MyFiles.FileName);
                }

                //File.Copy(path, MyFiles.FileName);
                pdf.SaveToFile(MyFiles.FileName);
            }


            //System.Diagnostics.Process.Start("output.pdf");
        }