public void SelectActions() { try { qtable = new QTable(shared); string filterSlashes = shared.db.addslashes(filter); string where = " 1 "; if (filter != "") { where = " (id = '" + filterSlashes + @"' OR name LIKE '%" + filterSlashes + @"%' OR info LIKE '%" + filterSlashes + @"%' OR status = '" + filterSlashes + "')"; } qtable.Init( "SELECT COUNT(*) FROM action WHERE " + where, @"SELECT id, name, info, status FROM action WHERE " + where + @" ORDER BY name ASC"); } catch (Exception ex) { ThrowError(ex); } }
/// <summary> /// Create an User List by filter /// </summary> public void SelectUsers() { try { qtable = new QTable(shared); string filterSlashes = shared.db.addslashes(filter); string where = " 1 "; if (filter != "") { where = " (id = '" + filterSlashes + @"' OR name LIKE '%" + filterSlashes + @"%' OR email LIKE '%" + filterSlashes + @"%')"; } qtable.Init( "SELECT COUNT(*) FROM user WHERE " + where, @"SELECT id, name, email, status FROM user WHERE " + where + @" ORDER BY id DESC"); } catch (Exception ex) { ThrowError(ex); } }
/// <summary> /// выбор пунктов menu /// </summary> public void SelectMenuMain() { try { qtable = new QTable(shared); string filterSlashes = shared.db.addslashes(filter); string where = " 1 "; if (filter != "") { where += " AND(main LIKE '%" + filterSlashes + @"%' OR name LIKE '%" + filterSlashes + @"%' OR info LIKE '%" + filterSlashes + @"%' OR id = '" + filterSlashes + @"')"; } qtable.Init( "SELECT COUNT(*) FROM menu_main WHERE " + where, @"SELECT id, main, name, info FROM menu_main WHERE " + where + @" ORDER BY main"); } catch (Exception ex) { ThrowError(ex); } }
/// <summary> /// Select QTable MenuMain from Select Filters /// </summary> public void SelectMenuMain() { try { selectMenuMain = new QTable(shared); selectMenuMain.Init( "SELECT 1 ", @"SELECT id, main, name FROM menu_main ORDER BY main;"); } catch (Exception ex) { ThrowError(ex); } }
public void SelectMenuInMenuMain(string menuMainId) { try { this.menuMainId = menuMainId; qtable = new QTable(shared); string where = " main_id = '" + shared.db.addslashes(menuMainId) + "'"; qtable.Init( "SELECT COUNT(*) FROM menu WHERE " + where, @"SELECT id, main_id, menu, href, name, info, status, nr FROM menu WHERE " + where + @" ORDER BY nr"); } catch (Exception ex) { ThrowError(ex); } }
/// <summary> /// Prepare a list of new (not yet added) Actions for specified Role /// </summary> /// <param name="RoleId"></param> public void SelectNewActionsForRole(string RoleId) { try { selectNewActionsForRole = new QTable(shared); selectNewActionsForRole.Init( @"SELECT 1 ", @"SELECT id, name FROM action WHERE id NOT IN (SELECT action_id FROM role_action WHERE role_id = '" + shared.db.addslashes(RoleId) + @"') ORDER BY name ASC"); } catch (Exception ex) { ThrowError(ex); } }
/// <summary> /// Select all action in current role /// </summary> public void SelectActionsInRole(string RoleID) { try { role = new Role(shared); role.Select(RoleID); if (shared.error.AnyError()) { return; } selectActionsInRole = new QTable(shared); string where = " (role_id = '" + shared.db.addslashes(RoleID) + @"')"; selectActionsInRole.Init( @"SELECT COUNT(*) FROM role_action WHERE " + where, @"SELECT ra.role_id, ra.action_id, r.name role_name, a.name action_name, a.info action_info, a.status action_status FROM role_action ra JOIN role r ON ra.role_id = r.id JOIN action a ON ra.action_id = a.id WHERE " + where + @" ORDER BY a.name ASC"); } catch (Exception ex) { ThrowError(ex); } }
public BaseUnit(Shared shared) { this.shared = shared; qtable = new QTable(shared); }
public RoleAction(Shared shared) : base(shared) { selectActionsInRole = new QTable(shared); selectNewActionsForRole = new QTable(shared); }