Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static bool Update(EtNet_Models.NoticeShare model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update NoticeShare set ");
            strSql.Append("noticeid=@noticeid,");
            strSql.Append("acceptid=@acceptid");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@noticeid", SqlDbType.Int, 4),
                new SqlParameter("@acceptid", SqlDbType.Int, 4),
                new SqlParameter("@id",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.noticeid;
            parameters[1].Value = model.acceptid;
            parameters[2].Value = model.id;

            int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (result >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static bool Add(EtNet_Models.NoticeShare model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into NoticeShare(");
            strSql.Append("noticeid,acceptid)");
            strSql.Append(" values (");
            strSql.Append("@noticeid,@acceptid)");

            SqlParameter[] parameters =
            {
                new SqlParameter("@noticeid", SqlDbType.Int, 4),
                new SqlParameter("@acceptid", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.noticeid;
            parameters[1].Value = model.acceptid;

            int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (result >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static EtNet_Models.NoticeShare GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from NoticeShare ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            EtNet_Models.NoticeShare model = new EtNet_Models.NoticeShare();
            DataTable tbl = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters);

            if (tbl.Rows.Count >= 1)
            {
                model.id       = int.Parse(tbl.Rows[0]["id"].ToString());
                model.noticeid = int.Parse(tbl.Rows[0]["noticeid"].ToString());
                model.acceptid = int.Parse(tbl.Rows[0]["acceptid"].ToString());
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(EtNet_Models.NoticeShare model)
 {
     return(EtNet_DAL.NoticeShareService.Update(model));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool Add(EtNet_Models.NoticeShare model)
 {
     return(EtNet_DAL.NoticeShareService.Add(model));
 }