private void SetPage(string id)
        {
            ActivityAdEntity disEntity = bll.GetEntitySigInfo("id=" + id);

            if (disEntity.Id > 0)
            {
                ddl_sel_dishetypetwo.SelectedValue = disEntity.Type.ToString();
                txt_title.Value = disEntity.Title;
                txt_sort.Value  = disEntity.Sort.ToString();
                txt_url.Value   = disEntity.Url;
                txtDes.Value    = disEntity.Description;
                hidimages.Value = disEntity.images;
                string imageHtml = "";
                if (disEntity.images.Length > 0)
                {
                    foreach (string img in disEntity.images.Split(','))
                    {
                        if (!string.IsNullOrWhiteSpace(img))
                        {
                            imageHtml += "<img  imgindex=\"\"  width=\"200\" height=\"200\" style=\"float: left; margin-left:10px;\" src=\"/UploadFiles" + img + "\" onclick=\"deleteimage(this, '" + img + "')\" />";
                        }
                    }
                    HidImagesHtml.Value = imageHtml;
                }
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(string GUID, string UID, string Id, string Title, string status, string Sort, string Description, string Type, string images, string Url)
        {
            bool strReturn = CheckPageInfo("update", Id, Title, status, Sort, Description, Type, images, Url);

            //数据页面验证
            if (!strReturn)
            {
                CheckResult(-2, "");
                return;
            }
            //获取更新前的数据对象
            ActivityAdEntity OldEntity = new ActivityAdEntity();

            OldEntity             = GetEntitySigInfo(" where Id='" + Id + "'");
            OldEntity.Title       = Title;
            OldEntity.status      = StringHelper.StringToInt(status);
            OldEntity.Sort        = StringHelper.StringToInt(Sort);
            OldEntity.Description = Description;
            OldEntity.Type        = StringHelper.StringToInt(Type);
            OldEntity.images      = images;
            OldEntity.Url         = Url;
            //更新数据
            int result = dal.Update(OldEntity);

            //检测执行结果
            CheckResult(result, "");
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        //public DataTable Update(string GUID, string UID, string userid, string uname, string upwd, string realname, string umobile, string empcode, string remark, string status, string cname, string ccode, string role, string scope, string stocode, string sigmonthmoney, string sigstocode,string buscode,string utype, operatelogEntity entity)
        public void UpdateByEntity(string GUID, string UID, ActivityAdEntity UEntity)
        {
            //更新数据
            int result = dal.Update(UEntity);

            //检测执行结果
            CheckResult(result, "");
        }
        /// <summary>
        /// 单行数据转实体对象
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private ActivityAdEntity SetEntityInfo(DataRow dr)
        {
            ActivityAdEntity Entity = new ActivityAdEntity();

            Entity.Id          = StringHelper.StringToInt(dr["Id"].ToString());
            Entity.Title       = dr["Title"].ToString();
            Entity.status      = StringHelper.StringToInt(dr["status"].ToString());
            Entity.Sort        = StringHelper.StringToInt(dr["Sort"].ToString());
            Entity.Description = dr["Description"].ToString();
            Entity.Type        = StringHelper.StringToInt(dr["Type"].ToString());
            Entity.images      = dr["images"].ToString();
            Entity.Url         = dr["Url"].ToString();
            return(Entity);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(ActivityAdEntity Entity)
 {
     SqlParameter[] sqlParameters =
     {
         new SqlParameter("@Id",          Entity.Id),
         new SqlParameter("@Title",       Entity.Title),
         new SqlParameter("@status",      Entity.status),
         new SqlParameter("@Sort",        Entity.Sort),
         new SqlParameter("@Description", Entity.Description),
         new SqlParameter("@Type",        Entity.Type),
         new SqlParameter("@images",      Entity.images),
         new SqlParameter("@Url",         Entity.Url),
     };
     return(DBHelper.ExecuteNonQuery("dbo.p_ActivityAd_Update", CommandType.StoredProcedure, sqlParameters));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ref ActivityAdEntity Entity)
 {
     intReturn = 0;
     SqlParameter[] sqlParameters =
     {
         new SqlParameter("@Id",          Entity.Id),
         new SqlParameter("@Title",       Entity.Title),
         new SqlParameter("@status",      Entity.status),
         new SqlParameter("@Sort",        Entity.Sort),
         new SqlParameter("@Description", Entity.Description),
         new SqlParameter("@Type",        Entity.Type),
         new SqlParameter("@images",      Entity.images),
         new SqlParameter("@Url",         Entity.Url),
     };
     sqlParameters[0].Direction = ParameterDirection.Output;
     intReturn = DBHelper.ExecuteNonQuery("dbo.p_ActivityAd_Add", CommandType.StoredProcedure, sqlParameters);
     if (intReturn == 0)
     {
         Entity.Id = int.Parse(sqlParameters[0].Value.ToString());
     }
     return(intReturn);
 }
        /// <summary>
        /// 检验表单数据
        /// </summary>
        /// <returns></returns>
        public bool CheckPageInfo(string type, string Id, string Title, string status, string Sort, string Description, string Type, string images, string Url)
        {
            bool rel = false;

            try
            {
                Entity             = new ActivityAdEntity();
                Entity.Id          = StringHelper.StringToInt(Id);
                Entity.Title       = Title;
                Entity.status      = StringHelper.StringToInt(status);
                Entity.Sort        = StringHelper.StringToInt(Sort);
                Entity.Description = Description;
                Entity.Type        = StringHelper.StringToInt(Type);
                Entity.images      = images;
                Entity.Url         = Url;
                rel = true;
            }
            catch (System.Exception)
            {
            }
            return(rel);
        }