public ActionResult CreateSection(GradeSection Add, int id) { if (Session["Username"] == null && Session["Password"] == null) { return(RedirectToAction("Index", "Admin", new { area = "" })); } else { if (ModelState.IsValid) { GradesSections AddGradeSection = new GradesSections(); AddGradeSection.Class_Level_id = Convert.ToString(id); AddGradeSection.Name = Add.Name; AddGradeSection.Date = DateTime.Today.ToString("dd-MM-yyyy"); AddGradeSection.Month = DateTime.Today.ToString("MMM"); AddGradeSection.Year = DateTime.Today.ToString("yyyy"); AddGradeSection.Time = DateTime.Now.ToString("HH:mm:ss"); new Cateloge().AddGradeSection(AddGradeSection); TempData["Msg"] = "New Section Have Added Successfully"; return(RedirectToAction("View", new { id = id })); } return(RedirectToAction("Index")); } }
private List <GradesSections> fetchSection(SqlCommand cmd) { SqlConnection con = cmd.Connection; List <GradesSections> gradessections = null; con.Open(); using (con) { SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { gradessections = new List <GradesSections>(); while (dr.Read()) { GradesSections gs = new GradesSections(); gs.db_Id = Convert.ToString(dr["id"]); gs.Class_Level_id = Convert.ToString(dr["class_level_id"]); gs.Class_name = new ClassLevelsDAL().SelectById(Convert.ToInt32(dr["class_level_id"])); gs.Name = Convert.ToString(dr["name"]); gs.Settings = Convert.ToString(dr["settings"]); gradessections.Add(gs); } gradessections.TrimExcess(); } } return(gradessections); }
public void SettingsSection(GradesSections ps, int id) { SqlCommand cmd = new SqlCommand("Update gradesections Set settings=@Settings Where id = @Id", DALUtil.getConnection()); cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@Settings", (ps.Settings == null) ? Convert.DBNull : ps.Settings); _section(cmd); }
public void UpdateSection(GradesSections ugs, int id) { SqlCommand cmd = new SqlCommand("Update gradesections Set name=@Name Where id=@Id", DALUtil.getConnection()); cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@Name", (ugs.Name == null) ? Convert.DBNull : ugs.Name); _section(cmd); }
public void AddSection(GradesSections gs) { SqlCommand cmd = new SqlCommand("INSERT into gradesections (class_level_id,name,settings,date,month,year,time) VALUES (@Class_level_id,@Name,'1',@Date,@Month,@Year,@Time)", DALUtil.getConnection()); cmd.Parameters.AddWithValue("@Class_level_id", (gs.Class_Level_id == null) ? Convert.DBNull : gs.Class_Level_id); cmd.Parameters.AddWithValue("@Name", (gs.Name == null) ? Convert.DBNull : gs.Name); cmd.Parameters.AddWithValue("@Date", (gs.Date == null) ? Convert.DBNull : gs.Date); cmd.Parameters.AddWithValue("@Month", (gs.Month == null) ? Convert.DBNull : gs.Month); cmd.Parameters.AddWithValue("@Year", (gs.Year == null) ? Convert.DBNull : gs.Year); cmd.Parameters.AddWithValue("@Time", (gs.Time == null) ? Convert.DBNull : gs.Time); _section(cmd); }
public GradesSection GetGradesSection(ClassWP c) { string fileName = Files.GRADE_FILE(_localAccountId, c.Identifier); GradesSection section = GradesSections.FirstOrDefault(i => i.FileName.Equals(fileName)); if (section == null) { section = new GradesSection(this, fileName, c); GradesSections.Add(section); } return(section); }
public ActionResult EditSection(GradeSection Update, int id) { if (Session["Username"] == null && Session["Password"] == null) { return(RedirectToAction("Index", "Admin", new { area = "" })); } else { if (ModelState.IsValid) { GradesSections UpdateGradeSection = new GradesSections(); UpdateGradeSection.Name = Update.Name; new Cateloge().UpdateGradeSection(UpdateGradeSection, id); TempData["Msg"] = "Section Have Updated Successfully"; return(RedirectToAction("Index")); } return(View(Update)); } }
public void UpdateGradeSection(GradesSections gs, int id) { new AddAndUpdtGradeSectionDAL().UpdateSection(gs, id); }
public void AddGradeSection(GradesSections gs) { new AddAndUpdtGradeSectionDAL().AddSection(gs); }