Example #1
0
        public void BloquearUsuario(MSSQLce dbObj, int iCodUsuario)
        {
            StringBuilder queryString = null;

            SqlCeParameter[] pars = null;
            //
            try
            {
                #region Query

                queryString = new StringBuilder();
                queryString.Append("update	usuario ");
                queryString.Append("set		num_intentos	= 0, ");
                queryString.Append("		bloqueado		= 1 ");
                queryString.Append("where		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

                dbObj.EjecutarConsulta(false, queryString.ToString(), pars);

                #endregion Query Execution
            }
            catch (Exception ex)
            {
                throw new Exception(this.sClassName + ", BloquearUsuario: " + ex.Message);
            }
        }
Example #2
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);
        }