Exemplo n.º 1
0
        public int ValidarEmpleadoMFG(int iClaveEmpleadoMFG)
        {
            MSSQLce       dbObj       = null;
            StringBuilder queryString = null;

            SqlCeParameter[] pars  = null;
            DataTable        dtObj = null;
            int iCodEmpleado       = -1;

            //
            try
            {
                #region Connection Configuration

                dbObj = new MSSQLce(this.sMSSQLServerCE_ConnectionString);

                #endregion Connection Configuration

                #region Query

                queryString = new StringBuilder();
                queryString.Append("select	e.cod_empleado as CodEmpleado ");
                queryString.Append("from	empleado e ");
                queryString.Append("where	e.clave_empleado_MFG = @ClaveEmpleadoMFG;");

                #endregion Query

                #region Parameters

                pars          = new SqlCeParameter[1];
                pars[0]       = new SqlCeParameter("@ClaveEmpleadoMFG", SqlDbType.Int);
                pars[0].Value = iClaveEmpleadoMFG;

                #endregion Parameters

                #region Query Execution

                dtObj = dbObj.ObtenerRegistros(true, queryString.ToString(), pars);

                #endregion Query Execution

                if (dtObj.Rows.Count > 0)
                {
                    iCodEmpleado = Convert.ToInt32(dtObj.Rows[0]["CodEmpleado"]);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", ValidarEmpleadoMFG: " + ex.Message);
            }
            finally
            {
                dbObj.Dispose();
            }
            return(iCodEmpleado);
        }
Exemplo n.º 2
0
        public DataTable ObtenerPantallasProceso(int iCodProceso)
        {
            MSSQLce       dbObj       = null;
            StringBuilder queryString = null;

            SqlCeParameter[] pars  = null;
            DataTable        dtObj = null;

            //
            try
            {
                #region Connection Configuration

                dbObj = new MSSQLce(this.sMSSQLServerCE_ConnectionString);

                #endregion Connection Configuration

                #region Query

                queryString = new StringBuilder();
                queryString.Append("select	pp.cod_pantalla as CodPantalla, ");
                queryString.Append("		p.des_pantalla as DesPantalla ");
                queryString.Append("from	proceso_pantalla pp, ");
                queryString.Append("		SCPP_pantalla p ");
                queryString.Append("where		pp.cod_pantalla = p.cod_pantalla ");
                queryString.Append("		and	pp.cod_proceso = @CodProceso ");
                queryString.Append("order by	p.cod_pantalla asc;");

                #endregion Query

                #region Parameters

                pars          = new SqlCeParameter[1];
                pars[0]       = new SqlCeParameter("@CodProceso", SqlDbType.Int);
                pars[0].Value = iCodProceso;

                #endregion Parameters

                #region Query Execution

                dtObj = dbObj.ObtenerRegistros(true, queryString.ToString(), pars);

                #endregion Query Execution
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", ObtenerPantallasProceso: " + ex.Message);
            }
            finally
            {
                dbObj.Dispose();
            }
            return(dtObj);
        }
Exemplo n.º 3
0
        public DataTable ObtenerProcesos()
        {
            MSSQLce       dbObj       = null;
            StringBuilder queryString = null;

            SqlCeParameter[] pars  = null;
            DataTable        dtObj = null;

            //
            try
            {
                #region Connection Configuration

                dbObj = new MSSQLce(this.sMSSQLServerCE_ConnectionString);

                #endregion Connection Configuration

                #region Query

                queryString = new StringBuilder();
                queryString.Append("select	p.cod_proceso as CodProceso, ");
                queryString.Append("		p.des_proceso as DesProceso ");
                queryString.Append("from	proceso p ");
                queryString.Append("where		fecha_baja is null ");
                queryString.Append("order by	p.des_proceso asc;");

                #endregion Query

                #region Parameters

                pars = new SqlCeParameter[0];

                #endregion Parameters

                #region Query Execution

                dtObj = dbObj.ObtenerRegistros(true, queryString.ToString(), pars);

                #endregion Query Execution
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", ObtenerProcesos: " + ex.Message);
            }
            finally
            {
                dbObj.Dispose();
            }
            return(dtObj);
        }
Exemplo n.º 4
0
        public int ObtenerNumIntentosUsuario(MSSQLce dbObj, int iCodUsuario)
        {
            StringBuilder queryString = null;

            SqlCeParameter[] pars   = null;
            DataTable        dtObj  = null;
            int iNumIntentosUsuario = -1;

            //
            try
            {
                #region Query

                queryString = new StringBuilder();
                queryString.Append("select	u.num_intentos as NumIntentosUsuario ");
                queryString.Append("from	usuario u ");
                queryString.Append("where		u.cod_usuario = @CodUsuario;");

                #endregion Query

                #region Parameters

                pars          = new SqlCeParameter[1];
                pars[0]       = new SqlCeParameter("@CodUsuario", SqlDbType.Int);
                pars[0].Value = iCodUsuario;

                #endregion Parameters

                #region Query Execution

                dtObj = dbObj.ObtenerRegistros(false, queryString.ToString(), pars);

                #endregion Query Execution

                #region Mapear el DataTable en un objeto

                if (dtObj.Rows.Count > 0)
                {
                    iNumIntentosUsuario = Convert.ToInt32(dtObj.Rows[0]["NumIntentosUsuario"]);
                }

                #endregion Mapear el DataTable en un objeto
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", ObtenerNumIntentosUsuario: " + ex.Message);
            }
            return(iNumIntentosUsuario);
        }
Exemplo n.º 5
0
        public int ObtenerNumIntentosConfigurados(MSSQLce dbObj)
        {
            StringBuilder queryString = null;

            SqlCeParameter[] pars  = null;
            DataTable        dtObj = null;
            int iNumIntentosConfig = -1;

            //
            try
            {
                #region Query

                queryString = new StringBuilder();
                queryString.Append("select	c.valor_configuracion as NumIntentosConfig ");
                queryString.Append("from	configuracion c ");
                queryString.Append("where		c.cod_configuracion = 1;");

                #endregion Query

                #region Parameters

                pars = new SqlCeParameter[0];

                #endregion Parameters

                #region Query Execution

                dtObj = dbObj.ObtenerRegistros(false, queryString.ToString(), pars);

                #endregion Query Execution

                #region Mapear el DataTable en un objeto

                if (dtObj.Rows.Count > 0)
                {
                    iNumIntentosConfig = Convert.ToInt32(dtObj.Rows[0]["NumIntentosConfig"]);
                }

                #endregion Mapear el DataTable en un objeto
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", ObtenerNumIntentosConfigurados: " + ex.Message);
            }
            return(iNumIntentosConfig);
        }
Exemplo n.º 6
0
        public long InsertarConfigHandHeld(int iCodUsuario, int iCodTurno, int iCodProceso)
        {
            MSSQLce       dbObj        = null;
            StringBuilder queryString1 = null;
            StringBuilder queryString2 = null;

            SqlCeParameter[] pars  = null;
            DataTable        dtObj = null;
            long             lCodConfigHandHeld = -1;

            //
            try
            {
                #region Connection Configuration

                dbObj = new MSSQLce(this.sMSSQLServerCE_ConnectionString);

                #endregion Connection Configuration

                #region Query

                queryString1 = new StringBuilder();
                queryString1.Append("select	((case when max(ch.cod_config_handheld) is null then 0 else max(ch.cod_config_handheld) end) + 1) as CodConfigHandHeld ");
                queryString1.Append("from	config_handheld ch;");

                queryString2 = new StringBuilder();
                queryString2.Append("insert into config_handheld ");
                queryString2.Append("(cod_config_handheld, cod_usuario, cod_turno, cod_proceso) ");
                queryString2.Append("values (@CodConfigHandHeld, @CodUsuario, @CodTurno, @CodProceso);");

                #endregion Query

                #region Parameters

                pars    = new SqlCeParameter[4];
                pars[0] = new SqlCeParameter("@CodConfigHandHeld", SqlDbType.BigInt);
                //pars[0].Value = lCodConfigHandHeld;
                pars[1]       = new SqlCeParameter("@CodUsuario", SqlDbType.Int);
                pars[1].Value = iCodUsuario;
                pars[2]       = new SqlCeParameter("@CodTurno", SqlDbType.Int);
                pars[2].Value = iCodTurno;
                pars[3]       = new SqlCeParameter("@CodProceso", SqlDbType.Int);
                pars[3].Value = iCodProceso;

                #endregion Parameters

                #region Query Execution

                dtObj = dbObj.ObtenerRegistros(true, queryString1.ToString(), pars);
                lCodConfigHandHeld = Convert.ToInt64(dtObj.Rows[0]["CodConfigHandHeld"]);

                pars[0].Value = lCodConfigHandHeld;
                dbObj.EjecutarConsulta(true, queryString2.ToString(), pars);

                #endregion Query Execution
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", InsertarConfigHandHeld: " + ex.Message);
            }
            finally
            {
                dbObj.Dispose();
            }
            return(lCodConfigHandHeld);
        }
Exemplo n.º 7
0
        private LoginUsuario ObtenerUsuario(MSSQLce dbObj, string sLogin)
        {
            StringBuilder queryString = null;

            SqlCeParameter[] pars   = null;
            DataTable        dtObj  = null;
            LoginUsuario     ResObj = new LoginUsuario();

            //
            try
            {
                #region Query

                queryString = new StringBuilder();
                queryString.Append("select	u.cod_usuario as CodUsuario, ");
                queryString.Append("		u.login as Login, ");
                queryString.Append("		u.password as Password, ");
                queryString.Append("		u.cod_empleado as CodEmpleado, ");
                queryString.Append("		(e.nombre + ' ' + e.ap_paterno + ' ' + e.ap_materno) as NomEmpleado, ");
                queryString.Append("		u.cod_rol as CodRol, ");
                queryString.Append("		r.des_rol as DesRol, ");
                queryString.Append("		e.cod_puesto as CodPuesto, ");
                queryString.Append("		p.des_puesto as DesPuesto, ");
                queryString.Append("		u.bloqueado as Bloqueado, ");
                queryString.Append("		u.fecha_vig_password as FechaVigPassword ");
                queryString.Append("from	usuario u, ");
                queryString.Append("		empleado e, ");
                queryString.Append("		rol r, ");
                queryString.Append("		puesto p ");
                queryString.Append("where		u.cod_empleado = e.cod_empleado ");
                queryString.Append("		and	u.cod_rol = r.cod_rol ");
                queryString.Append("		and	e.cod_puesto = p.cod_puesto ");
                queryString.Append("		and	u.fecha_baja is null ");
                queryString.Append("		and	u.login = @Login;");

                #endregion Query

                #region Parameters

                pars          = new SqlCeParameter[1];
                pars[0]       = new SqlCeParameter("@Login", SqlDbType.NVarChar, 10);
                pars[0].Value = sLogin;

                #endregion Parameters

                #region Query Execution

                dtObj = dbObj.ObtenerRegistros(false, queryString.ToString(), pars);

                #endregion Query Execution

                #region Mapear el DataTable en un objeto

                if (dtObj.Rows.Count > 0)
                {
                    ResObj.CodUsuario       = Convert.ToInt32(dtObj.Rows[0]["CodUsuario"]);
                    ResObj.Login            = Convert.ToString(dtObj.Rows[0]["Login"]);
                    ResObj.Password         = Convert.ToString(dtObj.Rows[0]["Password"]);
                    ResObj.CodEmpleado      = Convert.ToInt32(dtObj.Rows[0]["CodEmpleado"]);
                    ResObj.NomEmpleado      = Convert.ToString(dtObj.Rows[0]["NomEmpleado"]);
                    ResObj.CodRol           = Convert.ToInt32(dtObj.Rows[0]["CodRol"]);
                    ResObj.DesRol           = Convert.ToString(dtObj.Rows[0]["DesRol"]);
                    ResObj.CodPuesto        = Convert.ToInt32(dtObj.Rows[0]["CodPuesto"]);
                    ResObj.DesPuesto        = Convert.ToString(dtObj.Rows[0]["DesPuesto"]);
                    ResObj.Bloqueado        = Convert.ToBoolean(dtObj.Rows[0]["Bloqueado"]);
                    ResObj.FechaVigPassword = Convert.ToDateTime(dtObj.Rows[0]["FechaVigPassword"]);
                }

                #endregion Mapear el DataTable en un objeto
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", ObtenerUsuario: " + ex.Message);
            }
            return(ResObj);
        }