Ejemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.View_Mark_table GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Mark_table_id,Rs_id,Rc_id,Score,Mark_date,Student_id,Teacher_id from View_Mark_table ");
            strSql.Append(" where " + strWhere);


            university.Model.CCOM.View_Mark_table model = new university.Model.CCOM.View_Mark_table();
            DataSet ds = DBSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Mark_table_id"] != null && ds.Tables[0].Rows[0]["Mark_table_id"].ToString() != "")
                {
                    model.Mark_table_id = long.Parse(ds.Tables[0].Rows[0]["Mark_table_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Rs_id"] != null && ds.Tables[0].Rows[0]["Rs_id"].ToString() != "")
                {
                    model.Rs_id = long.Parse(ds.Tables[0].Rows[0]["Rs_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Rc_id"] != null && ds.Tables[0].Rows[0]["Rc_id"].ToString() != "")
                {
                    model.Rc_id = long.Parse(ds.Tables[0].Rows[0]["Rc_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Score"] != null && ds.Tables[0].Rows[0]["Score"].ToString() != "")
                {
                    model.Score = int.Parse(ds.Tables[0].Rows[0]["Score"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Mark_date"] != null && ds.Tables[0].Rows[0]["Mark_date"].ToString() != "")
                {
                    model.Mark_date = DateTime.Parse(ds.Tables[0].Rows[0]["Mark_date"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Student_id"] != null && ds.Tables[0].Rows[0]["Student_id"].ToString() != "")
                {
                    model.Student_id = long.Parse(ds.Tables[0].Rows[0]["Student_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Teacher_id"] != null && ds.Tables[0].Rows[0]["Teacher_id"].ToString() != "")
                {
                    model.Teacher_id = long.Parse(ds.Tables[0].Rows[0]["Teacher_id"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(university.Model.CCOM.View_Mark_table model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update View_Mark_table set ");
            strSql.Append("Mark_table_id=@Mark_table_id,");
            strSql.Append("Rs_id=@Rs_id,");
            strSql.Append("Rc_id=@Rc_id,");
            strSql.Append("Score=@Score,");
            strSql.Append("Mark_date=@Mark_date,");
            strSql.Append("Student_id=@Student_id,");
            strSql.Append("Teacher_id=@Teacher_id");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Mark_table_id", SqlDbType.BigInt, 8),
                new SqlParameter("@Rs_id",         SqlDbType.BigInt, 8),
                new SqlParameter("@Rc_id",         SqlDbType.BigInt, 8),
                new SqlParameter("@Score",         SqlDbType.Int,    4),
                new SqlParameter("@Mark_date",     SqlDbType.Date,   3),
                new SqlParameter("@Student_id",    SqlDbType.BigInt, 8),
                new SqlParameter("@Teacher_id",    SqlDbType.BigInt, 8)
            };
            parameters[0].Value = model.Mark_table_id;
            parameters[1].Value = model.Rs_id;
            parameters[2].Value = model.Rc_id;
            parameters[3].Value = model.Score;
            parameters[4].Value = model.Mark_date;
            parameters[5].Value = model.Student_id;
            parameters[6].Value = model.Teacher_id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.View_Mark_table GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Mark_table_id,Rs_id,Rc_id,Score,Mark_date,Student_id,Teacher_id from View_Mark_table ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            university.Model.CCOM.View_Mark_table model = new university.Model.CCOM.View_Mark_table();
            DataSet ds = DBSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(university.Model.CCOM.View_Mark_table model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into View_Mark_table(");
            strSql.Append("Mark_table_id,Rs_id,Rc_id,Score,Mark_date,Student_id,Teacher_id)");
            strSql.Append(" values (");
            strSql.Append("@Mark_table_id,@Rs_id,@Rc_id,@Score,@Mark_date,@Student_id,@Teacher_id)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Mark_table_id", SqlDbType.BigInt, 8),
                new SqlParameter("@Rs_id",         SqlDbType.BigInt, 8),
                new SqlParameter("@Rc_id",         SqlDbType.BigInt, 8),
                new SqlParameter("@Score",         SqlDbType.Int,    4),
                new SqlParameter("@Mark_date",     SqlDbType.Date,   3),
                new SqlParameter("@Student_id",    SqlDbType.BigInt, 8),
                new SqlParameter("@Teacher_id",    SqlDbType.BigInt, 8)
            };
            parameters[0].Value = model.Mark_table_id;
            parameters[1].Value = model.Rs_id;
            parameters[2].Value = model.Rc_id;
            parameters[3].Value = model.Score;
            parameters[4].Value = model.Mark_date;
            parameters[5].Value = model.Student_id;
            parameters[6].Value = model.Teacher_id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public university.Model.CCOM.View_Mark_table DataRowToModel(DataRow row)
 {
     university.Model.CCOM.View_Mark_table model = new university.Model.CCOM.View_Mark_table();
     if (row != null)
     {
         if (row["Mark_table_id"] != null && row["Mark_table_id"].ToString() != "")
         {
             model.Mark_table_id = long.Parse(row["Mark_table_id"].ToString());
         }
         if (row["Rs_id"] != null && row["Rs_id"].ToString() != "")
         {
             model.Rs_id = long.Parse(row["Rs_id"].ToString());
         }
         if (row["Rc_id"] != null && row["Rc_id"].ToString() != "")
         {
             model.Rc_id = long.Parse(row["Rc_id"].ToString());
         }
         if (row["Score"] != null && row["Score"].ToString() != "")
         {
             model.Score = int.Parse(row["Score"].ToString());
         }
         if (row["Mark_date"] != null && row["Mark_date"].ToString() != "")
         {
             model.Mark_date = DateTime.Parse(row["Mark_date"].ToString());
         }
         if (row["Student_id"] != null && row["Student_id"].ToString() != "")
         {
             model.Student_id = long.Parse(row["Student_id"].ToString());
         }
         if (row["Teacher_id"] != null && row["Teacher_id"].ToString() != "")
         {
             model.Teacher_id = long.Parse(row["Teacher_id"].ToString());
         }
     }
     return(model);
 }