コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(cycms.Model.TeacherWorkResume model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo_TeacherWorkResume(");
            strSql.Append("dbo_StartTime,dbo_EndTime,dbo_Unit,dbo_Duty,dbo_Remark,dbo_TeacherId)");
            strSql.Append(" values (");
            strSql.Append("@dbo_StartTime,@dbo_EndTime,@dbo_Unit,@dbo_Duty,@dbo_Remark,@dbo_TeacherId)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@dbo_StartTime", OleDbType.VarChar, 100),
                new OleDbParameter("@dbo_EndTime",   OleDbType.VarChar, 100),
                new OleDbParameter("@dbo_Unit",      OleDbType.VarChar, 200),
                new OleDbParameter("@dbo_Duty",      OleDbType.VarChar, 100),
                new OleDbParameter("@dbo_Remark",    OleDbType.VarChar,   0),
                new OleDbParameter("@dbo_TeacherId", OleDbType.Integer, 4)
            };
            parameters[0].Value = model.dbo_StartTime;
            parameters[1].Value = model.dbo_EndTime;
            parameters[2].Value = model.dbo_Unit;
            parameters[3].Value = model.dbo_Duty;
            parameters[4].Value = model.dbo_Remark;
            parameters[5].Value = model.dbo_TeacherId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(cycms.Model.TeacherWorkResume model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo_TeacherWorkResume set ");
            strSql.Append("dbo_StartTime=@dbo_StartTime,");
            strSql.Append("dbo_EndTime=@dbo_EndTime,");
            strSql.Append("dbo_Unit=@dbo_Unit,");
            strSql.Append("dbo_Duty=@dbo_Duty,");
            strSql.Append("dbo_Remark=@dbo_Remark,");
            strSql.Append("dbo_TeacherId=@dbo_TeacherId");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@dbo_StartTime", OleDbType.VarChar, 100),
                new OleDbParameter("@dbo_EndTime",   OleDbType.VarChar, 100),
                new OleDbParameter("@dbo_Unit",      OleDbType.VarChar, 200),
                new OleDbParameter("@dbo_Duty",      OleDbType.VarChar, 100),
                new OleDbParameter("@dbo_Remark",    OleDbType.VarChar,   0),
                new OleDbParameter("@dbo_TeacherId", OleDbType.Integer,   4),
                new OleDbParameter("@ID",            OleDbType.Integer, 4)
            };
            parameters[0].Value = model.dbo_StartTime;
            parameters[1].Value = model.dbo_EndTime;
            parameters[2].Value = model.dbo_Unit;
            parameters[3].Value = model.dbo_Duty;
            parameters[4].Value = model.dbo_Remark;
            parameters[5].Value = model.dbo_TeacherId;
            parameters[6].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public cycms.Model.TeacherWorkResume DataRowToModel(DataRow row)
 {
     cycms.Model.TeacherWorkResume model = new cycms.Model.TeacherWorkResume();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["dbo_StartTime"] != null)
         {
             model.dbo_StartTime = row["dbo_StartTime"].ToString();
         }
         if (row["dbo_EndTime"] != null)
         {
             model.dbo_EndTime = row["dbo_EndTime"].ToString();
         }
         if (row["dbo_Unit"] != null)
         {
             model.dbo_Unit = row["dbo_Unit"].ToString();
         }
         if (row["dbo_Duty"] != null)
         {
             model.dbo_Duty = row["dbo_Duty"].ToString();
         }
         if (row["dbo_Remark"] != null)
         {
             model.dbo_Remark = row["dbo_Remark"].ToString();
         }
         if (row["dbo_TeacherId"] != null && row["dbo_TeacherId"].ToString() != "")
         {
             model.dbo_TeacherId = int.Parse(row["dbo_TeacherId"].ToString());
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public cycms.Model.TeacherWorkResume GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,dbo_StartTime,dbo_EndTime,dbo_Unit,dbo_Duty,dbo_Remark,dbo_TeacherId from dbo_TeacherWorkResume ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@ID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

            cycms.Model.TeacherWorkResume model = new cycms.Model.TeacherWorkResume();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }