public ActionResult Index() { TBL_USERSservices _services = new TBL_USERSservices(); TBL_USERS user = _services.GetUserByUsername(User.Identity.Name); ViewBag.userTimeZone = user.user_timezone.ToString(); TBL_USER_MANAGEMENTservices _managementServices = new TBL_USER_MANAGEMENTservices(); List<string> list = _managementServices.GetUserManagements(User.Identity.Name); //System.Diagnostics.Debug.Write("list count: " + list.Count + "/n"); return View(list); }
public List<string> GetUserManagements(string ownerName) { TBL_USERSservices userServices = new TBL_USERSservices(); TBL_USERS owner = userServices.GetUserByUsername(ownerName); //var res = _userMangement.Collection.AsQueryable<TBL_USER_MANAGEMENT>() // .Where (c => c.manager_row_id == owner._id) // .Select(c => c); List<TBL_USER_MANAGEMENT> res = GetUsersUnderManagement(owner._id); TBL_USER_MANAGEMENT item = res[0]; List<string> list = new List<string>(); list.Add("owner: " + owner.user_name + " count: " + res.Count); List<ObjectId> llist = getUsersListUnderManagement(owner._id); if (list.Count > 0) { foreach (var llistItem in llist) { list.Add(llistItem.ToString()); if (userServices.GetUserByObjectIdAsString(llistItem.ToString()) != null) { list.Add(userServices.GetUserByObjectIdAsString(llistItem.ToString()).user_name); } else { list.Add("====="); } //TBL_USERS user = userServices.GetUser(owner._id); //list.Add(user.user_name); } } //list.Add(userServices.GetUser(item.user_row_id).user_name); //foreach (var item in res) //{ // //ObjectId userId = item.user_row_id; // //TBL_USERS user = userServices.GetUser(userId); // //string name = user.user_name; // list.Add(userServices.GetUser(item.user_row_id).user_name); // //list.Add(item._id + " \n " + item.manager_row_id + "\n " + item.user_row_id); // //TBL_USERS user = userServices.GetUser(item.user_row_id); // //System.Diagnostics.Debug.Write("-------------username: "******"----" + item.user_row_id + "-------------------\n"); //} //TBL_USERS user = userServices.GetUser(owner._id); //System.Diagnostics.Debug.Write("-------------username: "******"-----------------------\n"); return list; }