public void Update(StudentBehaviour behaviour) { CommonFunctions.UpdateApostrophe(behaviour); StringBuilder sb = new StringBuilder(); sb.Append("UPDATE StudentBehaviour SET "); sb.Append("Profile = '" + behaviour.Profile + "',"); sb.Append("Communication = '" + behaviour.Communication + "',"); sb.Append("Behaviour = '" + behaviour.Behaviour + "',"); sb.Append("StrategyPlan = '" + behaviour.StrategyPlan + "' "); sb.Append("WHERE StudentBehaviourId = " + behaviour.StudentBehaviourId); string sql = sb.ToString(); dbc.ExecuteCommand(sql); }
public int Add(StudentBehaviour behaviour, int StudentId) { CommonFunctions.UpdateApostrophe(behaviour); StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO StudentBehaviour (StudentId, Profile,Communication,Behaviour,StrategyPlan) VALUES ("); sb.Append(StudentId + ",'"); sb.Append(behaviour.Profile + "','"); sb.Append(behaviour.Communication + "','"); sb.Append(behaviour.Behaviour + "','"); sb.Append(behaviour.StrategyPlan + "')"); string sql = sb.ToString(); return(dbc.ExecuteCommand(sql)); }
public List <StudentBehaviour> GetList(int PersonId) { List <StudentBehaviour> list = new List <StudentBehaviour>(); DataTable dt = dbc.GetDataTable("SELECT * FROM vw_StudentBehaviours WHERE StudentId=" + PersonId); foreach (DataRow dr in dt.Rows) { StudentBehaviour riskManagementPlan = new StudentBehaviour { StudentBehaviourId = (int)dr["StudentBehaviourId"], StudentId = (int)dr["StudentId"], Profile = dr["Profile"].ToString(), Communication = dr["Communication"].ToString(), Behaviour = dr["Behaviour"].ToString(), StrategyPlan = dr["StrategyPlan"].ToString() }; list.Add(riskManagementPlan); } return(list); }