/// <summary>
        /// Khởi tạo dữ liệu
        /// </summary>
        private void InitData()
        {
            BGroup ctl = new BGroup();
            OGroup obj = new OGroup();

            try
            {
                //-- kiểm tra và lấy về nhóm người dùng cần sửa
                if (GroupId > 0)
                {
                    obj = ctl.Get(GroupId)[0];
                }
                else
                {
                    return;
                }
                txtDescription.Text = obj.Description;
                txtName.Text        = obj.Name;
                txtName.Visible     = false;
                lblName.Text        = obj.Name;
                lblName.Visible     = true;
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Khởi tạo dữ liệu
        /// </summary>
        private void InitData()
        {
            BUser ctlUP = new BUser();

            if (!Global.IsAdmin())
            {
                Response.Redirect("/permission-fail.aspx");
            }
            BGroup ctl = new BGroup();
            OGroup obj = new OGroup();

            try
            {
                //-- kiểm tra và lấy về nhóm người dùng cần sửa
                if (GroupId > 0)
                {
                    obj = ctl.Get(GroupId)[0];
                }
                else
                {
                    return;
                }
                txtDescription.Text = obj.Description;
                txtName.Text        = obj.Name;
                txtName.Visible     = true;
                lblName.Text        = obj.Name;
                lblName.Visible     = false;
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 3
0
        public bool Add(OGroup obj)
        {
            SqlParameter[] sqlPara = new SqlParameter[2];
            sqlPara[0]       = new SqlParameter("@Name", SqlDbType.NVarChar);
            sqlPara[0].Value = obj.Name;
            sqlPara[1]       = new SqlParameter("@Description", SqlDbType.NVarChar);
            sqlPara[1].Value = obj.Description;


            return(RunProcudure("sp_tblGroup_add", sqlPara));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Bind danh sách người dùng theo nhóm
        /// </summary>
        private void BindData()
        {
            BUser ctlUP = new BUser();

            if (!Global.IsAdmin())
            {
                Response.Redirect("/permission-fail.aspx");
            }
            BGroup ctl = new BGroup();
            OGroup obj = new OGroup();

            grvListUserGroups.DataSource = ctl.Get("", "Desc", "GroupId");
            grvListUserGroups.DataBind();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Cập nhật thông tin nhóm người dùng
        /// </summary>
        private void UpdateGroup()
        {
            if (!IsNameValid())
            {
                return;
            }
            BGroup ctl = new BGroup();
            OGroup obj;

            try
            {
                if (GroupId > 0)
                {
                    obj = ctl.Get(GroupId)[0];
                }
                else
                {
                    obj = new OGroup();
                }
            }catch (Exception ex)
            {
                obj = new OGroup();
            }
            //-- gán thông tin cho đối tượng nhóm người dùng
            obj.Description = txtDescription.Text;
            obj.Name        = txtName.Text;
            //-- Cập nhật User
            if (obj.GroupID > 0)
            {
                ctl.Update(obj.GroupID, obj.Name, obj.Description);
            }
            //--Thêm mới User
            else
            {
                obj.Name = txtName.Text;
                ctl.Add(obj);
            }
            //--Về trang quản lý nhóm người dùng
            Response.Redirect("Group.aspx");
        }