Exemplo n.º 1
0
        public static DataSet RunDataSet(String sql, params Object[] parameters)
        {
            if (UnitTestDetector.IsInUnitTest)
            {
                SqlCommand cmd = TestConnection.CreateCommand();
                cmd.CommandText = sql;
                cmd.Transaction = TestTransaction;
                return(ExecuteDataSet(cmd, parameters));
            }
            DataSupport ds = new DataSupport();

            return(ds.ExecuteDataSet(sql, parameters));
        }
Exemplo n.º 2
0
        public static Boolean IsCorrectUsernameAndPassword(String username, String password)
        {
            Boolean result = true;

            try
            {
                username = username.EscapeString();
                password = password.EscapeString();
                String    sql = String.Format("SELECT employee_id FROM Employees WHERE employee_id = '{0}' AND password = '******' ", username, SecuritySupport.GetSHA1Digest(password));
                DataTable dt  = DataSupport.RunDataSet(sql).Tables[0];
                if (dt.Rows.Count == 0)
                {
                    throw new Exception();
                }
            }
            catch (Exception)
            {
                result = false;
            }


            return(result);
        }
Exemplo n.º 3
0
        public static Object RunScalar(String sql, Dictionary <String, Object> parameters)
        {
            DataSupport ds = new DataSupport();

            return(ds.ExecuteScalar(sql, parameters));
        }
Exemplo n.º 4
0
        public static Object RunScalar(String sql, params Object[] parameters)
        {
            DataSupport ds = new DataSupport();

            return(ds.ExecuteScalar(sql, Utils.ToDict(parameters)));
        }
Exemplo n.º 5
0
        public static Object RunScalar(String sql)
        {
            DataSupport ds = new DataSupport();

            return(ds.ExecuteScalar(sql));
        }
Exemplo n.º 6
0
        public static DataSet RunDataSet(String sql, Dictionary <String, Object> parameters)
        {
            DataSupport ds = new DataSupport();

            return(ds.ExecuteDataSet(sql, parameters));
        }
Exemplo n.º 7
0
        public static int RunNonQuery(String sql, IsolationLevel level, Dictionary <String, Object> parameters)
        {
            DataSupport ds = new DataSupport();

            return(ds.ExecuteNonQuery(sql, level, parameters));
        }
Exemplo n.º 8
0
        public static int RunNonQuery(String sql, params Object[] parameters)
        {
            DataSupport ds = new DataSupport();

            return(ds.ExecuteNonQuery(sql, parameters));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Runs a SQL from you database whatever
        /// </summary>
        /// <param name="sql">adsfasdf</param>
        /// <returns></returns>
        public static int RunNonQuery(String sql)
        {
            DataSupport ds = new DataSupport();

            return(ds.ExecuteNonQuery(sql));
        }