/*protected void LogginButton_Click(object sender, EventArgs e)
         * {
         *  try
         *  {
         *      String correo = txtEmail.Text;
         *      String paswordtmp = validacionesClass.CrearPasswordTmp(10);
         *
         *      //OCKO_TblEmpleado empleadoLocal =  OCKOEmpleadoUsuario.recuperarContraseña(correo);
         *      if (OCKOEmpleadoUsuario.recuperarContraseña(correo))
         *      {
         *          empleadoTable = empleadoClass.recuperarContraseñas(correo);
         *          usuarioTable = usuarioClass.BuscarIdUsuario(empleadoTable.EmpId);
         *          usuarioTable.UsuContraseña = paswordtmp;
         *          usuarioClass.ActualizarUsuario(usuarioTable);
         *
         *          Mensaje = "Estimado " + empleadoTable.EmpPrimerNombre + " " + empleadoTable.EmpPrimerApellido + Environment.NewLine;
         *          Mensaje += "Se ha Generado su clave temporal necesaria para ingresar al sistema. " + Environment.NewLine;
         *          Mensaje += "Usuario " + usuarioTable.Usunombre + "" + Environment.NewLine;
         *          Mensaje += "Contraseña Temporal " + paswordtmp + "" + Environment.NewLine;
         *          Mensaje += "Una vez que haya ingresado al sistema favor en su perfil cambiar su Clave. " + Environment.NewLine + Environment.NewLine;
         *          Mensaje += "ATT: Administracion.  " + Environment.NewLine + Environment.NewLine;
         *          Mensaje += "(Las tildes han sido omitidas intencionalmente para evitar problemas de lectura) " + Environment.NewLine;
         *          validacionesClass.enviarEmail(empleadoTable.EmpEmail, "Notificacion Recuperar Contraseña", Mensaje);
         *          Response.Write("<script>window.alert('EL EMAIL FUE ENVIADO CORRECTAMENTE')</script>");
         *
         *      }
         *      else
         *      {
         *          Response.Write("<script>window.alert('EL CORREO NO EXISTE EN EL SISTEMA')</script>");
         *      }
         *  }
         *  catch (Exception EX)
         *  {
         *      Response.Write("<script>window.alert('Sucedio un Error')</script>");
         *  }
         *
         *
         * }
         */

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            try
            {
                String correo     = txtEmail.Text;
                String paswordtmp = validacionesClass.CrearPasswordTmp(10);

                //OCKO_TblEmpleado empleadoLocal =  OCKOEmpleadoUsuario.recuperarContraseña(correo);
                if (OCKOEmpleadoUsuario.recuperarContraseña(correo))
                {
                    empleadoTable = empleadoClass.recuperarContraseñas(correo);
                    usuarioTable  = usuarioClass.BuscarIdUsuario(empleadoTable.EmpId);
                    usuarioTable.UsuContraseña = paswordtmp;
                    usuarioClass.ActualizarUsuario(usuarioTable);

                    Mensaje  = "Estimado " + empleadoTable.EmpPrimerNombre + " " + empleadoTable.EmpPrimerApellido + Environment.NewLine;
                    Mensaje += "Se ha Generado su clave temporal necesaria para ingresar al sistema. " + Environment.NewLine;
                    Mensaje += "Usuario     :" + usuarioTable.Usunombre + "" + Environment.NewLine;
                    Mensaje += "Contraseña Temporal     :" + paswordtmp + "" + Environment.NewLine;
                    Mensaje += "Una vez que haya ingresado al sistema favor en su perfil cambiar su Clave. " + Environment.NewLine + Environment.NewLine;
                    Mensaje += "ATT: Administracion.  " + Environment.NewLine + Environment.NewLine;
                    Mensaje += "(Las tildes han sido omitidas intencionalmente para evitar problemas de lectura) " + Environment.NewLine;
                    validacionesClass.enviarEmail(empleadoTable.EmpEmail, "Notificacion Recuperar Contraseña", Mensaje);
                    Response.Write("<script>window.alert('EL EMAIL FUE ENVIADO CORRECTAMENTE')</script>");
                }
                else
                {
                    Response.Write("<script>window.alert('EL CORREO NO EXISTE EN EL SISTEMA')</script>");
                }
            }
            catch (Exception EX)
            {
                Response.Write("<script>window.alert('Sucedio un Error')</script>");
            }
        }
        protected void btnEditar_Click(object sender, EventArgs e)
        {
            OCKO_TblEmpleado emple = empleado.BuscarIdEmpleado(Convert.ToInt32(hdId.Value));

            emple.EmpCedula = txetCargo.Text;
            empleado.ActualizarEmpleado(emple);
            Response.Redirect("RRHH_EmployeeList.aspx");
        }
 protected void GrvCliente_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         GridViewRow row = GrvCliente.SelectedRow;
         id         = row.Cells[1].Text;
         hdId.Value = id;
         OCKO_TblEmpleado or = empleado.BuscarIdEmpleado(Convert.ToInt32(hdId.Value));
         txetCargo.Text = or.EmpCedula;
     }
     catch
     {
     }
 }
Example #4
0
        private void GetNombresAsp()
        {
            int proyectoId         = int.Parse(Session["ProyectoIdAsignacion"].ToString());
            int encargadoFuncional = int.Parse(Session["EncargadoFuncional"].ToString());
            int encargadoTecnico   = int.Parse(Session["EncargadoTecnico"].ToString());

            empleadoTable        = empleadoClass.BuscarIdEmpleado(encargadoFuncional);
            ArquitectaFinanciera = empleadoTable.EmpPrimerNombre + " " + empleadoTable.EmpSegundoApellidos;

            empleadoTable      = empleadoClass.BuscarIdEmpleado(encargadoTecnico);
            ArquitectoSoftware = empleadoTable.EmpPrimerNombre + " " + empleadoTable.EmpSegundoApellidos;

            proyectoTable = proyectoClass.BuscarIdProyecto(proyectoId);
            ProyectoName  = proyectoTable.ProNombre;
        }
        protected void grvJefes_SelectedIndexChanged(object sender, EventArgs e)
        {
            pnlBotones.Visible = true;
            try
            {
                GridViewRow row = grvJefes.SelectedRow;
                id         = row.Cells[0].Text;
                hdId.Value = id;

                OCKO_TblEmpleado or = empleado.BuscarIdEmpleado(Convert.ToInt32(hdId.Value));
                txtCedula.Text          = or.EmpCedula;
                txtPrimerNombre.Text    = or.EmpPrimerNombre;
                txtSegundoNombre.Text   = or.EmpSegundoNombre;
                txtPrimerApellido.Text  = or.EmpPrimerApellido;
                txtSegundoApellido.Text = or.EmpSegundoApellidos;
            }
            catch
            {
            }
        }
 //
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CargarDDL();
     }
     if (Session["Username"] != null)
     {
         tblusuario    = usu.OckoBbuscarPorNombre(Session["Username"].ToString());
         empleadoTable = usu.BuscarIdEmpleado(tblusuario.UsuId);
         empresaTable  = empresaClass.BuscarIdEmpresa(Convert.ToInt32(empleadoTable.CodEmpresa));
         Empresa       = empresaTable.EmpNombre;
         sesion        = tblusuario.Usunombre.ToUpper();
         sesionNombre  = empleadoTable.EmpPrimerNombre.ToUpper() + " " + empleadoTable.EmpPrimerApellido.ToUpper();
     }
     else
     {
         Response.Redirect("/Login1.aspx");
     }
 }
Example #7
0
        private void LlenarDatos()
        {
            try
            {
                int EmpdId = Convert.ToInt32(Session["EmpId"]);

                hdId.Value    = EmpdId.ToString();
                empleadoTable = empleadoClass.BuscarIdEmpleado(EmpdId);
                usuarioTable  = empleadoClass.BuscarIdUsuario(EmpdId);

                txtCedula.Text          = empleadoTable.EmpCedula;
                txtPrimerNombre.Text    = empleadoTable.EmpPrimerNombre;
                txtSegundoNombre.Text   = empleadoTable.EmpSegundoNombre;
                txtPrimerApellido.Text  = empleadoTable.EmpPrimerApellido;
                txtSegunfoApellido.Text = empleadoTable.EmpSegundoApellidos;
                txtFechaNacimiento.Text = empleadoTable.EmpFechaNacimiento.ToString("d");
                if (empleadoTable.EmpGenero == "F")
                {
                    radioFemenino.Checked = true;
                }
                else
                {
                    radioMasculino.Checked = true;
                }

                txtEmail.Text     = empleadoTable.EmpEmail;
                txtDireccion.Text = empleadoTable.EmpDireccion;
                txttelefono.Text  = empleadoTable.EmpTelefono;
                empresatable      = EmpresaClass.BuscarIdEmpresa(Convert.ToInt32(empleadoTable.CodEmpresa));
                txtEmpresa.Text   = empresatable.EmpNombre;

                //Seccion de Usuario Y contraseña
                txtUsuario.Text = usuarioTable.Usunombre;
            }
            catch (Exception ex)
            {
                Session["ERROR_JEFES"] = ex;
                Response.Redirect("Jefes_ERROR.aspx");
            }
        }
        protected void Guardar_Click(object sender, EventArgs e)
        {
            try
            {
                int IdEmp = Convert.ToInt32(hdId.Value);
                empleadoTable = empleadoClass.BuscarIdEmpleado(IdEmp);
                usuarioTable  = empleadoClass.BuscarIdUsuario(IdEmp);

                empleadoTable.EmpCedula           = txtCedula.Text;
                empleadoTable.EmpPrimerNombre     = txtPrimerNombre.Text;
                empleadoTable.EmpSegundoNombre    = txtSegundoNombre.Text;
                empleadoTable.EmpPrimerApellido   = txtPrimerApellido.Text;
                empleadoTable.EmpSegundoApellidos = txtSegunfoApellido.Text;
                empleadoTable.EmpFechaNacimiento  = Convert.ToDateTime(txtFechaNacimiento.Text).Date;
                if (radioFemenino.Checked)
                {
                    empleadoTable.EmpGenero = "F";
                }
                else
                {
                    empleadoTable.EmpGenero = "M";
                }

                empleadoTable.EmpEmail     = txtEmail.Text;
                empleadoTable.EmpDireccion = txtDireccion.Text;
                empleadoTable.EmpTelefono  = txttelefono.Text;

                usuarioTable.Usunombre = txtUsuario.Text;
                empleadoClass.ActualizarUsuario(usuarioTable);
                empleadoClass.ActualizarEmpleado(empleadoTable);
                mensaje = "su Perfil";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeEditado('" + mensaje + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true);
            }
            catch (Exception ex)
            {
                Session["ERROR_EMPLEADO"] = ex;
                Response.Redirect("Empleado_ERROR.aspx");
            }
        }
        protected void Guardar_Click(object sender, EventArgs e)
        {
            CargoAplicar = ddlCargoAplicar.SelectedValue;
            Cargo        = Convert.ToInt32(ddlCargo.SelectedValue);
            jefe         = Convert.ToInt32(ddljefeInmediato.SelectedValue);
            Empresa      = Convert.ToInt32(ddlEmpresa.SelectedValue);

            if (CargoAplicar != "--Seleccionar--" && Cargo != 0 && jefe != 0 && Empresa != 0)
            {
                if (empleadoClass.BuscarCedula(txtCedula.Text))
                {
                    if (validacionesClass.ValidarCedula(txtCedula.Text))
                    {
                        try
                        {
                            OCKO_TblEmpleado empleado = new OCKO_TblEmpleado();
                            empleado.EmpCedula           = txtCedula.Text;
                            empleado.EmpPrimerNombre     = txtPrimerNombre.Text;
                            empleado.EmpSegundoNombre    = txtSegundoNombre.Text;
                            empleado.EmpPrimerApellido   = txtPrimerApellido.Text;
                            empleado.EmpSegundoApellidos = txtSegunfoApellido.Text;
                            empleado.EmpEmail            = txtEmail.Text;
                            empleado.EmpDireccion        = txtDireccion.Text;
                            if (RadioMasculino.Checked == true)
                            {
                                empleado.EmpGenero = "M";
                            }
                            else
                            {
                                empleado.EmpGenero = "F";
                            }

                            empleado.EmpFechaNacimiento = Convert.ToDateTime(txtFechaNacimiento.Text).Date;
                            empleado.EmpTelefono        = txttelefono.Text;
                            if (CargoAplicar == "Empleado")
                            {
                                empleado.EmpJefeId = jefe;
                                empleado.EmpJefe   = "N";
                            }
                            else
                            if (CargoAplicar == "Jefe")
                            {
                                empleado.EmpJefe = "Y";
                            }
                            empleado.CodCargo             = Cargo;
                            empleado.CodEmpresa           = Empresa;
                            empleado.EmpFechaContratacion = Convert.ToDateTime(DateTime.Today).Date;
                            empleadoClass.OckoGuardarEmpleado(empleado);

                            // insertar Procedure al Nuevo Usuario
                            if (CargoAplicar == "Empleado")
                            {
                                if (Cargo == 1)
                                {
                                    storeProClass.GuardaUsuario(5);
                                }
                                else if (Cargo == 2)
                                {
                                    storeProClass.GuardaUsuario(6);
                                }
                                else
                                {
                                    storeProClass.GuardaUsuario(1);
                                }
                            }
                            else
                            if (CargoAplicar == "Jefe")
                            {
                                if (Cargo == 1)
                                {
                                    storeProClass.GuardaUsuario(3);
                                }
                                else if (Cargo == 2)
                                {
                                    storeProClass.GuardaUsuario(4);
                                }
                            }
                            mensaje = "Empleado Contratado";
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeGuardado('" + mensaje + "');", true);
                            ClientScript.RegisterStartupScript(this.GetType(), "", " setTimeout('window.location.href = window.location.href', 3000);", true);
                            Guardar.Enabled = false;
                        }
                        catch (Exception ex)
                        {
                            Session["ERROR_RRHH"] = ex;
                            Response.Redirect("RRHH_ERROR.aspx");
                        }
                    }
                    else
                    {
                        mensaje = "Cedula Invalida";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeError('" + mensaje + "');", true);
                    }
                }
                else
                {
                    mensaje = "Esta Cedula " + txtCedula.Text + "Ya existe !!";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeError('" + mensaje + "');", true);
                }
            }
            else
            {
                mensaje = "No ha seleccionado algunos items";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "confirm", "MensajeError('" + mensaje + "');", true);
            }
        }
Example #10
0
 public void ActualizarEmpleado(OCKO_TblEmpleado Empleado)
 {
     OckoDc.SubmitChanges();
 }
Example #11
0
 //TDOD: revisar
 public void EliminarEmpleado(OCKO_TblEmpleado Empleado)
 {
     OckoDc.OCKO_TblEmpleado.DeleteOnSubmit(Empleado);
     OckoDc.SubmitChanges();
 }
Example #12
0
 //Crud
 public void OckoGuardarEmpleado(OCKO_TblEmpleado Empleado)
 {
     OckoDc.OCKO_TblEmpleado.InsertOnSubmit(Empleado);
     OckoDc.SubmitChanges();
 }