Beispiel #1
0
        public bool UserAuthentication(string userlogin, string password, out int userid, out string empid)
        {
            bool result = false;

            userid = 0;
            empid  = string.Empty;

            try
            {
                SQLiteParam param = new SQLiteParam(2)
                {
                    CommandText = StoreProcedure.Instance.GetScript("CheckValidationUser")
                };

                param.ParamString(0, "@USER_LOGIN", userlogin);
                param.ParamString(1, "@USER_PASS", password);

                SQLiteReader.Instance.SLReader = GlobalSqliteDB.Instance.DataAc.ExecuteDataReader(param);

                if (SQLiteReader.Instance.HasRows)
                {
                    while (SQLiteReader.Instance.SLReader.Read())
                    {
                        userid = SQLiteReader.Instance.GetInteger("USER_ID");
                        empid  = SQLiteReader.Instance.GetString("EMPLOYEE_ID");
                    }

                    result = true;
                }
                else
                {
                    result = false;
                }

                //Always call Close when done reading.
                SQLiteReader.Instance.Close();

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }