Ejemplo n.º 1
0
        //Refresh datagridview in function tab
        private void refreshDataViewFunction()
        {
            try
            {
                // Get function's datatable
                DataTable functionTable = RoleFunction.GetListFunction();

                // Add Vietnamese column's name
                functionTable.Columns.Add("Mã chức năng", typeof(string), "[FUNCTIONID]");
                functionTable.Columns.Add("Tên chức năng", typeof(string), "[FUNCTIONNAME]");
                functionTable.Columns.Add("Nút kích hoạt", typeof(string), "[BUTTON]");
                // Set data source to dataview for searching
                dataViewFunction.DataSource = functionTable.DefaultView;

                // Hide English columns'name
                for (int i = 0; i < 3; i++)
                {
                    dataViewFunction.Columns[i].Visible = false;
                }

                //Add auto complete datasource to textbox
                textBoxFunctionSearch.AutoCompleteCustomSource.Clear();
                for (int i = 0; i < functionTable.Rows.Count; i++)
                {
                    String strFunctionName = functionTable.Rows[i][1].ToString();
                    textBoxFunctionSearch.AutoCompleteCustomSource.Add(strFunctionName);
                }
            }
            catch
            {
                MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        public FormRoleDetail()
        {
            InitializeComponent();
            DataTable dtSystemFunction = RoleFunction.GetListFunction();

            for (int i = 0; i < dtSystemFunction.Rows.Count; i++)
            {
                RoleFunction tempRF = new RoleFunction(int.Parse(dtSystemFunction.Rows[i][0].ToString()), dtSystemFunction.Rows[i][1].ToString(), dtSystemFunction.Rows[i][2].ToString());
                listBoxSystemFunction.Items.Add(tempRF.FucntionName);
                listBoxSystemFunctionID.Items.Add(tempRF.FunctionID);
            }
        }
Ejemplo n.º 3
0
        public void SetRoleDetail(Role roledetail)
        {
            this.roleDetail = roledetail;

            textBoxRoleID.Text   = roleDetail.RoleID.ToString();
            textBoxRoleName.Text = roleDetail.RoleName;

            DataTable dtCurrentFunction = RoleDetail.GetListStaffFunction(roledetail.RoleID);

            for (int i = 0; i < dtCurrentFunction.Rows.Count; i++)
            {
                RoleFunction tempRF = new RoleFunction(int.Parse(dtCurrentFunction.Rows[i][0].ToString()), dtCurrentFunction.Rows[i][1].ToString(), "");
                listBoxCurrentFunction.Items.Add(tempRF.FucntionName);
                listBoxCurrentFunctionID.Items.Add(tempRF.FunctionID);
            }
            DataTable dtSystemFunction = RoleFunction.GetListFunction();

            for (int i = 0; i < dtSystemFunction.Rows.Count; i++)
            {
                RoleFunction tempRF = new RoleFunction(int.Parse(dtSystemFunction.Rows[i][0].ToString()), dtSystemFunction.Rows[i][1].ToString(), dtSystemFunction.Rows[i][2].ToString());
                listBoxSystemFunction.Items.Add(tempRF.FucntionName);
                listBoxSystemFunctionID.Items.Add(tempRF.FunctionID);
            }
            ListBox lstTemp = new ListBox();

            for (int i = 0; i < listBoxCurrentFunctionID.Items.Count; i++)
            {
                for (int j = 0; j < listBoxSystemFunctionID.Items.Count; j++)
                {
                    if (listBoxCurrentFunctionID.Items[i].ToString() == listBoxSystemFunctionID.Items[j].ToString())
                    {
                        listBoxSystemFunctionID.Items.RemoveAt(j);
                        listBoxSystemFunction.Items.RemoveAt(j);
                        break;
                    }
                }
            }
        }