public IActionResult Index() { /* Get user details. */ var ur = _userRepo.Find(u => u.UserName == this.User.Identity.Name).FirstOrDefault(); var repairCount = _context.RepairFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); var keepCount = _context.KeepFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); UnsignCounts v = new UnsignCounts(); v.RepairCount = repairCount; v.KeepCount = keepCount; if (fBrowserIsMobile()) { if (userManager.IsInRole(User, "RepEngineer") == true && userManager.IsInRole(User, "RepMgr") == false) { // go to mobile pages return(RedirectToAction("Index", "Repair", new { Area = "Mobile" })); } } return(View(v)); }
// GET: Mobile/Repair/ public ActionResult Index() { /* Get user details. */ var ur = _userRepo.Find(u => u.UserName == this.User.Identity.Name).FirstOrDefault(); var repairCount = _context.RepairFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); UnsignCounts v = new UnsignCounts(); v.RepairCount = repairCount; v.KeepCount = 0; return(View(v)); }
public IActionResult Index() { /* Get user details. */ var ur = _userRepo.Find(u => u.UserName == this.User.Identity.Name).FirstOrDefault(); //請修案件數 var BMEDrepairCount = _BMEDcontext.BMEDRepairFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); //保養案件數 var BMEDkeepCount = _BMEDcontext.BMEDKeepFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); //驗收案件數 var BMEDdeliveryCount = _BMEDcontext.DelivFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); //採購評估案件數 var BMEDbuyCount = _BMEDcontext.BuyFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); UnsignCounts v = new UnsignCounts(); v.BMEDrepCount = BMEDrepairCount; v.BMEDkeepCount = BMEDkeepCount; v.BMEDDeliveryCount = BMEDdeliveryCount; v.BMEDBuyEvalateCount = BMEDbuyCount; //if (fBrowserIsMobile()) //{ // if (userManager.IsInRole(User, "RepEngineer") == true && // userManager.IsInRole(User, "RepMgr") == false) // { // // go to mobile pages // return RedirectToAction("Index", "Repair", new { Area = "Mobile" }); // } //} return(View(v)); }
public IActionResult Index() { /* Get user details. */ var ur = _userRepo.Find(u => u.UserName == this.User.Identity.Name).FirstOrDefault(); /* Get login user's location. */ var urLocation = new DepartmentModel(_BMEDcontext).GetUserLocation(ur); // var rps = _context.BMEDRepairs.Where(r => r.Loc == urLocation); var kps = _context.BMEDKeeps.Where(r => r.Loc == urLocation); /* 所有尚未指派工程師的案件 */ var rfs = _context.BMEDRepairFlows.Where(r => r.Status == "?" && r.Cls.Contains("工程師")) .Where(r => r.UserId == 0); if (userManager.IsInRole(User, "MedAssetMgr")) //賀康主管不做院區篩選 { rps = _context.BMEDRepairs; kps = _context.BMEDKeeps; } //請修案件數 var BMEDrepairCount = rps.Join(_BMEDcontext.BMEDRepairFlows.Where(f => f.Status == "?" && f.UserId == ur.Id), r => r.DocId, rf => rf.DocId, (r, rf) => new { repair = r, repairflow = rf }).Count(); //保養案件數 var BMEDkeepCount = kps.Join(_BMEDcontext.BMEDKeepFlows.Where(f => f.Status == "?" && f.UserId == ur.Id), k => k.DocId, kf => kf.DocId, (k, kf) => new { keep = k, keepflow = kf }).Count(); //驗收案件數 var BMEDdeliveryCount = _BMEDcontext.DelivFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); //採購評估案件數 var BMEDbuyCount = _BMEDcontext.BuyFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); //外部醫療儀器使用申請案件數 var FORMSoutsidebmedCount = _db.OutsideBmedFlows.Where(f => f.Status == "?") .Where(f => f.UserId == ur.Id).Count(); //未分派案件 var BMEDRepResignCount = _context.BMEDRepairs.Where(r => r.EngId == 0) .Join(rfs, r => r.DocId, rf => rf.DocId, (r, rf) => new { repair = r, flow = rf }) .Join(_context.BMEDRepairDtls, r => r.repair.DocId, d => d.DocId, (r, d) => new { repair = r.repair, flow = r.flow, repdtl = d }) .Join(_context.Departments, j => j.repair.AccDpt, d => d.DptId, (j, d) => new { repair = j.repair, flow = j.flow, repdtl = j.repdtl, dpt = d }) .Where(item => item.repair.Loc == urLocation) .Count(); UnsignCounts v = new UnsignCounts(); v.RepairCount = BMEDrepairCount; v.KeepCount = BMEDkeepCount; v.DeliveryCount = BMEDdeliveryCount; v.BuyEvalateCount = BMEDbuyCount; v.OutsideBmedCount = FORMSoutsidebmedCount; v.RepResignCount = BMEDRepResignCount; //if (fBrowserIsMobile()) //{ // if (userManager.IsInRole(User, "RepEngineer") == true && // userManager.IsInRole(User, "RepMgr") == false) // { // // go to mobile pages // return RedirectToAction("Index", "Repair", new { Area = "Mobile" }); // } //} return(View(v)); }