Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(university.Model.CCOM.Notice_type model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Notice_type set ");

            strSql.Append(" Notice_type_name = @Notice_type_name , ");
            strSql.Append(" Notice_type_creator_id = @Notice_type_creator_id , ");
            strSql.Append(" Notice_type_date = @Notice_type_date  ");
            strSql.Append(" where Notice_type_id=@Notice_type_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Notice_type_id",         SqlDbType.BigInt,   8),
                new SqlParameter("@Notice_type_name",       SqlDbType.VarChar, 64),
                new SqlParameter("@Notice_type_creator_id", SqlDbType.BigInt,   8),
                new SqlParameter("@Notice_type_date",       SqlDbType.DateTime)
            };

            parameters[0].Value = model.Notice_type_id;
            parameters[1].Value = model.Notice_type_name;
            parameters[2].Value = model.Notice_type_creator_id;
            parameters[3].Value = model.Notice_type_date;
            int rows = DBSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.Notice_type GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Notice_type_id, Notice_type_name, Notice_type_creator_id, Notice_type_date  ");
            strSql.Append("  from Notice_type ");
            strSql.Append(" where " + strWhere);


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Notice_type_id"].ToString() != "")
                {
                    model.Notice_type_id = long.Parse(ds.Tables[0].Rows[0]["Notice_type_id"].ToString());
                }
                model.Notice_type_name = ds.Tables[0].Rows[0]["Notice_type_name"].ToString();
                if (ds.Tables[0].Rows[0]["Notice_type_creator_id"].ToString() != "")
                {
                    model.Notice_type_creator_id = long.Parse(ds.Tables[0].Rows[0]["Notice_type_creator_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Notice_type_date"].ToString() != "")
                {
                    model.Notice_type_date = DateTime.Parse(ds.Tables[0].Rows[0]["Notice_type_date"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(university.Model.CCOM.Notice_type model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Notice_type(");
            strSql.Append("Notice_type_name,Notice_type_creator_id,Notice_type_date");
            strSql.Append(") values (");
            strSql.Append("@Notice_type_name,@Notice_type_creator_id,@Notice_type_date");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Notice_type_name",       SqlDbType.VarChar, 64),
                new SqlParameter("@Notice_type_creator_id", SqlDbType.BigInt,   8),
                new SqlParameter("@Notice_type_date",       SqlDbType.DateTime)
            };

            parameters[0].Value = model.Notice_type_name;
            parameters[1].Value = model.Notice_type_creator_id;
            parameters[2].Value = model.Notice_type_date;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.Notice_type GetModel(long Notice_type_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Notice_type_id, Notice_type_name, Notice_type_creator_id, Notice_type_date  ");
            strSql.Append("  from Notice_type ");
            strSql.Append(" where Notice_type_id=@Notice_type_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Notice_type_id", SqlDbType.BigInt)
            };
            parameters[0].Value = Notice_type_id;


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Notice_type_id"].ToString() != "")
                {
                    model.Notice_type_id = long.Parse(ds.Tables[0].Rows[0]["Notice_type_id"].ToString());
                }
                model.Notice_type_name = ds.Tables[0].Rows[0]["Notice_type_name"].ToString();
                if (ds.Tables[0].Rows[0]["Notice_type_creator_id"].ToString() != "")
                {
                    model.Notice_type_creator_id = long.Parse(ds.Tables[0].Rows[0]["Notice_type_creator_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Notice_type_date"].ToString() != "")
                {
                    model.Notice_type_date = DateTime.Parse(ds.Tables[0].Rows[0]["Notice_type_date"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }