Ejemplo n.º 1
0
 protected void lnk_Delete_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp(ActionType.Delete.ToString()))
     {
         base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền");
     }
     else
     {
         int            @int     = WebUtils.GetInt((sender as LinkButton).CommandArgument);
         SearchRankInfo dataById = SinGooCMS.BLL.SearchRank.GetDataById(@int);
         if (dataById == null)
         {
             base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa");
         }
         else if (SinGooCMS.BLL.SearchRank.Delete(@int))
         {
             this.BindData();
             PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除搜索关键字[" + dataById.SearchKey + "] thành công");
             base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công");
         }
         else
         {
             base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại");
         }
     }
 }
Ejemplo n.º 2
0
        private void InitForModify()
        {
            SearchRankInfo dataById = SinGooCMS.BLL.SearchRank.GetDataById(base.OpID);

            this.TextBox1.Text     = dataById.SearchKey;
            this.TextBox2.Text     = dataById.Times.ToString();
            this.CheckBox3.Checked = dataById.IsRecommend;
        }
Ejemplo n.º 3
0
 protected void btnok_Click(object sender, System.EventArgs e)
 {
     if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString()))
     {
         base.ShowMsg("Không có thẩm quyền");
     }
     else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString()))
     {
         base.ShowMsg("Không có thẩm quyền");
     }
     else
     {
         SearchRankInfo searchRankInfo = new SearchRankInfo();
         if (base.IsEdit)
         {
             searchRankInfo = SinGooCMS.BLL.SearchRank.GetDataById(base.OpID);
         }
         searchRankInfo.SearchKey   = WebUtils.GetString(this.TextBox1.Text);
         searchRankInfo.Times       = WebUtils.GetInt(this.TextBox2.Text);
         searchRankInfo.IsRecommend = this.CheckBox3.Checked;
         if (string.IsNullOrEmpty(searchRankInfo.SearchKey))
         {
             base.ShowMsg("请输入搜索关键字");
         }
         else
         {
             if (base.Action.Equals(ActionType.Add.ToString()))
             {
                 if (SinGooCMS.BLL.SearchRank.Add(searchRankInfo) > 0)
                 {
                     PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加搜索关键字[" + searchRankInfo.SearchKey + "] thành công");
                     MessageUtils.DialogCloseAndParentReload(this);
                 }
                 else
                 {
                     base.ShowMsg("Thao tác thất bại");
                 }
             }
             if (base.Action.Equals(ActionType.Modify.ToString()))
             {
                 if (SinGooCMS.BLL.SearchRank.Update(searchRankInfo))
                 {
                     PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改搜索关键字[" + searchRankInfo.SearchKey + "] thành công");
                     MessageUtils.DialogCloseAndParentReload(this);
                 }
                 else
                 {
                     base.ShowMsg("Thao tác thất bại");
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        public static int Add(SearchRankInfo entity)
        {
            int result;

            if (entity == null)
            {
                result = 0;
            }
            else
            {
                result = BizBase.dbo.InsertModel <SearchRankInfo>(entity);
            }
            return(result);
        }
Ejemplo n.º 5
0
        public static void Save(string key)
        {
            SearchRankInfo searchRankInfo = SearchRank.Get(key);

            if (searchRankInfo != null)
            {
                searchRankInfo.Times++;
                SearchRank.Update(searchRankInfo);
            }
            else
            {
                SearchRank.Add(new SearchRankInfo
                {
                    SearchKey   = key,
                    Times       = 1,
                    IsRecommend = false
                });
            }
        }
Ejemplo n.º 6
0
 public static bool Update(SearchRankInfo entity)
 {
     return(entity != null && BizBase.dbo.UpdateModel <SearchRankInfo>(entity));
 }