public SignInfoViewModel SortSignInfoViewModel(SignInfoViewModel signInfoViewModel) { if (!(string.IsNullOrEmpty(signInfoViewModel.SortBy))) { if (signInfoViewModel.IsOrderBy) { signInfoViewModel.SignInfoPageTable = SortSignInfos(signInfoViewModel.PageID, signInfoViewModel.PageSize, signInfoViewModel.Keyword, signInfoViewModel.SortBy, signInfoViewModel.CurrentSort); if (signInfoViewModel.SortBy.Equals(signInfoViewModel.CurrentSort)) { signInfoViewModel.CurrentSort = null; } else { signInfoViewModel.CurrentSort = signInfoViewModel.SortBy; } } else { signInfoViewModel.SignInfoPageTable = SortSignInfos(signInfoViewModel.PageID, signInfoViewModel.PageSize, signInfoViewModel.Keyword, signInfoViewModel.SortBy, (string.IsNullOrEmpty(signInfoViewModel.CurrentSort)) ? signInfoViewModel.SortBy : null); } } else { signInfoViewModel.SignInfoPageTable = EFSignInfo.searchSignInfos(signInfoViewModel.Keyword).OrderByDescending(s => s.SignID).ThenBy(s => s.GameID).ToPagedList(signInfoViewModel.PageID, signInfoViewModel.PageSize); } return(signInfoViewModel); }
/// <summary> /// 更新签到信息视图模型 /// </summary> /// <param name="signInfoViewModel"></param> /// <returns></returns> public SignInfoViewModel UpdateSignInfoViewModel(SignInfoViewModel signInfoViewModel) { ViewBag.PageSize = signInfoViewModel.PageSize; signInfoViewModel.SignInfos = EFSignInfo.signInfos; signInfoViewModel.GameMembers = EFGameMember.gameMembers; signInfoViewModel = SortSignInfoViewModel(signInfoViewModel); return(signInfoViewModel); }
/// <summary> /// 删除签到信息 /// </summary> /// <param name="signInfo"></param> /// <param name="signInfoViewModel"></param> /// <returns></returns> public ActionResult DelSignInfo(SignInfo signInfo, SignInfoViewModel signInfoViewModel) { if (EFSignInfo.DelSignInfo(signInfo)) { signInfoViewModel = UpdateSignInfoViewModel(signInfoViewModel); return(PartialView("_SignInfo", signInfoViewModel)); } return(View()); }
public ActionResult GetAddSignInfo(SignInfoViewModel signInfoViewModel) { if (ModelState.IsValid) { signInfoViewModel = UpdateSignInfoViewModel(signInfoViewModel); signInfoViewModel.SignLists = EFSignInfo.signLists.OrderByDescending(s => s.SignID).Take(10); return(PartialView("_AddSignInfo", signInfoViewModel)); } return(View(false)); }
/// <summary> /// 签到信息管理 /// </summary> /// <param name="pageID"></param> /// <param name="pageSize"></param> /// <param name="keyword"></param> /// <returns></returns> public ActionResult SignInfoManage(int pageID = 1, int pageSize = 20, string keyword = null, string sortBy = null, string currentSort = null, bool isOrderBy = false) { DealViewBag("SignInfo"); signInfoViewModel = GetSignInfoViewModel(pageID, pageSize, keyword, sortBy, currentSort, isOrderBy); if (Request.IsAjaxRequest()) { return(PartialView("_SignInfo", signInfoViewModel)); } return(View(signInfoViewModel)); }
/// <summary> /// 更新签到信息 /// </summary> /// <param name="signInfo"></param> /// <param name="signInfoViewModel"></param> /// <returns></returns> public ActionResult UpdateSignInfo(SignInfo signInfo, SignInfoViewModel signInfoViewModel) { if (ModelState.IsValid) { if (EFSignInfo.UpdateSignInfo(signInfo)) { signInfoViewModel = UpdateSignInfoViewModel(signInfoViewModel); return(PartialView("_SignInfo", signInfoViewModel)); } } return(View(false)); }
/// <summary> /// 获取签到信息 /// </summary> /// <param name="SignID"></param> /// <param name="GameID"></param> /// <param name="signInfoViewModel"></param> /// <returns></returns> public ActionResult GetSignInfo(string SignID, int GameID, SignInfoViewModel signInfoViewModel) { if (ModelState.IsValid) { SignInfo signInfo = EFSignInfo.signInfo(SignID, GameID); if (signInfo != null) { signInfoViewModel = UpdateSignInfoViewModel(signInfoViewModel); signInfoViewModel.SignInfo = signInfo; return(PartialView("_EditSignInfo", signInfoViewModel)); } } return(View(false)); }
public ActionResult DealSignInfoTable(List <string> ListID, string formsubmit, SignInfoViewModel signInfoViewModel) { if (ListID != null) { if (formsubmit == "删除") { if (EFSignInfo.DelSignInfo(ListID) == false) { return(View(false)); } } } signInfoViewModel = UpdateSignInfoViewModel(signInfoViewModel); return(PartialView("_SignInfo", signInfoViewModel)); }
public ActionResult GetAddGameMember(SignList signList, SignInfoViewModel signInfoViewModel) { List <GameMember> gameMembers = new List <GameMember>(); IEnumerable <SignInfo> signInfos = EFSignInfo.signInfos.Where(s => s.SignID == signList.SignID); foreach (var item in EFGameMember.gameMembers.Where(g => g.IsDel != true).ToList()) { if (signInfos.Where(s => s.GameID == item.GameID).FirstOrDefault() == null) { gameMembers.Add(item); } } signInfoViewModel.GameMembers = gameMembers; return(PartialView("_GameMember", signInfoViewModel)); }
/// <summary> /// 获取签到信息视图模型 /// </summary> /// <param name="pageID"></param> /// <param name="pageSize"></param> /// <param name="keyword"></param> /// <returns></returns> public SignInfoViewModel GetSignInfoViewModel(int pageID, int pageSize, string keyword, string sortBy, string currentSort, bool isOrderBy) { ViewBag.PageSize = pageSize; signInfoViewModel = new SignInfoViewModel { GameMembers = EFGameMember.gameMembers, SignInfos = EFSignInfo.signInfos, SignInfoPageTable = EFSignInfo.searchSignInfos(keyword).OrderByDescending(s => s.SignID).ToPagedList(pageID, pageSize), PageID = pageID, PageSize = pageSize, Keyword = keyword, CurrentSort = currentSort, SortBy = sortBy, IsOrderBy = isOrderBy }; signInfoViewModel = SortSignInfoViewModel(signInfoViewModel); return(signInfoViewModel); }