private List <ResultsPositions> fetchResultPosition(SqlCommand cmd) { SqlConnection con = cmd.Connection; List <ResultsPositions> resultposition = null; con.Open(); using (con) { SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { resultposition = new List <ResultsPositions>(); while (dr.Read()) { ResultsPositions rp = new ResultsPositions(); rp.Id = Convert.ToString(dr["id"]); rp.Student_id = Convert.ToString(dr["student_id"]); rp.Class_Section = Convert.ToString(dr["class_section"]); rp.Obtn_Pstn = Convert.ToString(dr["position"]); resultposition.Add(rp); } resultposition.TrimExcess(); } } return(resultposition); }
public ActionResult AddResultPosition(AllClasses Add, int id) { if (Session["Username"] == null && Session["Password"] == null) { return(RedirectToAction("Index", "Admin", new { area = "" })); } else { if (ModelState.IsValid) { ResultsPositions AddResultPstn = new ResultsPositions(); AddResultPstn.Sub_r_id = Add.Result_Position.Sub_r_id; AddResultPstn.Student_id = Convert.ToString(id); AddResultPstn.Class_Section = Add.Result_Position.Class_Section; AddResultPstn.Obtn_Pstn = Add.Result_Position.Obtn_Pstn; AddResultPstn.Date = DateTime.Today.ToString("dd-MM-yyyy"); AddResultPstn.Month = DateTime.Today.ToString("MMM"); AddResultPstn.Year = DateTime.Today.ToString("yyyy"); AddResultPstn.Time = DateTime.Now.ToString("HH:mm:ss"); new Cateloge().AddResultPosition(AddResultPstn); TempData["Msg"] = "Student Position Of Result Have Added Successfully"; return(RedirectToAction("View", new { id = id })); } return(RedirectToAction("Index")); } }
public void AddResultPosition(ResultsPositions rs) { SqlCommand cmd = new SqlCommand("INSERT into Position_in_rslt (sub_result_id,student_id,class_section,position,date,month,year,time) VALUES (@Sub_r_id,@Student_id,@Class_Section,@Obtn_Pstn,@Date,@Month,@Year,@Time)", DALUtil.getConnection()); cmd.Parameters.AddWithValue("@Sub_r_id", (rs.Sub_r_id == null) ? Convert.DBNull : rs.Sub_r_id); cmd.Parameters.AddWithValue("@Student_id", (rs.Student_id == null) ? Convert.DBNull : rs.Student_id); cmd.Parameters.AddWithValue("@Class_Section", (rs.Class_Section == null) ? Convert.DBNull : rs.Class_Section); cmd.Parameters.AddWithValue("@Obtn_Pstn", rs.Obtn_Pstn); cmd.Parameters.AddWithValue("@Date", (rs.Date == null) ? Convert.DBNull : rs.Date); cmd.Parameters.AddWithValue("@Month", (rs.Month == null) ? Convert.DBNull : rs.Month); cmd.Parameters.AddWithValue("@Year", (rs.Year == null) ? Convert.DBNull : rs.Year); cmd.Parameters.AddWithValue("@Time", (rs.Time == null) ? Convert.DBNull : rs.Time); addstudent(cmd); }
public static ResultsPositionsModel FromDataSample(ResultsPositions dataSample) { var serialized = JsonConvert.SerializeObject(dataSample); return(JsonConvert.DeserializeObject <ResultsPositionsModel>(serialized)); }
//public void AddSubjectsResult(List<SubjectResults> srd) //{ // new AddAndUpdtStudentDAL().AddStudentsResults(srd); //} public void AddResultPosition(ResultsPositions rs) { new AddAndUpdtStudentDAL().AddResultPosition(rs); }