Exemple #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Dianda.Model.USER_EducationLevel_Base model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into USER_EducationLevel_Base(");
            strSql.Append("EducationLevel,DELFLAG)");
            strSql.Append(" values (");
            strSql.Append("@EducationLevel,@DELFLAG)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EducationLevel", SqlDbType.VarChar, 50),
                new SqlParameter("@DELFLAG",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.EducationLevel;
            parameters[1].Value = model.DELFLAG;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Dianda.Model.USER_EducationLevel_Base GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,EducationLevel,DELFLAG from USER_EducationLevel_Base ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Dianda.Model.USER_EducationLevel_Base model = new Dianda.Model.USER_EducationLevel_Base();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.EducationLevel = ds.Tables[0].Rows[0]["EducationLevel"].ToString();
                if (ds.Tables[0].Rows[0]["DELFLAG"].ToString() != "")
                {
                    model.DELFLAG = int.Parse(ds.Tables[0].Rows[0]["DELFLAG"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Dianda.Model.USER_EducationLevel_Base model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update USER_EducationLevel_Base set ");
            strSql.Append("EducationLevel=@EducationLevel,");
            strSql.Append("DELFLAG=@DELFLAG");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",             SqlDbType.Int,      4),
                new SqlParameter("@EducationLevel", SqlDbType.VarChar, 50),
                new SqlParameter("@DELFLAG",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.EducationLevel;
            parameters[2].Value = model.DELFLAG;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }