public bool Add(Model_StatsStuHW_KP model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into StatsStuHW_KP("); builder.Append("StatsStuHW_KP_Id,HomeWork_Id,HomeWorkCreateTime,Student_HomeWork_Id,Student_Id,S_KnowledgePoint_Id,KPNameBasic,topicNumber_Right,topicNumber_Wrong,topicNumber,TestType,SumScore,KPMastery,CreateTime)"); builder.Append(" values ("); builder.Append("@StatsStuHW_KP_Id,@HomeWork_Id,@HomeWorkCreateTime,@Student_HomeWork_Id,@Student_Id,@S_KnowledgePoint_Id,@KPNameBasic,@topicNumber_Right,@topicNumber_Wrong,@topicNumber,@TestType,@SumScore,@KPMastery,@CreateTime)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@StatsStuHW_KP_Id", SqlDbType.Char, 0x24), new SqlParameter("@HomeWork_Id", SqlDbType.Char, 0x24), new SqlParameter("@HomeWorkCreateTime", SqlDbType.DateTime), new SqlParameter("@Student_HomeWork_Id", SqlDbType.Char, 0x24), new SqlParameter("@Student_Id", SqlDbType.Char, 0x24), new SqlParameter("@S_KnowledgePoint_Id", SqlDbType.Char, 0x24), new SqlParameter("@KPNameBasic", SqlDbType.VarChar, 200), new SqlParameter("@topicNumber_Right", SqlDbType.VarChar, 500), new SqlParameter("@topicNumber_Wrong", SqlDbType.VarChar, 500), new SqlParameter("@topicNumber", SqlDbType.VarChar, 500), new SqlParameter("@TestType", SqlDbType.VarChar, 500), new SqlParameter("@SumScore", SqlDbType.Decimal, 9), new SqlParameter("@KPMastery", SqlDbType.Decimal, 9), new SqlParameter("@CreateTime", SqlDbType.DateTime) }; cmdParms[0].Value = model.StatsStuHW_KP_Id; cmdParms[1].Value = model.HomeWork_Id; cmdParms[2].Value = model.HomeWorkCreateTime; cmdParms[3].Value = model.Student_HomeWork_Id; cmdParms[4].Value = model.Student_Id; cmdParms[5].Value = model.S_KnowledgePoint_Id; cmdParms[6].Value = model.KPNameBasic; cmdParms[7].Value = model.topicNumber_Right; cmdParms[8].Value = model.topicNumber_Wrong; cmdParms[9].Value = model.topicNumber; cmdParms[10].Value = model.TestType; cmdParms[11].Value = model.SumScore; cmdParms[12].Value = model.KPMastery; cmdParms[13].Value = model.CreateTime; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_StatsStuHW_KP> DataTableToList(DataTable dt) { List <Model_StatsStuHW_KP> list = new List <Model_StatsStuHW_KP>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_StatsStuHW_KP item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Update(Model_StatsStuHW_KP model) { StringBuilder builder = new StringBuilder(); builder.Append("update StatsStuHW_KP set "); builder.Append("HomeWork_Id=@HomeWork_Id,"); builder.Append("HomeWorkCreateTime=@HomeWorkCreateTime,"); builder.Append("Student_HomeWork_Id=@Student_HomeWork_Id,"); builder.Append("Student_Id=@Student_Id,"); builder.Append("S_KnowledgePoint_Id=@S_KnowledgePoint_Id,"); builder.Append("KPNameBasic=@KPNameBasic,"); builder.Append("topicNumber_Right=@topicNumber_Right,"); builder.Append("topicNumber_Wrong=@topicNumber_Wrong,"); builder.Append("topicNumber=@topicNumber,"); builder.Append("TestType=@TestType,"); builder.Append("SumScore=@SumScore,"); builder.Append("KPMastery=@KPMastery,"); builder.Append("CreateTime=@CreateTime"); builder.Append(" where StatsStuHW_KP_Id=@StatsStuHW_KP_Id "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@HomeWork_Id", SqlDbType.Char, 0x24), new SqlParameter("@HomeWorkCreateTime", SqlDbType.DateTime), new SqlParameter("@Student_HomeWork_Id", SqlDbType.Char, 0x24), new SqlParameter("@Student_Id", SqlDbType.Char, 0x24), new SqlParameter("@S_KnowledgePoint_Id", SqlDbType.Char, 0x24), new SqlParameter("@KPNameBasic", SqlDbType.VarChar, 200), new SqlParameter("@topicNumber_Right", SqlDbType.VarChar, 500), new SqlParameter("@topicNumber_Wrong", SqlDbType.VarChar, 500), new SqlParameter("@topicNumber", SqlDbType.VarChar, 500), new SqlParameter("@TestType", SqlDbType.VarChar, 500), new SqlParameter("@SumScore", SqlDbType.Decimal, 9), new SqlParameter("@KPMastery", SqlDbType.Decimal, 9), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@StatsStuHW_KP_Id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.HomeWork_Id; cmdParms[1].Value = model.HomeWorkCreateTime; cmdParms[2].Value = model.Student_HomeWork_Id; cmdParms[3].Value = model.Student_Id; cmdParms[4].Value = model.S_KnowledgePoint_Id; cmdParms[5].Value = model.KPNameBasic; cmdParms[6].Value = model.topicNumber_Right; cmdParms[7].Value = model.topicNumber_Wrong; cmdParms[8].Value = model.topicNumber; cmdParms[9].Value = model.TestType; cmdParms[10].Value = model.SumScore; cmdParms[11].Value = model.KPMastery; cmdParms[12].Value = model.CreateTime; cmdParms[13].Value = model.StatsStuHW_KP_Id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool Add(Model_StatsStuHW_KP model) { return(this.dal.Add(model)); }
public bool Update(Model_StatsStuHW_KP model) { return(this.dal.Update(model)); }
public Model_StatsStuHW_KP DataRowToModel(DataRow row) { Model_StatsStuHW_KP uhw_kp = new Model_StatsStuHW_KP(); if (row != null) { if (row["StatsStuHW_KP_Id"] != null) { uhw_kp.StatsStuHW_KP_Id = row["StatsStuHW_KP_Id"].ToString(); } if (row["HomeWork_Id"] != null) { uhw_kp.HomeWork_Id = row["HomeWork_Id"].ToString(); } if ((row["HomeWorkCreateTime"] != null) && (row["HomeWorkCreateTime"].ToString() != "")) { uhw_kp.HomeWorkCreateTime = new DateTime?(DateTime.Parse(row["HomeWorkCreateTime"].ToString())); } if (row["Student_HomeWork_Id"] != null) { uhw_kp.Student_HomeWork_Id = row["Student_HomeWork_Id"].ToString(); } if (row["Student_Id"] != null) { uhw_kp.Student_Id = row["Student_Id"].ToString(); } if (row["S_KnowledgePoint_Id"] != null) { uhw_kp.S_KnowledgePoint_Id = row["S_KnowledgePoint_Id"].ToString(); } if (row["KPNameBasic"] != null) { uhw_kp.KPNameBasic = row["KPNameBasic"].ToString(); } if (row["topicNumber_Right"] != null) { uhw_kp.topicNumber_Right = row["topicNumber_Right"].ToString(); } if (row["topicNumber_Wrong"] != null) { uhw_kp.topicNumber_Wrong = row["topicNumber_Wrong"].ToString(); } if (row["topicNumber"] != null) { uhw_kp.topicNumber = row["topicNumber"].ToString(); } if (row["TestType"] != null) { uhw_kp.TestType = row["TestType"].ToString(); } if ((row["SumScore"] != null) && (row["SumScore"].ToString() != "")) { uhw_kp.SumScore = new decimal?(decimal.Parse(row["SumScore"].ToString())); } if ((row["KPMastery"] != null) && (row["KPMastery"].ToString() != "")) { uhw_kp.KPMastery = new decimal?(decimal.Parse(row["KPMastery"].ToString())); } if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != "")) { uhw_kp.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString())); } } return(uhw_kp); }