コード例 #1
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            string username = txt_UserName.Text;

            if (BUS_Account.Instance.CheckExistUserName(username))
            {
                new FormMessageBox("Tên đăng nhập đã tồn tại, vui lòng thử tên khác").ShowDialog();
            }
            else
            {
                // String phone = txtPhone.Text;
                //String name = txt_Name.Text;
                int IDEmployee = (int)(cbbNameE.SelectedItem as CbbItem).Key;
                int Id_Type    = (cbb_TypeAccount.SelectedItem as CBBItem).Value;

                if (BUS_Account.Instance.AddAccount(IDEmployee, username, Id_Type))
                {
                    FormMessageBox form = new FormMessageBox("Thêm thành công!");
                    form.ShowDialog();
                }
                else
                {
                    FormMessageBox form = new FormMessageBox("Thêm thất bại! Vui lòng kiểm tra lại dữ liệu");
                    form.ShowDialog();
                }
                this.Dispose();
            }
        }
コード例 #2
0
        private void SetCBB()
        {
            if (cbb_TypeAccount.Items != null)
            {
                cbb_TypeAccount.Items.Clear();
            }

            List <dynamic> list_TypeAccount = BUS_Account.Instance.GetTypeAccount_DAL().ToList();

            if (list_TypeAccount != null)
            {
                for (int i = 0; i < list_TypeAccount.Count; i++)
                {
                    cbb_TypeAccount.Items.Add(new CBBItem
                    {
                        Value = list_TypeAccount[i].Id,
                        Text  = list_TypeAccount[i].Name
                    });
                }
                cbb_TypeAccount.SelectedIndex = 0;
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Lỗi! Tải dữ liệu quyền truy cập thất bại!");
                form.ShowDialog();
            }
        }