Example #1
0
        public List <JoinTeachingRecordsModel> GetListById(string Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,StudentsRealName,StudentsName,TrainingBaseCode,TrainingBaseName,ProfessionalBaseCode,ProfessionalBaseName,DeptCode,DeptName,RegisterDate,Writor,TeacherCheck,KzrCheck,BaseCheck,ManagerCheck,TeacherId,TeacherName,Comment,TeachingObject,StudentsNum,TeachingContent,HeadTeacher,TeachingDate from GP_JoinTeachingRecords ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = Id;

            DataTable dt = db.RunDataTable(strSql.ToString(), parameters);
            List <JoinTeachingRecordsModel> list = null;

            if (dt.Rows.Count > 0)
            {
                list = new List <JoinTeachingRecordsModel>();
                JoinTeachingRecordsModel model = null;
                foreach (DataRow row in dt.Rows)
                {
                    model = new JoinTeachingRecordsModel();
                    model = DataRowToModel(row);
                    list.Add(model);
                }
            }
            return(list);
        }
Example #2
0
        public bool UpdateCheckByTeacher(JoinTeachingRecordsModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update GP_JoinTeachingRecords set ");
            strSql.Append("TeacherCheck=@TeacherCheck");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TeacherCheck", SqlDbType.NVarChar, 50),
                new SqlParameter("@Id",           SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.TeacherCheck;
            parameters[1].Value = model.Id;

            int rows = db.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public List <Model.JoinTeachingRecordsModel> GetPagedList(string StudentsName, string TrainingBaseCode, string DeptName,
                                                                  string TeachingObject, string HeadTeacher, string TeachingDate,
                                                                  int start, int end)
        {
            string sql = "select * from (select row_number() over(order by RegisterDate desc) as num,* from GP_JoinTeachingRecords where StudentsName='" + StudentsName + "' and TrainingBaseCode='" + TrainingBaseCode + "'";

            if (!string.IsNullOrEmpty(DeptName))
            {
                sql += "and DeptName like '%" + DeptName + "%'";
            }
            if (!string.IsNullOrEmpty(TeachingObject))
            {
                sql += "and TeachingObject like '%" + TeachingObject + "%'";
            }
            if (!string.IsNullOrEmpty(HeadTeacher))
            {
                sql += "and HeadTeacher like '%" + HeadTeacher + "%'";
            }
            if (!string.IsNullOrEmpty(TeachingDate))
            {
                sql += "and TeachingDate like '%" + TeachingDate + "%'";
            }
            sql += ")as t where t.num>=@start and t.num<=@end";


            SqlParameter[] pars =
            {
                new SqlParameter("@start", SqlDbType.Int),
                new SqlParameter("@end",   SqlDbType.Int)
            };
            pars[0].Value = start;
            pars[1].Value = end;
            DataTable dt = db.RunDataTable(sql, pars);
            List <JoinTeachingRecordsModel> list = null;

            if (dt.Rows.Count > 0)
            {
                list = new List <JoinTeachingRecordsModel>();
                JoinTeachingRecordsModel model = null;
                foreach (DataRow row in dt.Rows)
                {
                    model = new JoinTeachingRecordsModel();
                    model = DataRowToModel(row);
                    list.Add(model);
                }
            }
            return(list);
        }
Example #4
0
        public JoinTeachingRecordsModel DataRowToModel(DataRow row)
        {
            JoinTeachingRecordsModel model = new JoinTeachingRecordsModel();

            if (row != null)
            {
                if (row["Id"] != null)
                {
                    model.Id = row["Id"].ToString();
                }
                if (row["StudentsRealName"] != null)
                {
                    model.StudentsRealName = row["StudentsRealName"].ToString();
                }
                if (row["StudentsName"] != null)
                {
                    model.StudentsName = row["StudentsName"].ToString();
                }
                if (row["TrainingBaseCode"] != null)
                {
                    model.TrainingBaseCode = row["TrainingBaseCode"].ToString();
                }
                if (row["TrainingBaseName"] != null)
                {
                    model.TrainingBaseName = row["TrainingBaseName"].ToString();
                }
                if (row["ProfessionalBaseCode"] != null)
                {
                    model.ProfessionalBaseCode = row["ProfessionalBaseCode"].ToString();
                }
                if (row["ProfessionalBaseName"] != null)
                {
                    model.ProfessionalBaseName = row["ProfessionalBaseName"].ToString();
                }
                if (row["DeptCode"] != null)
                {
                    model.DeptCode = row["DeptCode"].ToString();
                }
                if (row["DeptName"] != null)
                {
                    model.DeptName = row["DeptName"].ToString();
                }
                if (row["RegisterDate"] != null)
                {
                    model.RegisterDate = row["RegisterDate"].ToString();
                }
                if (row["Writor"] != null)
                {
                    model.Writor = row["Writor"].ToString();
                }
                if (row["TeacherCheck"] != null)
                {
                    model.TeacherCheck = row["TeacherCheck"].ToString();
                }
                if (row["KzrCheck"] != null)
                {
                    model.KzrCheck = row["KzrCheck"].ToString();
                }
                if (row["BaseCheck"] != null)
                {
                    model.BaseCheck = row["BaseCheck"].ToString();
                }
                if (row["ManagerCheck"] != null)
                {
                    model.ManagerCheck = row["ManagerCheck"].ToString();
                }
                if (row["TeacherId"] != null)
                {
                    model.TeacherId = row["TeacherId"].ToString();
                }
                if (row["TeacherName"] != null)
                {
                    model.TeacherName = row["TeacherName"].ToString();
                }
                if (row["Comment"] != null)
                {
                    model.Comment = row["Comment"].ToString();
                }
                if (row["TeachingObject"] != null)
                {
                    model.TeachingObject = row["TeachingObject"].ToString();
                }
                if (row["StudentsNum"] != null)
                {
                    model.StudentsNum = row["StudentsNum"].ToString();
                }
                if (row["TeachingContent"] != null)
                {
                    model.TeachingContent = row["TeachingContent"].ToString();
                }
                if (row["HeadTeacher"] != null)
                {
                    model.HeadTeacher = row["HeadTeacher"].ToString();
                }
                if (row["TeachingDate"] != null)
                {
                    model.TeachingDate = row["TeachingDate"].ToString();
                }
            }
            return(model);
        }
Example #5
0
        public bool Add(JoinTeachingRecordsModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into GP_JoinTeachingRecords(");
            strSql.Append("Id,StudentsRealName,StudentsName,TrainingBaseCode,TrainingBaseName,ProfessionalBaseCode,ProfessionalBaseName,DeptCode,DeptName,RegisterDate,Writor,TeacherCheck,KzrCheck,BaseCheck,ManagerCheck,TeacherId,TeacherName,Comment,TeachingObject,StudentsNum,TeachingContent,HeadTeacher,TeachingDate)");
            strSql.Append(" values (");
            strSql.Append("@Id,@StudentsRealName,@StudentsName,@TrainingBaseCode,@TrainingBaseName,@ProfessionalBaseCode,@ProfessionalBaseName,@DeptCode,@DeptName,@RegisterDate,@Writor,@TeacherCheck,@KzrCheck,@BaseCheck,@ManagerCheck,@TeacherId,@TeacherName,@Comment,@TeachingObject,@StudentsNum,@TeachingContent,@HeadTeacher,@TeachingDate)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",                   SqlDbType.NVarChar,   50),
                new SqlParameter("@StudentsRealName",     SqlDbType.NVarChar,   50),
                new SqlParameter("@StudentsName",         SqlDbType.NVarChar,   50),
                new SqlParameter("@TrainingBaseCode",     SqlDbType.NVarChar,   50),
                new SqlParameter("@TrainingBaseName",     SqlDbType.NVarChar,   50),
                new SqlParameter("@ProfessionalBaseCode", SqlDbType.NVarChar,   50),
                new SqlParameter("@ProfessionalBaseName", SqlDbType.NVarChar,   50),
                new SqlParameter("@DeptCode",             SqlDbType.NVarChar,   50),
                new SqlParameter("@DeptName",             SqlDbType.NVarChar,  500),
                new SqlParameter("@RegisterDate",         SqlDbType.NVarChar,   50),
                new SqlParameter("@Writor",               SqlDbType.NVarChar,   50),
                new SqlParameter("@TeacherCheck",         SqlDbType.NVarChar,   50),
                new SqlParameter("@KzrCheck",             SqlDbType.NVarChar,   50),
                new SqlParameter("@BaseCheck",            SqlDbType.NVarChar,   50),
                new SqlParameter("@ManagerCheck",         SqlDbType.NVarChar,   50),
                new SqlParameter("@TeacherId",            SqlDbType.NVarChar,   50),
                new SqlParameter("@TeacherName",          SqlDbType.NVarChar,   50),
                new SqlParameter("@Comment",              SqlDbType.NVarChar, 1000),
                new SqlParameter("@TeachingObject",       SqlDbType.NVarChar,   50),
                new SqlParameter("@StudentsNum",          SqlDbType.NVarChar,   50),
                new SqlParameter("@TeachingContent",      SqlDbType.NVarChar, 2000),
                new SqlParameter("@HeadTeacher",          SqlDbType.NVarChar,   50),
                new SqlParameter("@TeachingDate",         SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.StudentsRealName;
            parameters[2].Value  = model.StudentsName;
            parameters[3].Value  = model.TrainingBaseCode;
            parameters[4].Value  = model.TrainingBaseName;
            parameters[5].Value  = model.ProfessionalBaseCode;
            parameters[6].Value  = model.ProfessionalBaseName;
            parameters[7].Value  = model.DeptCode;
            parameters[8].Value  = model.DeptName;
            parameters[9].Value  = model.RegisterDate;
            parameters[10].Value = model.Writor;
            parameters[11].Value = model.TeacherCheck;
            parameters[12].Value = model.KzrCheck;
            parameters[13].Value = model.BaseCheck;
            parameters[14].Value = model.ManagerCheck;
            parameters[15].Value = model.TeacherId;
            parameters[16].Value = model.TeacherName;
            parameters[17].Value = model.Comment;
            parameters[18].Value = model.TeachingObject;
            parameters[19].Value = model.StudentsNum;
            parameters[20].Value = model.TeachingContent;
            parameters[21].Value = model.HeadTeacher;
            parameters[22].Value = model.TeachingDate;

            int rows = db.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #6
0
        public bool Update(JoinTeachingRecordsModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update GP_JoinTeachingRecords set ");
            strSql.Append("StudentsRealName=@StudentsRealName,");
            strSql.Append("StudentsName=@StudentsName,");
            strSql.Append("TrainingBaseCode=@TrainingBaseCode,");
            strSql.Append("TrainingBaseName=@TrainingBaseName,");
            strSql.Append("ProfessionalBaseCode=@ProfessionalBaseCode,");
            strSql.Append("ProfessionalBaseName=@ProfessionalBaseName,");
            strSql.Append("DeptCode=@DeptCode,");
            strSql.Append("DeptName=@DeptName,");
            strSql.Append("RegisterDate=@RegisterDate,");
            strSql.Append("Writor=@Writor,");
            strSql.Append("TeacherId=@TeacherId,");
            strSql.Append("TeacherName=@TeacherName,");
            strSql.Append("Comment=@Comment,");
            strSql.Append("TeachingObject=@TeachingObject,");
            strSql.Append("StudentsNum=@StudentsNum,");
            strSql.Append("TeachingContent=@TeachingContent,");
            strSql.Append("HeadTeacher=@HeadTeacher,");
            strSql.Append("TeachingDate=@TeachingDate");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@StudentsRealName",     SqlDbType.NVarChar,   50),
                new SqlParameter("@StudentsName",         SqlDbType.NVarChar,   50),
                new SqlParameter("@TrainingBaseCode",     SqlDbType.NVarChar,   50),
                new SqlParameter("@TrainingBaseName",     SqlDbType.NVarChar,   50),
                new SqlParameter("@ProfessionalBaseCode", SqlDbType.NVarChar,   50),
                new SqlParameter("@ProfessionalBaseName", SqlDbType.NVarChar,   50),
                new SqlParameter("@DeptCode",             SqlDbType.NVarChar,   50),
                new SqlParameter("@DeptName",             SqlDbType.NVarChar,  500),
                new SqlParameter("@RegisterDate",         SqlDbType.NVarChar,   50),
                new SqlParameter("@Writor",               SqlDbType.NVarChar,   50),
                new SqlParameter("@TeacherId",            SqlDbType.NVarChar,   50),
                new SqlParameter("@TeacherName",          SqlDbType.NVarChar,   50),
                new SqlParameter("@Comment",              SqlDbType.NVarChar, 1000),
                new SqlParameter("@TeachingObject",       SqlDbType.NVarChar,   50),
                new SqlParameter("@StudentsNum",          SqlDbType.NVarChar,   50),
                new SqlParameter("@TeachingContent",      SqlDbType.NVarChar, 2000),
                new SqlParameter("@HeadTeacher",          SqlDbType.NVarChar,   50),
                new SqlParameter("@TeachingDate",         SqlDbType.NVarChar,   50),
                new SqlParameter("@Id",                   SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.StudentsRealName;
            parameters[1].Value  = model.StudentsName;
            parameters[2].Value  = model.TrainingBaseCode;
            parameters[3].Value  = model.TrainingBaseName;
            parameters[4].Value  = model.ProfessionalBaseCode;
            parameters[5].Value  = model.ProfessionalBaseName;
            parameters[6].Value  = model.DeptCode;
            parameters[7].Value  = model.DeptName;
            parameters[8].Value  = model.RegisterDate;
            parameters[9].Value  = model.Writor;
            parameters[10].Value = model.TeacherId;
            parameters[11].Value = model.TeacherName;
            parameters[12].Value = model.Comment;
            parameters[13].Value = model.TeachingObject;
            parameters[14].Value = model.StudentsNum;
            parameters[15].Value = model.TeachingContent;
            parameters[16].Value = model.HeadTeacher;
            parameters[17].Value = model.TeachingDate;
            parameters[18].Value = model.Id;

            int rows = db.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #7
0
 public bool UpdateCheckByTeacher(JoinTeachingRecordsModel model)
 {
     return(joinTeachingRecordsDAL.UpdateCheckByTeacher(model));
 }
Example #8
0
 public bool Update(JoinTeachingRecordsModel model)
 {
     return(joinTeachingRecordsDAL.Update(model));
 }
Example #9
0
 public bool Add(JoinTeachingRecordsModel model)
 {
     return(joinTeachingRecordsDAL.Add(model));
 }