예제 #1
0
        public ActionResult Worker()
        {
            Anchor.FA.Utility.ButtonPower p = new ButtonPower();

            p.ActionIDRang = UserInfo.GetRange(int.Parse(Request.QueryString["ActionId"]));

            string Search = p.GetGroupRangePower("searchBound");

            switch (p.GetGroupRangePower("searchBound"))
            {
            case "SearchAll":
                ViewData["orgId"] = 1;
                break;

            case "SearchCenter":    //查找分中心
                ViewData["orgId"] = UserInfo.CenterID;
                break;

            case "SearchOrganization":    //查找分站
                ViewData["orgId"] = String.Join(",", UserInfo.Org);
                break;

            default:    //没有设置查询权限
                return(null);
                //break;
            }

            return(View());
        }
예제 #2
0
파일: Person.cs 프로젝트: bertyang/Mobile
        /// <summary>
        /// 根据人员类型(-1全部)和分站编码(-1或""或"--请选择--"时取全部)和是否有效(-1全部、0无效、1有效)获取人员编码、姓名列表
        /// </summary>
        /// <param name="personType">人员类型(-1全部)</param>
        /// <param name="stationCode">分站编码(-1或""或"--请选择--"时取全部)</param>
        /// <param name="isValid">是否有效(-1全部、0无效、1有效)</param>
        /// <returns></returns>
        public static object GetPersonList(int personType, string stationCode, int isValid, ButtonPower p, C_WorkerDetail userDetail)
        {
            using (MainDataContext dbContext = new MainDataContext(AppConfig.ConnectionStringDispatch))
            {
                bool BisValid = Convert.ToBoolean(isValid);

                switch (p.GetGroupRangePower("searchBound"))
                {
                case "SearchAll":    //查找所属分中心
                    return((from t in dbContext.TPerson
                            where (personType == -1 ? true : t.类型编码 == personType)
                            // && (stationCode == "-1" || stationCode == "" || stationCode == "--请选择--" || t.分站编码 == stationCode)
                            && (isValid == -1 ? true : t.是否有效 == BisValid)
                            select new C_Worker
                    {
                        EmpNo = t.编码,
                        Name = t.姓名 + "(" + t.工号 + ")",
                    }).ToList());

                case "SearchCenter":    //查找所属分中心
                    int CenterCode = (from t in dbContext.TStation
                                      where t.编码 == stationCode
                                      select t.中心编码).First();
                    return((from t in dbContext.TPerson
                            join s in dbContext.TStation on t.分站编码 equals s.编码
                            where (personType == -1 ? true : t.类型编码 == personType)
                                                 // && (stationCode == "-1" || stationCode == "" || stationCode == "--请选择--" || t.分站编码 == stationCode)
                            && (isValid == -1 ? true : t.是否有效 == BisValid) &&
                            s.中心编码 == CenterCode //userDetail.CenterCode
                            select new C_Worker
                    {
                        EmpNo = t.编码,
                        Name = t.姓名 + "(" + t.工号 + ")",
                    }).ToList());

                case "SearchOrganization":    //查找分站
                    return((from t in dbContext.TPerson
                            where (personType == -1 ? true : t.类型编码 == personType) &&
                            t.分站编码 == stationCode
                            //&& (stationCode == "-1" || stationCode == "" || stationCode == "--请选择--" || t.分站编码 == stationCode)
                            && (isValid == -1 ? true : t.是否有效 == BisValid)
                            //&& userDetail.Sta.Contains(t.分站编码)
                            select new C_Worker
                    {
                        EmpNo = t.编码,
                        Name = t.姓名 + "(" + t.工号 + ")",
                    }).ToList());

                default:    //没有设置查询权限
                    return(null);
                }
            }
        }