Exemplo n.º 1
0
        /// <summary>
        /// 报销查询
        /// </summary>
        public ActionResult ReimburseList(ReimbursetListSearchModel search)
        {
            ReimbursetListViewModel model = new ReimbursetListViewModel();                                                     //页面模型

            model.search             = search;                                                                                 //页面的搜索模型
            model.search.PageSize    = 15;                                                                                     //每页显示
            model.search.CurrentPage = Convert.ToInt32(Request["pageindex"]) <= 0 ? 1 : Convert.ToInt32(Request["pageindex"]); //当前页
            //按钮下拉项
            List <CommonEntity> StateIDIL = CommonData.GetDictionaryList(20);                                                  //1是字典类型值,仅供测试参考

            model.StateIDIL = CommonData.Instance.GetBropDownListData(StateIDIL);


            List <CommonEntity> TeacherIDIL = CommonData.GetTeachersList();//1是字典类型值,仅供测试参考

            model.TeacherIDIL = CommonData.Instance.GetBropDownListData(TeacherIDIL);


            //分校下拉项
            List <CommonEntity> ComCodeIL = CommonData.Get_SYS_Company_COMP_Code(UserSession.comcode);//分校

            model.ComCodeIL        = CommonData.Instance.GetBropDownListData_Choice(ComCodeIL);
            model.search.ComCodeIL = CommonData.Instance.GetBropDownListData_Choice(ComCodeIL);

            string        SYS_Role = "0";
            List <string> roles    = UserSession.roles;//取账号角色

            for (int i = 0; i < roles.Count; i++)
            {
                if (roles[i] == "1" || roles[i] == "4" || roles[i] == "8")//如果不是 (1:管理员)(4:校长)(8:财务)
                {
                    SYS_Role = "1";
                }
            }

            ViewData["SYS_Role"] = SYS_Role;
            if (SYS_Role != "1")//如果不是 (1:管理员)(4:校长)(8:财务),那就获取当前登录人,只查询当前登录人的信息
            {
                search.CreatorId = UserSession.userid;
            }



            if (UserSession.comcode != null && UserSession.comcode != "1")
            {
                search.ComCode = UserSession.comcode;//默认查询当前分校的人员
            }


            model.Reimbursetlist = ReimburseData.GetReimburseList(search); //填充页面模型数据
            return(View(model));                                           //返回页面模型
        }
Exemplo n.º 2
0
        /// <summary>
        /// 报销列表
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public static PagedList <vw_Reimburse> GetReimburseList(ReimbursetListSearchModel search)
        {
            string table = string.Empty, fields = string.Empty, orderby = string.Empty, where = string.Empty; //定义结构

            fields  = @"  * ";                                                                                //输出字段
            table   = @" vw_Reimburse ";                                                                      //表或者视图
            orderby = "ID";                                                                                   //排序信息
            StringBuilder sb = new StringBuilder();                                                           //构建where条件

            sb.Append(" 1=1 ");
            if (!string.IsNullOrWhiteSpace(search.TeacherID))//老师名称
            {
                sb.AppendFormat(" and TeacherID = '{0}' ", search.TeacherID);
            }

            if (!string.IsNullOrWhiteSpace(search.StateID))//状态
            {
                sb.AppendFormat(" and StateID = '{0}' ", search.StateID);
            }

            if (!string.IsNullOrWhiteSpace(search.CreateTime_start))//开班时间
            {
                sb.AppendFormat(" and CreateTime > = '{0}' ", search.CreateTime_start);
            }
            if (!string.IsNullOrWhiteSpace(search.CreateTime_end))//结束时间
            {
                sb.AppendFormat(" and CreateTime <= '{0}' ", search.CreateTime_end);
            }

            if (!string.IsNullOrWhiteSpace(search.ComCode))//校区
            {
                sb.AppendFormat(" and [ComCode] = '{0}' ", search.ComCode);
            }

            if (!string.IsNullOrWhiteSpace(search.CreatorId))//创建人
            {
                sb.AppendFormat(" and CreatorId = '{0}' ", search.CreatorId);
            }

            where = sb.ToString();
            int allcount = 0;
            var list     = CommonPage <vw_Reimburse> .GetPageList(
                out allcount, table, fields : fields, where : where.Trim(),
                orderby : orderby, pageindex : search.CurrentPage, pagesize : search.PageSize, connect : DBKeys.PRX);

            return(new PagedList <vw_Reimburse>(list, search.CurrentPage, search.PageSize, allcount));
        }