コード例 #1
0
        private void MakeTrading(string LoginId)
        {
            Trading trading = new Trading()
            {
            };
            var user = UserMan.GetByParameter(new User_Filter()
            {
                LoginId = LoginId
            }).FirstOrDefault();

            trading.LoginId    = LoginId;
            trading.UserName   = user.UserName;
            trading.UserID     = user.UserID;
            trading.IsVerifier = (user.IsVerifier == 1);
            trading.CostName   = user.CostName.Trim();
            if (user.PermissionType == 0)
            {
                trading.IsDeptOnly = true;
                if (!string.IsNullOrEmpty(user.DeptName))
                {
                    trading.Dept = EnumHelper.GetEnumByName <WS_Dept_type>(user.DeptName);
                    if (!string.IsNullOrEmpty(user.CostName))
                    {
                        var cost = new WebService_Manage().GetAllDetailCostcerter(trading.Dept.Value);
                        trading.CostId = cost.Where(x => x.CostName.Trim() == user.CostName.Trim()).FirstOrDefault().CostCode;
                    }
                }
                else
                {
                    throw new Exception("私領域權限未設定");
                }

                if (user.IsVerifier == 1)//具有審核權,也可以具有公領域權限
                {
                    if (user.Permission != null)
                    {
                        trading.Permissions = user.Permission.Split(",".ToArray()).ToList();
                    }
                }
            }
            else
            {
                trading.IsDeptOnly = false;
                if (user.Permission != null)
                {
                    trading.Permissions = user.Permission.Split(",".ToArray()).ToList();
                }
                else
                {
                    throw new Exception("公領域權限未設定");
                }
            }
            trading.UploadFiles = new System.Collections.Generic.Dictionary <string, string>()
            {
            };
            sessionData.trading = trading;
        }
コード例 #2
0
ファイル: ManageController.cs プロジェクト: myrest/WanFang
        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());
        }