Example #1
0
        public ActionResult UserListing(User_Filter filter, Rest.Core.Paging Page)
        {
            var PermissionCheck = CheckPermission("員工帳號管理");

            if (PermissionCheck != null)
            {
                return(PermissionCheck);
            }

            ViewData["MenuItem"] = 12;
            if (filter.LoginId == "請輸入帳號搜尋")
            {
                filter.LoginId = null;
            }
            ViewData["Filter"] = filter;

            User_Manager man = new User_Manager();

            Rest.Core.Paging page = new Rest.Core.Paging()
            {
            };
            if (Page.CurrentPage > 0)
            {
                page.CurrentPage = Page.CurrentPage;
            }
            List <User_Info> data = man.GetByParameter(filter, page, null, "LoginId");

            //Modify DeptCode To DeptName
            data.ForEach(x =>
            {
                if (x.PermissionType == 0)
                {
                    x.DeptName   = EnumHelper.GetEnumDescription <WS_Dept_type>(EnumHelper.GetEnumByName <WS_Dept_type>(x.DeptName));
                    x.Permission = string.Empty;
                }
                else
                {
                    x.DeptName = string.Empty;
                }
            });

            ViewData["Model"] = data;
            ViewData["Page"]  = page;

            return(View());
        }
Example #2
0
        public List <User_Info> GetByParam(User_Filter Filter, Paging Page, string[] fieldNames, string _orderby)
        {
            if (fieldNames == null)
            {
                fieldNames = new string[] { "*" };
            }
            if (Page == null)
            {
                Page = new Paging();
            }
            using (var db = new DBExecutor().GetDatabase())
            {
                var SQLStr = ConstructSQL(Filter, fieldNames, _orderby);

                var result = db.Page <User_Info>(Page.CurrentPage, Page.ItemsPerPage, SQLStr);
                Page.Convert <User_Info>(result);

                return(result.Items);
            }
        }
Example #3
0
 public List <User_Info> GetByParameter(User_Filter Filter, string[] fieldNames, string _orderby, Rest.Core.Paging Page)
 {
     return(new User_Repo().GetByParam(Filter, fieldNames, _orderby, Page));
 }
Example #4
0
 public List <User_Info> GetByParameter(User_Filter Filter, string _orderby)
 {
     return(new User_Repo().GetByParam(Filter, _orderby));
 }
Example #5
0
 public List <User_Info> GetByParameter(User_Filter Filter, Rest.Core.Paging Page)
 {
     return(new User_Repo().GetByParam(Filter, Page));
 }
Example #6
0
 public List <User_Info> GetByParameter(User_Filter Filter)
 {
     return(new User_Repo().GetByParam(Filter));
 }
Example #7
0
 public List <User_Info> GetByParam(User_Filter Filter, string[] fieldNames, string _orderby, Paging Page)
 {
     return(GetByParam(Filter, Page, fieldNames, _orderby));
 }
Example #8
0
 public List <User_Info> GetByParam(User_Filter Filter, string _orderby, Paging Page)
 {
     return(GetByParam(Filter, Page, null, _orderby));
 }
Example #9
0
 public List <User_Info> GetByParam(User_Filter Filter, Paging Page)
 {
     return(GetByParam(Filter, Page, null, ""));
 }
Example #10
0
 public List <User_Info> GetByParam(User_Filter Filter)
 {
     return(GetByParam(Filter, null, null, ""));
 }
Example #11
0
        private Rest.Core.PetaPoco.Sql ConstructSQL(User_Filter filter, string[] fieldNames, string _orderby)
        {
            var SQLStr = Rest.Core.PetaPoco.Sql.Builder
                         .Append("SELECT " + FieldNameArrayToFieldNameString(fieldNames) + " FROM db_User")
                         .Append("WHERE 1=1 ");

            if (filter != null)
            {
                if (filter.UserID.HasValue)
                {
                    SQLStr.Append(" AND UserID=@0", filter.UserID.Value);
                }
                if (!string.IsNullOrEmpty(filter.UserName))
                {
                    SQLStr.Append(" AND UserName=@0", filter.UserName);
                }
                if (!string.IsNullOrEmpty(filter.LoginId))
                {
                    string _key = "%" + filter.LoginId + "%";
                    SQLStr.Append(" AND LoginId like @0", _key);
                }
                if (!string.IsNullOrEmpty(filter.Password))
                {
                    SQLStr.Append(" AND Password=@0", filter.Password);
                }
                if (filter.PermissionType.HasValue)
                {
                    SQLStr.Append(" AND PermissionType=@0", filter.PermissionType.Value);
                }
                if (!string.IsNullOrEmpty(filter.DeptName))
                {
                    SQLStr.Append(" AND DeptName=@0", filter.DeptName);
                }
                if (!string.IsNullOrEmpty(filter.CostName))
                {
                    SQLStr.Append(" AND CostName=@0", filter.CostName);
                }
                if (!string.IsNullOrEmpty(filter.Permission))
                {
                    SQLStr.Append(" AND Permission=@0", filter.Permission);
                }
                if (filter.IsVerifier.HasValue)
                {
                    SQLStr.Append(" AND IsVerifier=@0", filter.IsVerifier.Value);
                }
                if (filter.IsSuperUser.HasValue)
                {
                    SQLStr.Append(" AND IsSuperUser=@0", filter.IsSuperUser.Value);
                }
                if (filter.LastUpdate.HasValue)
                {
                    SQLStr.Append(" AND LastUpdate=@0", filter.LastUpdate.Value);
                }
                if (!string.IsNullOrEmpty(filter.LastUpdator))
                {
                    SQLStr.Append(" AND LastUpdator=@0", filter.LastUpdator);
                }
                if (_orderby != "")
                {
                    SQLStr.OrderBy(_orderby);
                }
            }
            return(SQLStr);
        }
Example #12
0
 private Rest.Core.PetaPoco.Sql ConstructSQL(User_Filter filter)
 {
     return(ConstructSQL(filter, new string[] { "*" }, ""));
 }