public override List <EC> findAll() { List <EC> ECs = new List <EC>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM ec;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Enseignement> TPSQL = factoSQL.getEnseignementDAO(); Enseignement ens = TPSQL.find(reader_f.GetInt32(2)); ECs.Add(new EC(reader_f.GetInt32(0), reader_f.GetString(1), ens)); } } } } return(ECs); }
public override List <InfosAssignation> findAll() { List <InfosAssignation> IAs = new List <InfosAssignation>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM infos_assignation;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <EC> TPSQLEC = factoSQL.getECDAO(); DAO <TypeCours> TPSQLTP = factoSQL.getTypeCoursDao(); DAO <Enseignant> TPSQLEns = factoSQL.getEnseignantDAO(); EC ec = TPSQLEC.find(reader_f.GetInt32(2)); TypeCours tp = reader_f.IsDBNull(3) ? default(TypeCours) : TPSQLTP.find(reader_f.GetInt32(3)); Enseignant ens = reader_f.IsDBNull(4) ? default(Enseignant) : TPSQLEns.find(reader_f.GetInt32(4)); IAs.Add(new InfosAssignation(reader_f.GetInt32(0), reader_f.GetString(1), ec, tp, ens, reader_f.GetDouble(5))); } } } } return(IAs); }
public override EC find(int id) { EC ec = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_enseignement FROM ec WHERE id=" + id + ";", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Enseignement> TPSQL = factoSQL.getEnseignementDAO(); Enseignement ens = TPSQL.find(reader_f.GetInt32(2)); ec = new EC(reader_f.GetInt32(0), reader_f.GetString(1), ens); reader_f.NextResult(); } } else { throw new Exception("Aucun objet avec cet id n'a été trouvé."); } reader_f.Close(); } } return(ec); }
public override EC find(string nom) { EC ec = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_enseignement FROM ec WHERE nom='" + nom + "';", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Enseignement> TPSQL = factoSQL.getEnseignementDAO(); Enseignement ens = TPSQL.find(reader_f.GetInt32(2)); ec = new EC(reader_f.GetInt32(0), reader_f.GetString(1), ens); reader_f.NextResult(); } } reader_f.Close(); } } return(ec); }
public override ActionResult CreateRewrite(ArticleDetail article) { try { if (ModelState.IsValid) { article.Status = 1; if (AbstractDAOFactory.Instance().CreateArticleDao().Article_Edit(1, SessionHelper.getAdminSession().userID, article) > 0) //category.Name,category.MetaTitle,(category.ParentID == null ? 0 : (int)category.ParentID.Value { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Lỗi hệ thống!"); return(View(article)); } } ModelState.AddModelError("", "Có lỗi!"); return(View(article)); } catch { return(View()); } }
public override List <EnseignementEnseignant> findAll() { List <EnseignementEnseignant> enss = new List <EnseignementEnseignant>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM enseignement_enseignant;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Enseignement> TPSQL = factoSQL.getEnseignementDAO(); DAO <Enseignant> TPSQL2 = factoSQL.getEnseignantDAO(); Enseignement ensfacto = TPSQL.find(reader_f.GetInt32(1)); Enseignant ensfacto2 = TPSQL2.find(reader_f.GetInt32(2)); enss.Add(new EnseignementEnseignant(reader_f.GetInt32(0), ensfacto, ensfacto2)); } } } } return(enss); }
public override Annee find(string nom) { Annee annee = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_departement, description FROM annee WHERE nom='" + nom + "';", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Departement> TPSQL = factoSQL.getDepartementDAO(); Departement dep2 = TPSQL.find(reader_f.GetInt32(2)); annee = new Annee(reader_f.GetInt32(0), reader_f.GetString(1), dep2, reader_f.GetString(3)); } } reader_f.Close(); } // Connexion.getInstance().Close(); return(annee); } }
public override InfosAssignation find(string nom) { InfosAssignation IA = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_ec, id_typecours, id_enseignant, nb_heures FROM infos_assignation WHERE nom='" + nom + "';", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <EC> TPSQLEC = factoSQL.getECDAO(); DAO <TypeCours> TPSQLTP = factoSQL.getTypeCoursDao(); DAO <Enseignant> TPSQLEns = factoSQL.getEnseignantDAO(); EC ec = TPSQLEC.find(reader_f.GetInt32(2)); TypeCours tp = TPSQLTP.find(reader_f.GetInt32(3)); Enseignant ens = TPSQLEns.find(reader_f.GetInt32(4)); IA = new InfosAssignation(reader_f.GetInt32(0), reader_f.GetString(1), ec, tp, ens, reader_f.GetDouble(5)); } } reader_f.Close(); } // Connexion.getInstance().Close(); return(IA); } }
public ActionResult ArticleHotPartial() { int Total = 0; var lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(5, 0, "", 0, "", "", 1, 1, 5, out Total); return(PartialView(lst)); }
public override List <Enseignant> findAll() { List <Enseignant> enss = new List <Enseignant>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM enseignant;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Categorie> TPSQL = factoSQL.getCategorieDAO(); Categorie categ2 = TPSQL.find(reader_f.GetInt32(4)); enss.Add(new Enseignant(reader_f.GetInt32(0), reader_f.GetString(1), reader_f.GetString(2), reader_f.GetDouble(3), categ2, reader_f.GetString(5))); } } } } return(enss); }
public override Enseignement find(string nom) { Enseignement ens = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_partie_annee, description FROM enseignement WHERE nom='" + nom + "';", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <PartieAnnee> TPSQL = factoSQL.getPartieAnneeDAO(); PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2)); ens = new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3)); reader_f.NextResult(); } } reader_f.Close(); } } return(ens); }
public override List <Annee> findAll() { List <Annee> ans = new List <Annee>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM annee;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Departement> TPSQL = factoSQL.getDepartementDAO(); Departement dep2 = TPSQL.find(reader_f.GetInt32(2)); ans.Add(new Annee(reader_f.GetInt32(0), reader_f.GetString(1), dep2, reader_f.GetString(3))); } } } } return(ans); }
public ActionResult VideoImage() { int Total1 = 0; //var article = new Article(); var article = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(1, 0, "", 9, "", "", -1, 1, 1, out Total1).FirstOrDefault(); ViewBag.Article = article; NoMark rw = new NoMark(); if (article != null) { var rewrite = rw.ReWrite(article.Title, article.ArticleID); ViewBag.rewrite = rewrite; } int Total2 = 0; //var list_video = new List<Article>(); var list_video = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(4, 0, "", 11, "", "", -1, 1, 4, out Total2); ViewBag.list_video = list_video; int Total3 = 0; //var list_album = new List<Article>(); var list_album = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(4, 0, "", 10, "", "", -1, 1, 4, out Total3); ViewBag.list_album = list_album; return(View()); }
public ActionResult ArticleOneCatePartial(string UrlRedirect, int?Page) { int RecordPerPage = 10; int curPage = 1; if (Page != null) { curPage = (int)Page; } int Total = 0; var lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(1000, 0, "", 0, UrlRedirect, "", -1, curPage, RecordPerPage, out Total); ViewBag.TotalRecord = Total; ViewBag.currentPage = curPage; int totalPage = 1; if (Total % RecordPerPage == 0) { totalPage = (int)(Total / RecordPerPage); } else { totalPage = (int)(Total / RecordPerPage + 1); } ViewBag.TotalPage = totalPage; ViewBag.UrlRedirect = UrlRedirect; return(PartialView(lst)); }
public ActionResult ArticleSearch(string keyword, int CurrentPage) { int RecordPerPage = 10; int Total = 0; var lst = new List <Article>(); var article = new Article(); lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(10000, 0, keyword, 0, "", "", -1, CurrentPage, RecordPerPage, out Total); ViewBag.TotalRecord = Total; ViewBag.currentPage = CurrentPage; int totalPage = 1; if (Total % RecordPerPage == 0) { totalPage = (int)(Total / RecordPerPage); } else { totalPage = (int)(Total / RecordPerPage + 1); } ViewBag.TotalPage = totalPage; return(PartialView(lst)); }
public ActionResult ProgramPassPartial(int Year) { int Total = 0; var list = AbstractDAOFactory.Instance().CreateProgramDAO().SP_Event_OldGetList_Web(0, "", -1, Year, 1, 1000, out Total); return(PartialView(list)); }
// GET: Article public ActionResult Index(string UrlRewrite, int?Page) { int curPage = 1; if (Page != null) { curPage = (int)Page; } int Total = 0; var lst = new List <Article>(); var article = new Article(); ViewBag.CateName = ""; lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(10, 0, "", 0, UrlRewrite, "", -1, curPage, 10, out Total); if (lst != null && lst.Count > 0) { article = lst[0]; } else { article = null; } var lst_menu = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Menu_GetByUrlRedirect(UrlRewrite); if (lst_menu != null && lst_menu.Count > 0) { ViewBag.CateName = lst_menu[0].MenuName; } ViewBag.Article = article; ViewBag.UrlRedirect = UrlRewrite; return(View(lst)); }
public override ActionResult DeleteRewrite(ProductDetail product) { try { product.PublicTime = DateTime.Now; if (ModelState.IsValid) { if (AbstractDAOFactory.Instance().CreateProductDao().Product_Edit(3, SessionHelper.getAdminSession().userID, product) > 0) //category.Name,category.MetaTitle,(category.ParentID == null ? 0 : (int)category.ParentID.Value { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Lỗi hệ thống!"); return(RedirectToAction("Index")); } } ModelState.AddModelError("", "Có lỗi!"); return(RedirectToAction("Index")); } catch { return(RedirectToAction("Index")); } }
// GET: Program public ActionResult ProgramProcess() { int Total = 0; var list = AbstractDAOFactory.Instance().CreateProgramDAO().SP_Event_GetList_Web(0, "", -1, 1, 1000, out Total); return(View(list)); }
public override Enseignement find(int id) { Enseignement ens = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_partie_annee, description FROM enseignement WHERE id=" + id + ";", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <PartieAnnee> TPSQL = factoSQL.getPartieAnneeDAO(); PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2)); ens = new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3)); reader_f.NextResult(); } } else { throw new Exception("Aucun objet avec cet id n'a été trouvé."); } reader_f.Close(); } } return(ens); }
// POST: Admin/Category/Edit/5 public override ActionResult EditRewrite(ProductDetail product) { try { var listCate = AbstractDAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession()); ViewBag.listCate = listCate; if (ModelState.IsValid) { if (AbstractDAOFactory.Instance().CreateProductDao().Product_Edit(2, SessionHelper.getAdminSession().userID, product) > 0) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Lỗi hệ thống!"); return(View(product)); } } ModelState.AddModelError("", "Có lỗi!"); return(View(product)); } catch { return(View()); } }
public ActionResult SendSuggest(string Email, string Mobile, string Content) { int Result = 0; AbstractDAOFactory.Instance().CreateSuggestDAO().SP_Suggestion_Create(Email, Mobile, Content, out Result); return(Json(new { success = Result })); }
public ActionResult MenuPartial() { int Total = 0; var lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Menu_GetList("", 1, 1, out Total); return(PartialView(lst)); }
public ActionResult MessageHistoryPartial(string Keyword, int CurrentPage) { int RecordPerPage = 5; int Total = 0; DateTime start = DateTime.Now; var list = AbstractDAOFactory.Instance().CreateMessageDAO().SP_Get_MO(Keyword, CurrentPage, RecordPerPage, out Total); DateTime end = DateTime.Now; TimeSpan t = end - start; int s = t.Seconds; NLogLogger.LogInfo("thoi gian call db =" + s.ToString()); ViewBag.TotalRecord = Total; ViewBag.currentPage = CurrentPage; int totalPage = 1; if (Total % RecordPerPage == 0) { totalPage = (int)(Total / RecordPerPage); } else { totalPage = (int)(Total / RecordPerPage + 1); } ViewBag.TotalPage = totalPage; return(PartialView(list)); }
public override Annee find(int id) { Annee annee = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_departement, description FROM annee WHERE id=" + id + ";", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Departement> TPSQL = factoSQL.getDepartementDAO(); Departement dep2 = TPSQL.find(reader_f.GetInt32(2)); annee = new Annee(reader_f.GetInt32(0), reader_f.GetString(1), dep2, reader_f.GetString(3)); reader_f.NextResult(); } } else { throw new Exception("Aucun objet avec cet id n'a été trouvé."); } reader_f.Close(); } } return(annee); }
public ActionResult Create() { var listCate = AbstractDAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession()); ViewBag.listCate = listCate; return(View()); }
public override Enseignant find(string nom) { Enseignant ens = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, prenom, nb_heures_assignees, id_categorie_enseignant, image FROM enseignant WHERE nom='" + nom + "';", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Categorie> TPSQL = factoSQL.getCategorieDAO(); Categorie categ2 = TPSQL.find(reader_f.GetInt32(4)); ens = new Enseignant(reader_f.GetInt32(0), reader_f.GetString(1), reader_f.GetString(2), reader_f.GetDouble(3), categ2, reader_f.GetString(5)); reader_f.NextResult(); } } reader_f.Close(); } } return(ens); }
public override List <Enseignement> findAll() { List <Enseignement> enses = new List <Enseignement>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM enseignement;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <PartieAnnee> TPSQL = factoSQL.getPartieAnneeDAO(); PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2)); enses.Add(new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3))); } } } } return(enses); }
// GET: Admin/Category/Edit/5 public ActionResult Edit(int id) { ProductDetail product = AbstractDAOFactory.Instance().CreateProductDao().GetProductDetail(id); var listCate = AbstractDAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession()); ViewBag.listCate = listCate; return(View(product)); }
public ActionResult Sanphamen(int page = 1, int pageSize = 10) { SessionHelper.setLanguageSession("en"); int totalPage = 0; var listArticle = AbstractDAOFactory.Instance().CreateProductDao().GetCMSListProduct(SessionHelper.getLanguageSession(), 1, 1000, out totalPage); return(View(listArticle.ToPagedList(page, pageSize))); }