예제 #1
0
        public Users GetByIdOrUsername(string pIdOrUsername)
        {
            Users   user     = new Users();
            DataSet dataset  = new DataSet();
            string  queryStr = string.Format("SELECT  `UserId`, `Pwd`, `Status`, `RoleId`  FROM user WHERE  UserId = '{0}'", pIdOrUsername);

            PosService.DataQuery(Username, Password, queryStr, ref dataset, "x", ref errorString);

            if (!string.IsNullOrEmpty(errorString))
            {
                return(null);
            }

            if (dataset.Tables["x"].Rows.Count > 0)
            {
                user.UserId = dataset.Tables["x"].Rows[0][UserColumn.UserId].ToString();
                user.Pwd    = dataset.Tables["x"].Rows[0][UserColumn.Pwd].ToString();
                //user.LastLogin = dataset.Tables["x"].Rows[0][UserColumn.LastLogin].ToString();
                user.Status = dataset.Tables["x"].Rows[0][UserColumn.Status].ToString();
                //user.CreatedBy = dataset.Tables["x"].Rows[0][UserColumn.CreatedBy].ToString();
                //user.CreatedDate = dataset.Tables["x"].Rows[0][UserColumn.CreatedDate].ToString();
                //user.ModifiedBy = dataset.Tables["x"].Rows[0][UserColumn.ModifiedBy].ToString();
                //user.ModifiedDate = dataset.Tables["x"].Rows[0][UserColumn.ModifiedDate].ToString();
                user.RoleId = dataset.Tables["x"].Rows[0][UserColumn.RoleId].ToString();
            }
            else
            {
                user = null;
            }

            return(user);
        }
예제 #2
0
        public DataTable GetRoleOfUser(string roleId)
        {
            string  queryStr = String.Format("SELECT * FROM role WHERE " + RoleColumn.RoleId + " = '{0}'", roleId);
            DataSet dataset  = new DataSet();

            PosService.DataQuery(Username, Password, queryStr, ref dataset, "x", ref errorString);

            if (string.IsNullOrEmpty(errorString))
            {
                return(dataset.Tables["x"]);
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        public DataTable GetRoles()
        {
            DataTable res      = new DataTable();
            DataSet   ds       = new DataSet();
            string    queryStr = "UPDATE role SET";

            PosService.DataQuery(Username, Password, queryStr, ref ds, "roles", ref errorString);
            if (string.IsNullOrEmpty(errorString))
            {
                res = ds.Tables[0];
            }
            else
            {
                res = null;
            }
            return(res);
        }
예제 #4
0
        /// <summary>
        /// Get all Users
        /// </summary>
        /// <returns></returns>
        public DataTable GetUsers(Users user)
        {
            DataTable dtUsers  = new DataTable();
            DataSet   dataset  = new DataSet();
            string    queryStr = "SELECT * FROM user";

            PosService.DataQuery(user.UserId, user.Pwd.ToString(), queryStr, ref dataset, "x", ref errorString);

            if (!string.IsNullOrEmpty(errorString))
            {
                return(null);
            }

            if (dataset.Tables["x"].Rows.Count > 0)
            {
                dtUsers = dataset.Tables["x"];
            }
            return(dtUsers);
        }