示例#1
0
    private void getUserInfo()
    {
        UserLoginBUS ulBus = new UserLoginBUS();
        DepartmentBUS dBus = new DepartmentBUS();
        RoleDetailBUS rdBus = new RoleDetailBUS();

        int userId = int.Parse(Request.QueryString["uid"].ToString());
        DataTable tblUserDetail = Common.GetUserLoginDetail(userId);

        DataTable tblSendRegisterDetailByUser = Common.GetSendRegisterByUserId(userId);
        DataTable tblCustomerCreated = Common.GetCustomerCreatedByUserId(userId);

        if (tblUserDetail.Rows.Count > 0)
        {
            int departId = int.Parse(tblUserDetail.Rows[0]["DepartmentId"].ToString());
            DataTable tblRoleDetail = rdBus.GetByDepartmentId(departId);

            lblUsername.Text = tblUserDetail.Rows[0]["Username"].ToString();
            lblDepartment.Text = tblUserDetail.Rows[0]["Name"].ToString();

            if(tblRoleDetail.Rows.Count>0){
                lblHasSend.Text =
                    tblSendRegisterDetailByUser.Rows.Count + " / " + tblRoleDetail.Rows[0]["limitSendMail"].ToString();
                lblHasCustomerCreate.Text =
                    tblCustomerCreated.Rows.Count + " / " + tblRoleDetail.Rows[0]["limitCreateCustomer"].ToString();
                lblToDate.Text = tblRoleDetail.Rows[0]["toDate"].ToString();
            }

        }
    }
示例#2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (CheckNull())
     {
         DepartmentBUS.Employee updateEmployee = new DepartmentBUS.Employee()
         {
             Address = textBox2.Text, Birthday = dateTimePicker1.Value, Department = employee.Department, Email = textBox3.Text, Gender = comboBox2.Text.ToString(), ID = employee.ID, Image = null, Name = employee.Name, Position = employee.Position
         };
         bool result = new DepartmentBUS().Update(new DepartmentBUS.FilePut(updateEmployee, DataStatic.user, DataStatic.token));
         if (result)
         {
             MessageBox.Show("Cập nhật thành công");
             profileClosing.CheckReset(true);
         }
         else
         {
             MessageBox.Show("Cập nhật thất bại");
         }
     }
 }
 private void InitBUS()
 {
     mcBUS = new MailConfigBUS();
     dpBUS = new DepartmentBUS();
     if (getUserLogin().DepartmentId == 1)
     {
         drlDepartmen.Items.Clear();
         drlDepartmen.DataSource = dpBUS.GetAll();
         drlDepartmen.DataTextField = "Name";
         drlDepartmen.DataValueField = "ID";
         drlDepartmen.DataBind();
         dlMailConfig.DataSource = mcBUS.GetAll();
         dlMailConfig.DataBind();
     }
     else
     {
         this.btnSave.Enabled = false;
     }
 }
示例#4
0
    private void LoadData()
    {
        try
        {
            DataTable dtLogin = null;
            ulBus = new UserLoginBUS();
            //if (getUserLogin().DepartmentId == 1)
            //{
                dtLogin = ulBus.GetAll();
            //}
            //else
            //{
            //    dtLogin = ulBus.GetAllByUserId(getUserLogin().UserId);

            //}
            dlMember.DataSource = dtLogin;
            dlMember.DataBind();

            DataTable dtUserType = ulBus.GetByUserId(getUserLogin().UserId);
            int UserType = int.Parse(dtUserType.Rows[0]["UserType"].ToString());
            deBus = new DepartmentBUS();
            dropTypeUser.Items.Clear();

            dropTypeUser.DataSource = deBus.GetByUserType(UserType);
            dropTypeUser.DataTextField = "Name";
            dropTypeUser.DataValueField = "ID";
            dropTypeUser.DataBind();

            for (int i = 0; i < dtLogin.Rows.Count; i++)
            {
                Label lblNo = (Label)(Label)dlMember.Items[i].FindControl("No");
                lblNo.Text = (i + 1).ToString();
            }

        }
        catch (Exception ex)
        {

            logs.Error(userLogin.Username + "-Client - LoadData", ex);
        }
    }
示例#5
0
    protected void loadUserByDepartmentId(int departId)
    {
        ulBus = new UserLoginBUS();
        deBus = new DepartmentBUS();
        DataTable dtLogin = ulBus.GetByDepartmentId(departId);

        dlMember.DataSource = dtLogin;
        dlMember.DataBind();
        for (int i = 0; i < dtLogin.Rows.Count; i++)
        {
            DataRow row = dtLogin.Rows[i];

            Label lblUsername = (Label)dlMember.Items[i].FindControl("lblUsername");
            lblUsername.Text = row["Username"].ToString();

            Label lblDepartment = (Label)dlMember.Items[i].FindControl("lblDepartment");
            DataTable dtDepartment = deBus.GetByID(int.Parse(row["DepartmentId"].ToString()));
            if (dtDepartment.Rows.Count > 0)
            {
                lblDepartment.Text = dtDepartment.Rows[0]["Name"].ToString();

            }

            LinkButton lbtEdit = (LinkButton)dlMember.Items[i].FindControl("lbtEdit");
            lbtEdit.CommandArgument = row["UserId"].ToString();

            LinkButton lbtDelete = (LinkButton)dlMember.Items[i].FindControl("lbtDelete");
            lbtDelete.CommandArgument = row["UserId"].ToString();

            LinkButton lbtViewDetail = (LinkButton)dlMember.Items[i].FindControl("lbtViewDetail");
            lbtViewDetail.CommandArgument = row["UserId"].ToString();
            lbtViewDetail.PostBackUrl = "user-detail.aspx?uid=" + row["UserId"].ToString();
            if (row["Username"].Equals("administrator"))
            {
                lbtDelete.Visible = false;
                lbtEdit.Visible = false;
                lbtViewDetail.Visible = false;
            }

        }
    }
示例#6
0
    protected void drlDepartment_SelectedIndexChanged(object sender, EventArgs e)
    {
        deBus = new DepartmentBUS();
        try
        {
            //  int departId = int.Parse(drlDepartment.SelectedValue.ToString());

            //  loadUserByDepartmentId(departId);
        }
        catch (Exception)
        { }
    }
示例#7
0
 protected bool checkExistUsername(string username)
 {
     dpBUS = new DepartmentBUS();
     DataTable tblUser = dpBUS.GetByUsername(username);
     if (tblUser.Rows.Count > 0)
     {
         return true;
     }
     return false;
 }
示例#8
0
 private void InitBUS()
 {
     dpBUS = new DepartmentBUS();
     mcBUS = new MailConfigBUS();
 }
示例#9
0
 public Department()
 {
     InitializeComponent();
     departmentBUS = new DepartmentBUS();
 }
示例#10
0
    protected void loadBasicRole()
    {
        String departmentId = Request.QueryString["departmentId"];
        dmBus = new DepartmentBUS();
        rlBus = new RoleListBUS();
        rdBus = new RoleDetailBUS();
        DataTable tblDepartment = dmBus.GetByID(int.Parse(departmentId));
        if (tblDepartment.Rows.Count > 0)
        {
            string info = tblDepartment.Rows[0]["Name"].ToString();
            lblDepartmentName.Text = info;
        }

        //load role list
        DataTable dtRoleList = null;
        if (getUserLogin().DepartmentId == 1)
        {
            dtRoleList = rlBus.GetAll();
        }
        else
        {
            // load role list by role admin level 2.
            dtRoleList = rlBus.GetRoleByDepartmentId(getUserLogin().DepartmentId);
        }

        // Lấy danh sách quyền của phòng ban được chọn.
        DataTable dtRoleDetail = rdBus.GetByDepartmentId(int.Parse(departmentId));

        // Không hiển thị với phân quyền tạo phòng ban & tạo user với admin cấp 2
        DataTable dtNewRoleList = dtRoleList.Clone();
        foreach (DataRow row in dtRoleList.Rows)
        {
            // Không hiển thị chức năng cấp quyền tạo phòng ban & tạo user
            // Với user thuộc phòng ban tấp 2
            if (getUserLogin().DepartmentId != 1
                && (int.Parse(row["roleId"].ToString()) == 9
                || int.Parse(row["roleId"].ToString()) == 22))
            {
                continue;
            }
            else
            {

                dtNewRoleList.ImportRow(row);
            }
        }

        dlRoleList.DataSource = dtNewRoleList;
        dlRoleList.DataBind();
        for (int i = 0; i < dtNewRoleList.Rows.Count; i++)
        {
            DataRow row = dtNewRoleList.Rows[i];
            string roleId = row["roleId"].ToString();

            HiddenField hdfRoleId = (HiddenField)dlRoleList.Items[i].FindControl("hdfRoleId");
            hdfRoleId.Value = roleId;

            //selected role with department
            CheckBox chkCheck = (CheckBox)dlRoleList.Items[i].FindControl("chkCheck");
            for (int j = 0; j < dtRoleDetail.Rows.Count; j++)
            {
                int rId = int.Parse(dtRoleDetail.Rows[j]["roleId"].ToString());
                if (rId == int.Parse(roleId))
                {
                    chkCheck.Checked = true;
                    break;
                }
            }

            Label lblRoleName = (Label)dlRoleList.Items[i].FindControl("lblRoleName");
            lblRoleName.Text = row["roleName"] != null ? row["roleName"].ToString() : "";
            if (int.Parse(roleId) >= 100) // Là những tùy chọn chức năng chính.
            {
                lblRoleName.ForeColor = Color.Red;
            }

        }
        hdfDepartmentId.Value = departmentId;
    }