protected void gvQuanLy_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "SUA")
                try
                {
                    int i = Convert.ToInt32(e.CommandArgument);
                    string cmd = string.Format("EXEC dbo.GetFeedbackList 1, 0, {0}, 0, 0", gvQuanLy.Rows[i].Cells[1].Text);
                    zClass ob = new zClass();
                    DataSet ds = ob.zSelect(cmd);
                    lbID.Text = ds.Tables[0].Rows[0]["ListID"].ToString();
                    tbTenNhom.Text = ds.Tables[0].Rows[0]["Name"].ToString();
                    lbError_SuaNhom.Text = "";
                    pnBack.CssClass = "pnBack";
                    pnSuaNhom.CssClass = "pnShow";
                }
                catch { }
            if (e.CommandName == "XOA")
                try
                {
                    int i = Convert.ToInt32(e.CommandArgument);
                    string cmd = string.Format("EXEC ChungNT.Feedback_Category_Update {0}, {1}", gvQuanLy.Rows[i].Cells[1].Text, gvQuanLy.Rows[i].Cells[2].Text);
                    zClass ob = new zClass();
                    ob.zExecute(cmd);

                    Load_Data();
                    lbError.Text = "Xóa quyền quản lý nhóm thành công";
                }
                catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình xử lý. " + ex.Message; }
        }
 protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
 {
     string name = ((TextBox)GridView1.FooterRow.FindControl("TextBox2")).Text;
     string st = string.Format("INSERT INTO FeedbackList (PortalID, Name) VALUES (1, N'{0}')", name);
     zClass ob = new zClass();
     ob.zExecute(st);
     GridView1.EditIndex = -1;
     GridView1.DataSource = zGetData();
     GridView1.DataBind();
 }
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     string name = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox1")).Text;
     string id = GridView1.Rows[e.RowIndex].Cells[0].Text;
     string st = string.Format("UPDATE FeedbackList SET Name=N'{0}' WHERE ListID={1}", name, id);
     zClass ob = new zClass();
     ob.zExecute(st);
     GridView1.EditIndex = -1;
     GridView1.DataSource = zGetData();
     GridView1.DataBind();
 }
 private DataTable zGetData()
 {
     string st = "SELECT ListID, Name FROM FeedbackList";
     zClass ob = new zClass();
     DataSet ds = ob.zSelect(st);
     if (ds.Tables[0].Rows.Count == 0)
     {
         string ins = "INSERT INTO FeedbackList (PortalID, Name) VALUES (1, 'Default')";
         ob.zExecute(ins);
     }
     ds = ob.zSelect(st);
     return ds.Tables[0];
 }
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DEL")
     {
         string st = "UPDATE Feedback SET Status=-1 WHERE FeedbackID=" + GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[1].Text;
         zClass ob = new zClass();
         ob.zExecute(st);
         string catID = "0";
         if (Settings["feedCategory"] != null) catID = Settings["feedCategory"].ToString();
         zBindData(catID, "0");
         btTraLoi.Visible = false;
         btGuiDi.Visible = true;
     }
     else if (btTraLoi.Visible == false)
     {
         zBindData("0", GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[1].Text);
         btTraLoi.Visible = true;
         btGuiDi.Visible = false;
         if (UserInfo.IsInRole("admin") || UserInfo.IsInRole("Administrators")) btTraLoi.Enabled = true;
         else btTraLoi.Enabled = false;
     }
 }
        // Sửa nhóm
        protected void btCapNhat_Click(object sender, EventArgs e)
        {
            if (tbTenNhom.Text.Trim().Length == 0)
            {
                lbError_SuaNhom.Text = "Chưa nhập tên nhóm";
                return;
            }
            try
            {
                string cmd;
                if (lbID.Text == "0")
                    cmd = string.Format("EXEC dbo.AddFeedbackList 0, 1, N'{0}', '', 1", tbTenNhom.Text);
                else
                    cmd = string.Format("EXEC dbo.EditFeedbackList 0, {0}, 0, 1, N'{1}', '', 1", lbID.Text, tbTenNhom.Text);
                zClass ob = new zClass();
                ob.zExecute(cmd);

                Load_Data();
                btDong_Click(sender, e);
                lbError.Text = "Cập nhật nhóm thành công";
            }
            catch (Exception ex) { lbError_SuaNhom.Text = "Có lỗi trong quá trình xử lý. " + ex.Message; }
        }
        // Thêm quyền
        protected void btThem_Click(object sender, EventArgs e)
        {
            if (dlUsers.SelectedIndex == 0)
            {
                lbError_ThemQuyen.Text = "Chưa chọn người quản lý";
                return;
            }
            try
            {
                string cmd = string.Format("EXEC ChungNT.Feedback_Category_Update {0}, {1}", dlNhom.SelectedValue, dlUsers.SelectedValue);
                zClass ob = new zClass();
                ob.zExecute(cmd);

                Load_Data();
                btDong_Click(sender, e);
                lbError.Text = "Thêm quyền quản lý nhóm thành công";
            }
            catch (Exception ex) { lbError_ThemQuyen.Text = "Có lỗi trong quá trình xử lý. " + ex.Message; }
        }
 protected void btGuiDi_Click(object sender, EventArgs e)
 {
     string catID = "0";
     if (Settings["feedCategory"] != null) catID = Settings["feedCategory"].ToString();
     string st = string.Format("INSERT INTO Feedback (ModuleID, Status, CreatedByEmail, Message, DateCreated, CategoryID, CreatedByName) VALUES (1, 0, '{0}', N'{1}', GETDATE(), '{2}', N'{3}')", tbEmail.Text, tbCauHoi.Text, catID, tbTen.Text);
     zClass ob = new zClass();
     ob.zExecute(st);
     zBindData(catID, "0");
     btNhapLai_Click(sender, e);
 }