private List <Syllabuses> fetchSyllabuses(SqlCommand cmd) { SqlConnection con = cmd.Connection; List <Syllabuses> syllabuses = null; con.Open(); using (con) { SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { syllabuses = new List <Syllabuses>(); while (dr.Read()) { Syllabuses s = new Syllabuses(); s.db_Id = Convert.ToString(dr["id"]); s.Name_of_lvl = Convert.ToString(dr["name_of_lvl"]); s.Detail_of_syllabus = Convert.ToString(dr["detail_of_syllabus"]); s.Publish = Convert.ToString(dr["publish"]); syllabuses.Add(s); } syllabuses.TrimExcess(); } } return(syllabuses); }
public ActionResult Create(AllClasses Add) { if (Session["Username"] == null && Session["Password"] == null) { return(RedirectToAction("Index", "Admin", new { area = "" })); } else { if (ModelState.IsValid) { Syllabuses AddSyllabus = new Syllabuses(); AddSyllabus.Name_of_lvl = Add.Syllabus.Name_of_lvl; AddSyllabus.Detail_of_syllabus = Add.Syllabus.Detail_of_syllabus; AddSyllabus.Date = DateTime.Today.ToString("dd-MM-yyyy"); AddSyllabus.Month = DateTime.Today.ToString("MMM"); AddSyllabus.Year = DateTime.Today.ToString("yyyy"); AddSyllabus.Time = DateTime.Now.ToString("HH:mm:ss"); new Cateloge().AddSyllabus(AddSyllabus); TempData["Msg"] = "New Syllabus Have Added Successfully"; return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } }
public void PublishSyllabus(Syllabuses ps, int id) { SqlCommand cmd = new SqlCommand("Update syllabus Set publish=@Publish Where id = @Id", DALUtil.getConnection()); cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@Publish", (ps.Publish == null) ? Convert.DBNull : ps.Publish); addsyllabus(cmd); }
public void UpdateSyllabus(Syllabuses us, int id) { SqlCommand cmd = new SqlCommand("Update syllabus Set name_of_lvl=@Name_of_lvl , detail_of_syllabus=@Detail_of_syllabus Where id=@Id", DALUtil.getConnection()); cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@Name_of_lvl", (us.Name_of_lvl == null) ? Convert.DBNull : us.Name_of_lvl); cmd.Parameters.AddWithValue("@Detail_of_syllabus", (us.Detail_of_syllabus == null) ? Convert.DBNull : us.Detail_of_syllabus); addsyllabus(cmd); }
public void AddSyllabus(Syllabuses s) { SqlCommand cmd = new SqlCommand("INSERT into syllabus (name_of_lvl,detail_of_syllabus,date,month,year,time) VALUES (@Name_of_lvl,@Detail_of_syllabus,@Date,@Month,@Year,@Time)", DALUtil.getConnection()); cmd.Parameters.AddWithValue("@Name_of_lvl", (s.Name_of_lvl == null) ? Convert.DBNull : s.Name_of_lvl); cmd.Parameters.AddWithValue("@Detail_of_syllabus", (s.Detail_of_syllabus == null) ? Convert.DBNull : s.Detail_of_syllabus); cmd.Parameters.AddWithValue("@Date", (s.Date == null) ? Convert.DBNull : s.Date); cmd.Parameters.AddWithValue("@Month", (s.Month == null) ? Convert.DBNull : s.Month); cmd.Parameters.AddWithValue("@Year", (s.Year == null) ? Convert.DBNull : s.Year); cmd.Parameters.AddWithValue("@Time", (s.Time == null) ? Convert.DBNull : s.Time); addsyllabus(cmd); }
public ActionResult Edit(Syllabus Update, int id) { if (Session["Username"] == null && Session["Password"] == null) { return(RedirectToAction("Index", "Admin", new { area = "" })); } else { if (ModelState.IsValid) { Syllabuses UpdateSyllabus = new Syllabuses(); UpdateSyllabus.Name_of_lvl = Update.Name_of_lvl; UpdateSyllabus.Detail_of_syllabus = Update.Detail_of_syllabus; new Cateloge().UpdateSyllabus(UpdateSyllabus, id); TempData["Msg"] = "Syllabus Have Updated Successfully"; return(RedirectToAction("Index")); } return(View(Update)); } }
public ActionResult Publish(Syllabus ps, int id) { if (Session["Username"] == null && Session["Password"] == null) { return(RedirectToAction("Index", "Admin", new { area = "" })); } else { if (ModelState.IsValid) { Syllabuses PublishSyllabus = new Syllabuses(); PublishSyllabus.Publish = ps.Publish; new Cateloge().PublishSyllabus(PublishSyllabus, id); TempData["Msg"] = " This Syllabus Have Published Successfully"; return(RedirectToAction("View", new { id = id })); } return(RedirectToAction("Index")); } }
public void PublishSyllabus(Syllabuses ps, int id) { new AddAndUpdtSyllabusDAL().PublishSyllabus(ps, id); }
public void UpdateSyllabus(Syllabuses us, int id) { new AddAndUpdtSyllabusDAL().UpdateSyllabus(us, id); }
public void AddSyllabus(Syllabuses s) { new AddAndUpdtSyllabusDAL().AddSyllabus(s); }