public bool Add(Model_StatsClassHW_KPInData model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into StatsClassHW_KPInData(");
            builder.Append("StatsClassHW_KPInDataID,SchoolID,SchoolName,Gradeid,GradeName,ClassID,ClassName,SubjectID,SubjectName,TeacherID,TeacherName,DateType,DateData,KPName,KPScoreAvg,KPScoreAvgRate,TestQuestionNums,TestQuestionNumStrs,CreateTime)");
            builder.Append(" values (");
            builder.Append("@StatsClassHW_KPInDataID,@SchoolID,@SchoolName,@Gradeid,@GradeName,@ClassID,@ClassName,@SubjectID,@SubjectName,@TeacherID,@TeacherName,@DateType,@DateData,@KPName,@KPScoreAvg,@KPScoreAvgRate,@TestQuestionNums,@TestQuestionNumStrs,@CreateTime)");
            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@StatsClassHW_KPInDataID", SqlDbType.Char, 0x24), new SqlParameter("@SchoolID", SqlDbType.VarChar, 10), new SqlParameter("@SchoolName", SqlDbType.NVarChar, 250), new SqlParameter("@Gradeid", SqlDbType.VarChar, 10), new SqlParameter("@GradeName", SqlDbType.NVarChar, 250), new SqlParameter("@ClassID", SqlDbType.VarChar, 10), new SqlParameter("@ClassName", SqlDbType.NVarChar, 250), new SqlParameter("@SubjectID", SqlDbType.Char, 0x24), new SqlParameter("@SubjectName", SqlDbType.NVarChar, 250), new SqlParameter("@TeacherID", SqlDbType.Char, 0x24), new SqlParameter("@TeacherName", SqlDbType.NVarChar, 250), new SqlParameter("@DateType", SqlDbType.VarChar, 10), new SqlParameter("@DateData", SqlDbType.VarChar, 20), new SqlParameter("@KPName", SqlDbType.NVarChar, 200), new SqlParameter("@KPScoreAvg", SqlDbType.Decimal, 5), new SqlParameter("@KPScoreAvgRate", SqlDbType.Decimal, 5),
                new SqlParameter("@TestQuestionNums", SqlDbType.VarChar, 500), new SqlParameter("@TestQuestionNumStrs", SqlDbType.VarChar, 800), new SqlParameter("@CreateTime", SqlDbType.DateTime)
            };
            cmdParms[0].Value    = model.StatsClassHW_KPInDataID;
            cmdParms[1].Value    = model.SchoolID;
            cmdParms[2].Value    = model.SchoolName;
            cmdParms[3].Value    = model.Gradeid;
            cmdParms[4].Value    = model.GradeName;
            cmdParms[5].Value    = model.ClassID;
            cmdParms[6].Value    = model.ClassName;
            cmdParms[7].Value    = model.SubjectID;
            cmdParms[8].Value    = model.SubjectName;
            cmdParms[9].Value    = model.TeacherID;
            cmdParms[10].Value   = model.TeacherName;
            cmdParms[11].Value   = model.DateType;
            cmdParms[12].Value   = model.DateData;
            cmdParms[13].Value   = model.KPName;
            cmdParms[14].Value   = model.KPScoreAvg;
            cmdParms[15].Value   = model.KPScoreAvgRate;
            cmdParms[0x10].Value = model.TestQuestionNums;
            cmdParms[0x11].Value = model.TestQuestionNumStrs;
            cmdParms[0x12].Value = model.CreateTime;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
        public bool Update(Model_StatsClassHW_KPInData model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update StatsClassHW_KPInData set ");
            builder.Append("SchoolID=@SchoolID,");
            builder.Append("SchoolName=@SchoolName,");
            builder.Append("Gradeid=@Gradeid,");
            builder.Append("GradeName=@GradeName,");
            builder.Append("ClassID=@ClassID,");
            builder.Append("ClassName=@ClassName,");
            builder.Append("SubjectID=@SubjectID,");
            builder.Append("SubjectName=@SubjectName,");
            builder.Append("TeacherID=@TeacherID,");
            builder.Append("TeacherName=@TeacherName,");
            builder.Append("DateType=@DateType,");
            builder.Append("DateData=@DateData,");
            builder.Append("KPName=@KPName,");
            builder.Append("KPScoreAvg=@KPScoreAvg,");
            builder.Append("KPScoreAvgRate=@KPScoreAvgRate,");
            builder.Append("TestQuestionNums=@TestQuestionNums,");
            builder.Append("TestQuestionNumStrs=@TestQuestionNumStrs,");
            builder.Append("CreateTime=@CreateTime");
            builder.Append(" where StatsClassHW_KPInDataID=@StatsClassHW_KPInDataID ");
            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@SchoolID", SqlDbType.VarChar, 10), new SqlParameter("@SchoolName", SqlDbType.NVarChar, 250), new SqlParameter("@Gradeid", SqlDbType.VarChar, 10), new SqlParameter("@GradeName", SqlDbType.NVarChar, 250), new SqlParameter("@ClassID", SqlDbType.VarChar, 10), new SqlParameter("@ClassName", SqlDbType.NVarChar, 250), new SqlParameter("@SubjectID", SqlDbType.Char, 0x24), new SqlParameter("@SubjectName", SqlDbType.NVarChar, 250), new SqlParameter("@TeacherID", SqlDbType.Char, 0x24), new SqlParameter("@TeacherName", SqlDbType.NVarChar, 250), new SqlParameter("@DateType", SqlDbType.VarChar, 10), new SqlParameter("@DateData", SqlDbType.VarChar, 20), new SqlParameter("@KPName", SqlDbType.NVarChar, 200), new SqlParameter("@KPScoreAvg", SqlDbType.Decimal, 5), new SqlParameter("@KPScoreAvgRate", SqlDbType.Decimal, 5), new SqlParameter("@TestQuestionNums", SqlDbType.VarChar, 500),
                new SqlParameter("@TestQuestionNumStrs", SqlDbType.VarChar, 800), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@StatsClassHW_KPInDataID", SqlDbType.Char, 0x24)
            };
            cmdParms[0].Value    = model.SchoolID;
            cmdParms[1].Value    = model.SchoolName;
            cmdParms[2].Value    = model.Gradeid;
            cmdParms[3].Value    = model.GradeName;
            cmdParms[4].Value    = model.ClassID;
            cmdParms[5].Value    = model.ClassName;
            cmdParms[6].Value    = model.SubjectID;
            cmdParms[7].Value    = model.SubjectName;
            cmdParms[8].Value    = model.TeacherID;
            cmdParms[9].Value    = model.TeacherName;
            cmdParms[10].Value   = model.DateType;
            cmdParms[11].Value   = model.DateData;
            cmdParms[12].Value   = model.KPName;
            cmdParms[13].Value   = model.KPScoreAvg;
            cmdParms[14].Value   = model.KPScoreAvgRate;
            cmdParms[15].Value   = model.TestQuestionNums;
            cmdParms[0x10].Value = model.TestQuestionNumStrs;
            cmdParms[0x11].Value = model.CreateTime;
            cmdParms[0x12].Value = model.StatsClassHW_KPInDataID;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
        public List <Model_StatsClassHW_KPInData> DataTableToList(DataTable dt)
        {
            List <Model_StatsClassHW_KPInData> list = new List <Model_StatsClassHW_KPInData>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_StatsClassHW_KPInData item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
        public Model_StatsClassHW_KPInData DataRowToModel(DataRow row)
        {
            Model_StatsClassHW_KPInData data = new Model_StatsClassHW_KPInData();

            if (row != null)
            {
                if (row["StatsClassHW_KPInDataID"] != null)
                {
                    data.StatsClassHW_KPInDataID = row["StatsClassHW_KPInDataID"].ToString();
                }
                if (row["SchoolID"] != null)
                {
                    data.SchoolID = row["SchoolID"].ToString();
                }
                if (row["SchoolName"] != null)
                {
                    data.SchoolName = row["SchoolName"].ToString();
                }
                if (row["Gradeid"] != null)
                {
                    data.Gradeid = row["Gradeid"].ToString();
                }
                if (row["GradeName"] != null)
                {
                    data.GradeName = row["GradeName"].ToString();
                }
                if (row["ClassID"] != null)
                {
                    data.ClassID = row["ClassID"].ToString();
                }
                if (row["ClassName"] != null)
                {
                    data.ClassName = row["ClassName"].ToString();
                }
                if (row["SubjectID"] != null)
                {
                    data.SubjectID = row["SubjectID"].ToString();
                }
                if (row["SubjectName"] != null)
                {
                    data.SubjectName = row["SubjectName"].ToString();
                }
                if (row["TeacherID"] != null)
                {
                    data.TeacherID = row["TeacherID"].ToString();
                }
                if (row["TeacherName"] != null)
                {
                    data.TeacherName = row["TeacherName"].ToString();
                }
                if (row["DateType"] != null)
                {
                    data.DateType = row["DateType"].ToString();
                }
                if (row["DateData"] != null)
                {
                    data.DateData = row["DateData"].ToString();
                }
                if (row["KPName"] != null)
                {
                    data.KPName = row["KPName"].ToString();
                }
                if ((row["KPScoreAvg"] != null) && (row["KPScoreAvg"].ToString() != ""))
                {
                    data.KPScoreAvg = new decimal?(decimal.Parse(row["KPScoreAvg"].ToString()));
                }
                if ((row["KPScoreAvgRate"] != null) && (row["KPScoreAvgRate"].ToString() != ""))
                {
                    data.KPScoreAvgRate = new decimal?(decimal.Parse(row["KPScoreAvgRate"].ToString()));
                }
                if (row["TestQuestionNums"] != null)
                {
                    data.TestQuestionNums = row["TestQuestionNums"].ToString();
                }
                if (row["TestQuestionNumStrs"] != null)
                {
                    data.TestQuestionNumStrs = row["TestQuestionNumStrs"].ToString();
                }
                if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != ""))
                {
                    data.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString()));
                }
            }
            return(data);
        }
 public bool Add(Model_StatsClassHW_KPInData model)
 {
     return(this.dal.Add(model));
 }
 public bool Update(Model_StatsClassHW_KPInData model)
 {
     return(this.dal.Update(model));
 }