Esempio n. 1
0
        public List <Models.ScreenGroupPermissionDo> GetUserPermission(Models.UserCriteriaDo criteria)
        {
            List <Models.ScreenGroupPermissionDo> result = new List <Models.ScreenGroupPermissionDo>();

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Get_UserPermission]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(string), "UserName", criteria.UserName);
                command.AddParameter(typeof(int), "GroupID", criteria.GroupID);

                List <Models.ScreenPermissionDo> permissions = command.ToList <Models.ScreenPermissionDo>();
                foreach (Models.ScreenPermissionDo p in permissions)
                {
                    if (Utils.CommonUtil.IsNullOrEmpty(p.GroupNameEN) &&
                        Utils.CommonUtil.IsNullOrEmpty(p.GroupNameLC))
                    {
                        Models.ScreenGroupPermissionDo grp = new Models.ScreenGroupPermissionDo();
                        grp.Screens = new List <Models.ScreenPermissionDo>();
                        result.Add(grp);

                        grp.Screens.Add(p);
                    }
                    else
                    {
                        Models.ScreenGroupPermissionDo grp = result.Find(x =>
                                                                         x.GroupNameEN == p.GroupNameEN &&
                                                                         x.GroupNameLC == p.GroupNameLC);
                        if (grp == null)
                        {
                            grp                = new Models.ScreenGroupPermissionDo();
                            grp.GroupNameEN    = p.GroupNameEN;
                            grp.GroupNameLC    = p.GroupNameLC;
                            grp.GroupImageIcon = p.GroupImageIcon;

                            grp.Screens = new List <Models.ScreenPermissionDo>();
                            result.Add(grp);
                        }

                        grp.Screens.Add(p);
                    }
                }
            }));

            return(result);
        }
Esempio n. 2
0
        public Models.UserFSResultDo GetUserList(Models.UserCriteriaDo criteria)
        {
            Models.UserFSResultDo result = new Models.UserFSResultDo();

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Get_UserList]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(string), "UserName", criteria.UserName);
                command.AddParameter(typeof(int), "GroupID", criteria.GroupID);
                command.AddParameter(typeof(bool), "FlagActive", criteria.FlagActive);
                command.AddParameter(typeof(bool), "IncludeSystemAdmin", criteria.IncludeSystemAdmin);

                Utils.SQL.ISQLDbParameter output = command.AddSearchParameter(criteria);

                result.Rows = command.ToList <Models.UserFSDo>();
                result.TotalRecordParameter(output);
            }));

            return(result);
        }
Esempio n. 3
0
        public Models.UserDo GetUser(Models.UserCriteriaDo criteria)
        {
            Models.UserDo result = null;

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Get_User]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(string), "UserName", criteria.UserName);

                List <Models.UserDo> list = command.ToList <Models.UserDo>();
                if (list != null)
                {
                    if (list.Count > 0)
                    {
                        result = list[0];
                    }
                }
            }));

            return(result);
        }