コード例 #1
0
ファイル: User.aspx.cs プロジェクト: sonnnqbh/demo_proj
    protected void GvUser_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int         index = Convert.ToInt32(e.CommandArgument);
        GridViewRow gvrow = GvUser.Rows[index];

        if (e.CommandName.Equals("editRecord"))
        {
            hfPopupUpdate.Value = GvUser.DataKeys[index].Value.ToString();
            DataTable dt = new DataTable();
            dt = Users.GetUserID(int.Parse(hfPopupUpdate.Value)).Tables[0];
            DataTable dtNhomquyen = Roles_User.GetComboxGroup(int.Parse(hfPopupUpdate.Value)).Tables[0];
            txtTendangnhap.Text          = dt.Rows[0]["TenDangNhap"].ToString();
            txtMatKhau.Text              = dt.Rows[0]["MatKhau"].ToString();
            cboNhomquyen.SelectedIndex   = cboNhomquyen.Items.IndexOf(cboNhomquyen.Items.FindByValue(dtNhomquyen.Rows[0]["NhomID"].ToString()));
            cboDoanhNghiep.SelectedIndex = cboDoanhNghiep.Items.IndexOf(cboDoanhNghiep.Items.FindByValue(dt.Rows[0]["DoanhNghiepID"].ToString()));
            mpeUpdate.Show();
        }
        else if (e.CommandName.Equals("deleteRecord"))
        {
            hfPopupDelete.Value = GvUser.DataKeys[index].Value.ToString();

            lbxacnhanxoa.Text = "Đồng ý xóa <b>" + HttpUtility.HtmlDecode(gvrow.Cells[1].Text).ToString() + "</b>";

            mpeDelete.Show();
        }
    }
コード例 #2
0
    protected void GvUser_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int ID = Convert.ToInt32(e.CommandArgument.ToString());

        if (e.CommandName.Equals("editRecord"))
        {
            hfPopupUpdate.Value = ID.ToString();
            DataTable dt = new DataTable();
            dt = Users.GetUserID(int.Parse(hfPopupUpdate.Value)).Tables[0];
            DataTable dtNhomquyen = Roles_User.GetComboxGroup(int.Parse(hfPopupUpdate.Value)).Tables[0];
            txtTendangnhap.Text          = dt.Rows[0]["TenDangNhap"].ToString();
            txtMatKhau.Text              = dt.Rows[0]["MatKhau"].ToString();
            cboNhomquyen.SelectedIndex   = cboNhomquyen.Items.IndexOf(cboNhomquyen.Items.FindByValue(dtNhomquyen.Rows[0]["NhomID"].ToString()));
            cboDoanhNghiep.SelectedIndex = cboDoanhNghiep.Items.IndexOf(cboDoanhNghiep.Items.FindByValue(dt.Rows[0]["DoanhNghiepID"].ToString()));
            mpeUpdate.Show();
        }
        else if (e.CommandName.Equals("deleteRecord"))
        {
            hfPopupDelete.Value = ID.ToString();

            lbxacnhanxoa.Text = "Đồng ý xóa bản ghi?";

            mpeDelete.Show();
        }
        else if (e.CommandName.Equals("PhanQuyenRecord"))
        {
            hfPopupRole.Value = ID.ToString();
            nguoidungid       = ID.ToString();
            doanhnghiepid     = AppSessionInfo.CurrentUser.DoanhNghiepID.ToString();
            DataTable dt = new DataTable();
            dt = Users.GetUserID(int.Parse(hfPopupRole.Value)).Tables[0];
            lblXacNhanQuyen.Text = "Cấp quyền nhắn tin cho TK: <b>" + dt.Rows[0]["TenDangNhap"].ToString() + "</b>";
            mpeRole.Show();
        }
    }
コード例 #3
0
ファイル: UserGroup.aspx.cs プロジェクト: sonnnqbh/demo_proj
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (hfPopupUpdate.Value == "0")
     {
         if (Roles_User.InsertUserGroup(txtTenQuyen.Text, txtGhiChu.Text, cbxNhomQL.Checked) != "0")
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Thành công!','success','Thêm mới thành công!!');", true);
             LoadUserGroup(0);
             clearText();
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Cảnh báo!','warning','Lỗi khi thêm mới. vui lòng kiểm tra lại dữ liệu..!!');", true);
         }
     }
     else
     {
         if (Roles_User.UpdateUserGroup(int.Parse(hfPopupUpdate.Value), txtTenQuyen.Text, txtGhiChu.Text, cbxNhomQL.Checked) != "0")
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Thành công!','success','Cập nhật nhóm thành công!!');", true);
             LoadUserGroup(0);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Cảnh báo!','warning','Có lỗi khi cập nhật!');", true);
         }
     }
 }
コード例 #4
0
 public static string SendMessage(string idQuyens)
 {
     RoleDelete();
     try
     {
         string[] quyen = idQuyens.Split(',');
         for (int i = 0; i < quyen.Length; i++)
         {
             if (quyen[i] != "root")
             {
                 Roles_User.InsertGroupRole(int.Parse(nhomquyenid), int.Parse(quyen[i]));
                 int parentid = GetParentIdByQuyenId(int.Parse(quyen[i]));
                 if (parentid != 1)
                 {
                     if (!CheckExistParentNode(int.Parse(nhomquyenid), parentid))
                     {
                         Roles_User.InsertGroupRole(int.Parse(nhomquyenid), parentid);
                     }
                 }
             }
         }
         return("Cập nhật quyền thành công!!");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
    private void BindComBox()
    {
        DataSet ds = Roles_User.GetGroupRoles();

        cboNhomquyen.DataSource     = ds;
        cboNhomquyen.DataValueField = "NhomID";
        cboNhomquyen.DataTextField  = "TenNhom";
        cboNhomquyen.DataBind();
        cboNhomquyen.Items.Insert(0, new ListItem("-- Chọn nhom quyen --", ""));
    }
コード例 #6
0
    private static void RoleDelete()
    {
        List <NguoiDung_NhomKH> lsnd_nkh = objbn.GetNhomKHByNguoiDungID(int.Parse(nguoidungid.ToString()));

        if (lsnd_nkh.Count > 0)
        {
            for (int i = 0; i < lsnd_nkh.Count; i++)
            {
                Roles_User.NhomKHDelete(int.Parse(nguoidungid.ToString()), lsnd_nkh[i].IdNhomKH);
            }
        }
    }
コード例 #7
0
    private static void RoleDelete()
    {
        DataSet dsRolechidl1 = Roles_User.GetRoleChidl1(int.Parse(nhomquyenid));

        if (dsRolechidl1.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dsRolechidl1.Tables[0].Rows.Count; i++)
            {
                Roles_User.RoleDelete(int.Parse(dsRolechidl1.Tables[0].Rows[i]["QuyenID"].ToString()), int.Parse(nhomquyenid));
            }
        }
    }
コード例 #8
0
ファイル: UserGroup.aspx.cs プロジェクト: sonnnqbh/demo_proj
 private void ShowData(int index)
 {
     if (index > -1)
     {
         int       id = Convert.ToInt32(GvgroupUser.DataKeys[index].Value);
         DataTable dt = new DataTable();
         dt = Roles_User.GetGroup(id).Tables[0];
         txtTenQuyen.Text  = dt.Rows[0]["TenNhom"].ToString();
         txtGhiChu.Text    = dt.Rows[0]["MoTa"].ToString();
         cbxNhomQL.Checked = bool.Parse(dt.Rows[0]["IsGroupAdmin"].ToString());
     }
     else
     {
         txtTenQuyen.Text = "";
         txtGhiChu.Text   = "";
     }
 }
コード例 #9
0
ファイル: UserGroup.aspx.cs プロジェクト: sonnnqbh/demo_proj
    protected void LoadUserGroup(int index)
    {
        DataSet ds = new DataSet();

        ds = Roles_User.GetUserGroup();
        GvgroupUser.DataSource = ds.Tables[0];;
        GvgroupUser.DataBind();
        //if (ds.Tables[0].Rows.Count > 0)
        //{
        //    GvgroupUser.SelectedIndex = index;
        //    ShowData(index);
        //}
        //else
        //{
        //    ShowData(-1);
        //}
    }
コード例 #10
0
ファイル: ChangePass.aspx.cs プロジェクト: sonnnqbh/demo_proj
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (!Roles_User.CheckOldPass(int.Parse(AppSessionInfo.CurrentUser.NguoiDungID.ToString()), txtOldPass.Text))
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Cảnh báo!','warning','Mật khẩu cũ không đúng!');", true);
     }
     else
     {
         if (Roles_User.UpdatePass(int.Parse(AppSessionInfo.CurrentUser.NguoiDungID.ToString()), txtNewPass.Text) == "1")
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Thành công!','success','Cập nhật thành công!');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Cảnh báo!','warning','Có lỗi khi cập nhật!');", true);
         }
     }
 }
コード例 #11
0
ファイル: UserGroup.aspx.cs プロジェクト: sonnnqbh/demo_proj
 protected void btnXoadongy_Click(object sender, EventArgs e)
 {
     if (Roles_User.CheckExistUserInGroup(int.Parse(hfPopupDelete.Value)) || Roles_User.CheckExistRoleInGroup(int.Parse(hfPopupDelete.Value)))
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Cảnh báo!','warning','Còn tồn tại người dùng hoặc quyền thuộc nhóm!');", true);
     }
     else
     {
         if (Roles_User.DeleteUserGroup(int.Parse(hfPopupDelete.Value)) != "0")
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Thành công!','success','Xóa nhóm thành công!!');", true);
             LoadUserGroup(0);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "alertMessage('Cảnh báo!','warning','Có lỗi khi xóa!');", true);
         }
     }
 }
コード例 #12
0
 public static string PhanQuyenNT(string idnhoms)
 {
     RoleDelete();
     if (idnhoms == "")
     {
         return("Chọn nhóm để phân quyền nhắn tin!");
     }
     else
     {
         string[] idnhom = idnhoms.Split(',');
         for (int i = 0; i < idnhom.Length; i++)
         {
             if (idnhom[i] != "root")
             {
                 Roles_User.InsertNguoiDungNhomKH(int.Parse(nguoidungid.ToString()), int.Parse(idnhom[i]));
             }
         }
         return("Phân nhóm nhắn tin thành công!");
     }
 }
コード例 #13
0
ファイル: User.aspx.cs プロジェクト: sonnnqbh/demo_proj
 protected DataTable LoadUserGroup()
 {
     return(Roles_User.GetUserGroup().Tables[0]);
 }