public ActionResult TeamList(int? page, int? rows, string status, string sort, string order, string queryWord) { #region Get paging condition Paging paging = new Paging(); paging.SetPageSize(rows.HasValue ? rows.Value : Paging.DEFAULT_PAGE_SIZE); //pageRows; paging.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber; #endregion JsonDataGridResult jsonDataGridResult = new JsonDataGridResult(); List<Team> list = null; try { SqlHelper.Initialization(); list = DAL.TeamService.GetList(paging, sort, order, status, queryWord); if (list != null && list.Count() > 0) { foreach (Team idea in list) { jsonDataGridResult.rows.Add(idea); } jsonDataGridResult.total = paging.GetRecordCount(); } } catch (Exception ex) { jsonDataGridResult.result = false; jsonDataGridResult.message = ex.Message; } return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet); }
public static List<Trimester> GetList(Paging paging, string order, string sort, string queryWord) { List<Trimester> list = new List<Trimester>(); Trimester model = null; DataSet ds = SqlHelper.GetListByPage("PSS_Trimester", paging, order, sort); foreach (DataRow dr in ds.Tables["PSS_Trimester"].Rows) { model = new Trimester(); if (!string.IsNullOrEmpty(dr["tri_Id"].ToString())) { model.tri_Id = int.Parse(dr["tri_Id"].ToString()); } model.tri_Name = dr["tri_Name"].ToString(); model.tri_IsOpen = (bool)dr["tri_IsOpen"]; if (!string.IsNullOrEmpty(dr["tri_StartDate"].ToString())) { model.tri_StartDate = DateTime.Parse(dr["tri_StartDate"].ToString()); model.StartDate_Time = model.tri_StartDate.ToString("dd/MM/yyyy"); } if (!string.IsNullOrEmpty(dr["tri_EndDate"].ToString())) { model.tri_EndDate = DateTime.Parse(dr["tri_EndDate"].ToString()); model.EndDate_Time = model.tri_EndDate.ToString("dd/MM/yyyy"); } list.Add(model); }; return list; }
/// <summary> /// Paging Trimester,Status /// </summary> /// <param name="tableName"></param> /// <returns></returns> public static DataSet GetListByPage(String tableName, string trimesterName, int trimesterId, string status, Paging paging, string order, string sort) { DataSet ds = null; try { ds = new DataSet(); string sql = "select * from (select *, ROW_NUMBER() OVER(Order by" + " " + order + " " + sort + ") as RowNumber from" + " " + tableName + " as a where " + trimesterName + "=" + trimesterId + " and user_Statue=" + status + ") as b where RowNumber between" + " " + ((paging.GetCurrentPage() - 1) * paging.GetPageSize() + 1) + " AND" + " " + paging.GetCurrentPage() * paging.GetPageSize() + " " + "ORDER BY" + " " + order + " " + sort + ""; int count = GetCount("select count(*) from " + tableName + " where " + trimesterName + "=" + trimesterId + " and user_Statue=" + status); paging.SetRecordCount(count); SqlDataAdapter da = new SqlDataAdapter(sql, myConn); da.Fill(ds, tableName); da.Dispose(); } catch (Exception ex) { throw ex; } finally { if (ds != null) ds.Dispose(); } return ds; }
public static List<News> GetList(Paging paging, string order, string sort, string queryWord) { List<News> list = new List<News>(); News model = null; DataSet ds = SqlHelper.GetListByPage("PSS_News", paging, order, sort); foreach (DataRow dr in ds.Tables["PSS_News"].Rows) { model = new News(); if (!string.IsNullOrEmpty(dr["news_Id"].ToString())) { model.news_Id = int.Parse(dr["news_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["news_User_Id"].ToString())) { model.news_User_Id = int.Parse(dr["news_User_Id"].ToString()); } model.news_Content = dr["news_Content"].ToString(); model.news_Title = dr["news_Title"].ToString(); if (!string.IsNullOrEmpty(dr["news_Update_Time"].ToString())) { model.news_Update_Time = DateTime.Parse(dr["news_Update_Time"].ToString()); model.Update_Time = model.news_Update_Time.ToString("dd-MM-yyyy"); } list.Add(model); }; return list; }
public static List<Idea> GetList(Paging paging, string order, string sort, int trimesterId, string queryWord) { List<Idea> list = new List<Idea>(); Idea model = null; DataSet ds = SqlHelper.GetListByPage("PSS_Idea", "Idea_Trimester_Id", trimesterId, paging, order, sort); foreach (DataRow dr in ds.Tables["PSS_Idea"].Rows) { model = new Idea(); if (!string.IsNullOrEmpty(dr["Idea_Id"].ToString())) { model.Idea_Id = int.Parse(dr["Idea_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Idea_Trimester_Id"].ToString())) { model.Idea_Trimester_Id = int.Parse(dr["Idea_Trimester_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Idea_Status"].ToString())) { model.Idea_Status = int.Parse(dr["Idea_Status"].ToString()); if (model.Idea_Status == 0) { model.Status = "UnAuthorized"; } else if (model.Idea_Status == 1) { model.Status = "Authorized"; } else if (model.Idea_Status == 2) { model.Status = "Revise"; } } model.Idea_Students_Num = dr["Idea_Students_Num"].ToString(); model.Idea_Title = dr["Idea_Title"].ToString(); model.Idea_Staff_Contact = dr["Idea_Staff_Contact"].ToString(); model.Idea_Client_Contact = dr["Idea_Client_Contact"].ToString(); model.Idea_Client_Company = dr["Idea_Client_Company"].ToString(); model.Idea_Continuation = (bool)dr["Idea_Continuation"]; model.Idea_Description = dr["Idea_Description"].ToString(); model.Idea_Skills_Required = dr["Idea_Skills_Required"].ToString(); model.Idea_Context = dr["Idea_Context"].ToString(); model.Idea_Goals = dr["Idea_Goals"].ToString(); model.Idea_Features = dr["Idea_Features"].ToString(); model.Idea_Challenges = dr["Idea_Challenges"].ToString(); model.Idea_Opportunities = dr["Idea_Opportunities"].ToString(); model.Idea_Presenter = dr["Idea_Presenter"].ToString(); model.Idea_Advisor_Contact = dr["Idea_Advisor_Contact"].ToString(); model.Idea_Valid_Dates = dr["Idea_Valid_Dates"].ToString(); if (!string.IsNullOrEmpty(dr["Idea_Update_Time"].ToString())) { model.Idea_Update_Time = DateTime.Parse(dr["Idea_Update_Time"].ToString()); model.Update_Time = model.Idea_Update_Time.ToString("dd/MM/yyyy HH:mm"); } list.Add(model); }; return list; }
public static List<User> GetList(Paging paging, string order, string sort, int trimesterId,string status, string queryWord) { List<User> list = new List<User>(); User model = null; DataSet ds = SqlHelper.GetListByPage("PSS_User","user_Trimester_Id", trimesterId,status,paging, order, sort); foreach (DataRow dr in ds.Tables["PSS_User"].Rows) { model = new User(); if (!string.IsNullOrEmpty(dr["user_Id"].ToString())) { model.user_Id = int.Parse(dr["user_Id"].ToString()); } model.user_Name = dr["user_Name"].ToString(); model.user_Password = dr["user_Password"].ToString(); model.user_Email = dr["user_Email"].ToString(); model.user_Telephone = dr["user_Telephone"].ToString(); model.user_StudentId = dr["user_StudentId"].ToString(); model.user_Skill = dr["user_Skill"].ToString(); model.user_Introduction = dr["user_Introduction"].ToString(); model.user_Statue = (bool)dr["user_Statue"]; model.User_Email_Visiable = (bool)dr["User_Email_Visiable"]; model.User_Telephone_Visiable = (bool)dr["User_Telephone_Visiable"]; if (!string.IsNullOrEmpty(dr["user_Register_Time"].ToString())) { model.user_Register_Time = DateTime.Parse(dr["user_Register_Time"].ToString()); model.Register_Time = model.user_Register_Time.ToString("dd/MM/yyyy HH:mm:ss"); } if (!string.IsNullOrEmpty(dr["user_Log_Time"].ToString())) { model.user_Log_Time = DateTime.Parse(dr["user_Log_Time"].ToString()); model.Log_Time = model.user_Log_Time.ToString("dd/MM/yyyy HH:mm:ss"); } if (!string.IsNullOrEmpty(dr["user_Update_Time"].ToString())) { model.user_Update_Time = DateTime.Parse(dr["user_Update_Time"].ToString()); model.Update_Time = model.user_Update_Time.ToString("dd/MM/yyyy HH:mm:ss"); } list.Add(model); }; return list; }
public static List<Project> GetList(Paging paging, string order, string sort, int trimesterId, string queryWord) { List<Project> list = new List<Project>(); Project model = null; DataSet ds = SqlHelper.GetListByPage("PSS_Project","Proj_Trimester_Id",trimesterId, paging, order, sort); foreach (DataRow dr in ds.Tables["PSS_Project"].Rows) { model = new Project(); if (!string.IsNullOrEmpty(dr["Proj_Id"].ToString())) { model.Proj_Id = int.Parse(dr["Proj_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Proj_Trimester_Id"].ToString())) { model.Proj_Trimester_Id = int.Parse(dr["Proj_Trimester_Id"].ToString()); } model.Proj_Students_Num = dr["Proj_Students_Num"].ToString(); model.Proj_Title = dr["Proj_Title"].ToString(); model.Proj_Staff_Contact = dr["Proj_Staff_Contact"].ToString(); model.Proj_Client_Contact = dr["Proj_Client_Contact"].ToString(); model.Proj_Client_Company = dr["Proj_Client_Company"].ToString(); model.Proj_Continuation = (bool)dr["Proj_Continuation"]; model.Proj_Description = dr["Proj_Description"].ToString(); model.Proj_Skills_Required = dr["Proj_Skills_Required"].ToString(); model.Proj_Context = dr["Proj_Context"].ToString(); model.Proj_Goals = dr["Proj_Goals"].ToString(); model.Proj_Features = dr["Proj_Features"].ToString(); model.Proj_Challenges = dr["Proj_Challenges"].ToString(); model.Proj_Opportunities = dr["Proj_Opportunities"].ToString(); model.Proj_Presenter = dr["Proj_Presenter"].ToString(); model.Proj_Valid_Dates = dr["Proj_Valid_Dates"].ToString(); if (!string.IsNullOrEmpty(dr["Proj_Update_Time"].ToString())) { model.Proj_Update_Time = DateTime.Parse(dr["Proj_Update_Time"].ToString()); model.Update_Time = model.Proj_Update_Time.ToString("dd/MM/yyyy HH:mm:ss"); } list.Add(model); }; return list; }
public static List<Team> GetList(Paging paging, string order, string sort, string status, string queryWord) { List<Team> list = new List<Team>(); Team model = null; DataSet ds = SqlHelper.GetListByPage("PSS_Team", "Team_Status", status, paging, order, sort); foreach (DataRow dr in ds.Tables["PSS_Team"].Rows) { model = new Team(); if (!string.IsNullOrEmpty(dr["Team_Id"].ToString())) { model.Team_Id = int.Parse(dr["Team_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Team_User_Id"].ToString())) { model.Team_User_Id = int.Parse(dr["Team_User_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Team_Proj_Id"].ToString())) { model.Team_Proj_Id = int.Parse(dr["Team_Proj_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Team_Status"].ToString())) { model.Team_Status = int.Parse(dr["Team_Status"].ToString()); if (model.Team_Status == 0) { model.Status = "UnAuthorized"; } else if (model.Team_Status == 1) { model.Status = "Authorized"; } else if (model.Team_Status == 2) { model.Status = "Bid"; } } model.Team_Title = dr["Team_Title"].ToString(); if (!string.IsNullOrEmpty(dr["Team_Update_Time"].ToString())) { model.Team_Update_Time = DateTime.Parse(dr["Team_Update_Time"].ToString()); model.Update_Time = model.Team_Update_Time.ToString("dd/MM/yyyy HH:mm"); } list.Add(model); }; return list; }