當前位置: 首頁>>代碼示例>>C#>>正文


C# List.AsQueryable方法代碼示例

本文整理匯總了C#中iTextSharp.text.List.AsQueryable方法的典型用法代碼示例。如果您正苦於以下問題:C# List.AsQueryable方法的具體用法?C# List.AsQueryable怎麽用?C# List.AsQueryable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.List的用法示例。


在下文中一共展示了List.AsQueryable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Index

        public ActionResult Index()
        {
            List<String> roles =(List<String>)Session["roles"];
            List<EmployeeLeaveRequestViewModel> requestViewModelList = new List<EmployeeLeaveRequestViewModel>();
            Dictionary<LeaveRequestInfo, LeaveRequestDescription> leaveRequests = new Dictionary<LeaveRequestInfo, LeaveRequestDescription>();

            if (roles == null) {

                return RedirectToAction("Index", "Login");
            }

            foreach (string role in roles) {

                if (role.Equals("Super User")) {

                    leaveRequests = getAllLeaveRequests(db);
                }
            }
            if (leaveRequests.Count == 0)
            {
                leaveRequests = getLRForCurrentUser();

            }
            foreach (KeyValuePair<LeaveRequestInfo,LeaveRequestDescription> pair in leaveRequests)
            {

                LeaveRequestInfo reqInfo = pair.Key;
                LeaveRequestDescription reqDesc = pair.Value;

                EmployeeLeaveRequestViewModel viewModel = new EmployeeLeaveRequestViewModel()
            {
                    AllDayEvent = reqDesc.AllDayEvent,
                    DeliveryManager = reqDesc.DeliveryManager,
                    DeliveryManagerStatus = reqDesc.DeliveryManagerStatus,
                    DepartmentManager = reqDesc.DepartmentManager,
                    DepartmentManagerStatus = reqDesc.DepartmentManagerStatus,
                    Description = reqDesc.Description,
                    Employee = reqInfo.Employee,
                    EndTime = reqDesc.EndTime,
                    LeaveReason = reqDesc.LeaveReason,
                    LeaveRequestID = reqInfo.LeaveRequestInfoID,
                    StartTime = reqDesc.StartTime,
                    DepartmentManagerComment = reqDesc.DepartmentManagerComment,
                    DeliveryManagerComment = reqDesc.DeliveryManagerComment

                };

                requestViewModelList.Add(viewModel);
            }
            return View(requestViewModelList.AsQueryable());
        }
開發者ID:Besermenji,項目名稱:LeaveManager,代碼行數:51,代碼來源:EmployeeLeaveRequestViewModelsController.cs

示例2: Index

        // GET: EmployeeLeaveRequestViewModels
        public ActionResult Index()
        {
            //var employeeLeaveRequestViewModels = db.LeaveRequests.Include(e => e.leaveReason).Include(e => e.deliveryManagerStatus).Include(e => e.departmentManagerStatus);
            List<String> roles =(List<String>)Session["roles"];
            List<EmployeeLeaveRequestViewModel> requestViewModelList = new List<EmployeeLeaveRequestViewModel>();
            List<LeaveRequest> leaveRequests = new List<LeaveRequest>();
            foreach (string role in roles) {

                if (role.Equals("Super User")) {
                    leaveRequests = db.LeaveRequests.ToList();
                }

            }
            if (leaveRequests.Count == 0) {
                leaveRequests = getLRForCurrentUser();
            }

            foreach (LeaveRequest req in leaveRequests)
            {

                EmployeeLeaveRequestViewModel viewModel = new EmployeeLeaveRequestViewModel()
                {
                    allDayEvent = req.allDayEvent,
                    deliveryManager = req.deliveryManager,
                    deliveryManagerStatus = req.deliveryManagerStatus,
                    departmentManager = req.departmentManager,
                    departmentManagerStatus = req.departmentManagerStatus,
                    Description = req.Description,
                    employee = req.employee,
                    endTime = req.endTime,
                    leaveReason = req.leaveReason,
                    leaveRequestID = req.leaveRequestID,
                    startTime = req.startTime,
                    departmentManagerComment = req.departmentManagerComment,
                    deliveryManagerComment = req.deliveryManagerComment

                };

                requestViewModelList.Add(viewModel);

            }
            return View(requestViewModelList.AsQueryable());
        }
開發者ID:Besermenji,項目名稱:LeaveManager,代碼行數:44,代碼來源:EmployeeLeaveRequestViewModelsController.cs


注:本文中的iTextSharp.text.List.AsQueryable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。