Пример #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);
         LinksInfo dataById = Links.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 (Links.Delete(@int))
         {
             this.BindData();
             PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除链接[" + dataById.LinkName + "] 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");
         }
     }
 }
    private void Delete(string entry)
    {
        try{
            if (entry == "")
            {
                lblMessage.Text = "Select a Title.";
                return;
            }

            if (Links.Delete(Convert.ToInt32(entry)))
            {
                lblMessage.Text = "The content was succesfully Deleted.";
            }
            else
            {
                lblMessage.Text = "There was problem Deleting the content.";
            }
        }
        catch { }
    }
Пример #3
0
        protected void gView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string id = e.CommandArgument.ToString();

            if (e.CommandName == "btnEdit")
            {
                // Sửa
                ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow",
                                                   "window.open('LinkEdit.aspx?ID=" + id + "');", true);
            }
            else if (e.CommandName == "btnDelete")
            {
                // Xóa
                Links _obj = new Links();
                _obj.LinkID = Convert.ToInt32(id);

                Links.Delete(_obj);

                // Load lại dữ liệu
                gView_Binding();
            }
        }
Пример #4
0
 protected void btn_DelBat_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp(ActionType.Delete.ToString()))
     {
         base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền");
     }
     else
     {
         string repeaterCheckIDs = base.GetRepeaterCheckIDs(this.Repeater1, "chk", "autoid");
         if (!string.IsNullOrEmpty(repeaterCheckIDs))
         {
             if (Links.Delete(repeaterCheckIDs))
             {
                 this.BindData();
                 PageBase.log.AddEvent(base.LoginAccount.AccountName, "批量删除链接成功");
                 base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công");
             }
             else
             {
                 base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại");
             }
         }
     }
 }