Exemplo n.º 1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MobileSoft.Model.Unified.Tb_Notice model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",          SqlDbType.VarChar,     36),
                new SqlParameter("@UserId",      SqlDbType.VarChar,     36),
                new SqlParameter("@NoticeType",  SqlDbType.Int,          4),
                new SqlParameter("@Title",       SqlDbType.VarChar,   3999),
                new SqlParameter("@Content",     SqlDbType.Text),
                new SqlParameter("@IssueDate",   SqlDbType.DateTime),
                new SqlParameter("@CommunityId", SqlDbType.VarChar,     36),
                new SqlParameter("@IsDelete",    SqlDbType.Int,          4),
                new SqlParameter("@ImageURL",    SqlDbType.NVarChar,   200),
                new SqlParameter("@ContentURL",  SqlDbType.NVarChar, 200)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.UserId;
            parameters[2].Value = model.NoticeType;
            parameters[3].Value = model.Title;
            parameters[4].Value = model.Content;
            parameters[5].Value = model.IssueDate;
            parameters[6].Value = model.CommunityId;
            parameters[7].Value = model.IsDelete;
            parameters[8].Value = model.ImageURL;
            parameters[9].Value = model.ContentURL;

            DbHelperSQL.RunProcedure("Proc_Tb_Notice_Update", parameters, out rowsAffected);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.Unified.Tb_Notice GetModel(string Id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = Id;

            MobileSoft.Model.Unified.Tb_Notice model = new MobileSoft.Model.Unified.Tb_Notice();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Notice_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.Id     = ds.Tables[0].Rows[0]["Id"].ToString();
                model.UserId = ds.Tables[0].Rows[0]["UserId"].ToString();
                if (ds.Tables[0].Rows[0]["NoticeType"].ToString() != "")
                {
                    model.NoticeType = int.Parse(ds.Tables[0].Rows[0]["NoticeType"].ToString());
                }
                model.Title   = ds.Tables[0].Rows[0]["Title"].ToString();
                model.Content = ds.Tables[0].Rows[0]["Content"].ToString();
                if (ds.Tables[0].Rows[0]["IssueDate"].ToString() != "")
                {
                    model.IssueDate = DateTime.Parse(ds.Tables[0].Rows[0]["IssueDate"].ToString());
                }
                model.CommunityId = ds.Tables[0].Rows[0]["CommunityId"].ToString();
                if (ds.Tables[0].Rows[0]["IsDelete"].ToString() != "")
                {
                    model.IsDelete = int.Parse(ds.Tables[0].Rows[0]["IsDelete"].ToString());
                }
                model.ImageURL   = ds.Tables[0].Rows[0]["ImageURL"].ToString();
                model.ContentURL = ds.Tables[0].Rows[0]["ContentURL"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }