コード例 #1
0
        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);
            }
        }
コード例 #2
0
        /// <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);
            }
        }
コード例 #3
0
ファイル: MenuMain.cs プロジェクト: ranganathsb/VideoSchool
        /// <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);
            }
        }
コード例 #4
0
ファイル: Menus.cs プロジェクト: ranganathsb/VideoSchool
 /// <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);
     }
 }
コード例 #5
0
ファイル: Menus.cs プロジェクト: ranganathsb/VideoSchool
 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);
     }
 }
コード例 #6
0
 /// <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);
     }
 }
コード例 #7
0
        /// <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);
            }
        }
コード例 #8
0
 public BaseUnit(Shared shared)
 {
     this.shared = shared;
     qtable      = new QTable(shared);
 }
コード例 #9
0
 public RoleAction(Shared shared)
     : base(shared)
 {
     selectActionsInRole     = new QTable(shared);
     selectNewActionsForRole = new QTable(shared);
 }