Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            String type = textBox1.Text;

            if (type.Trim() == "")
            {
                MessageBox.Show("Không được để trống");
            }
            if (Types.Exists(x => x.Name == type.ToUpper()))
            {
                MessageBox.Show("Đã tồn tại");
            }
            else
            {
                Account_Type at = new Account_Type();
                at.Name = type.ToUpper();
                if (!Account_TypeController.getController().Save(at))
                {
                    MessageBox.Show("Lỗi ");
                }
                else
                {
                    UpdateData();
                }
            }
        }
Ejemplo n.º 2
0
        public Edit(Account account)
        {
            InitializeComponent();
            this.account         = account;
            cbType.FlatStyle     = FlatStyle.Flat;
            cbType.DataSource    = Account_TypeController.getController().getTypeTable();
            cbType.DisplayMember = "Name";
            cbType.ValueMember   = "ID";
            var info = Account_InfoController.getController().findOneWithType(account.Username);

            if (info != null)
            {
                account_Info     = info.Item1;
                account_Type     = info.Item2;
                tbFirstName.Text = account_Info.First_Name;
                tbLastName.Text  = account_Info.Last_Name;
                tbPhone.Text     = account_Info.Phone;
                rtbAddress.Text  = account_Info.Address;
                rtbNote.Text     = account_Info.Note;
                dtpBd.Value      = account_Info.Birthday;
            }
            else
            {
                tbFirstName.Text = "";
                tbLastName.Text  = "";
                tbPhone.Text     = "";
                rtbAddress.Text  = "";
                rtbNote.Text     = "";
            }
            tbDisplay.Text       = account.Display_Name;
            cbType.SelectedValue = account.Type;
        }
Ejemplo n.º 3
0
 public AddNew()
 {
     InitializeComponent();
     cbType.FlatStyle     = FlatStyle.Flat;
     cbType.DataSource    = Account_TypeController.getController().getTypeTable();
     cbType.DisplayMember = "Name";
     cbType.ValueMember   = "ID";
 }
Ejemplo n.º 4
0
        void UpdateData()
        {
            DataTable dataTable = Account_TypeController.getController().getTypeTable();

            listBox1.DataSource    = dataTable;
            listBox1.DisplayMember = "Name";
            listBox1.ValueMember   = "Name";
            Types.Clear();
            Types         = HelperUtils.DataTableToList <Account_Type>(dataTable);
            textBox1.Text = "";
        }