Ejemplo n.º 1
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            CBBItem cbi       = cboDanhMuc.SelectedItem as CBBItem;
            int     idDanhMuc = cbi.Value;

            Show(idDanhMuc, "");
        }
        private void SetDetail(Staff staff, Account account)
        {
            txtIDStaff.Text = staff.ID_Staff.ToString();
            txtName.Text    = staff.Name_Staff;
            dateBirth.Value = staff.DateOfBirth;
            txtAddress.Text = staff.Address;
            if (staff.Gender == true)
            {
                rbtnMale.Checked = true;
            }
            else
            {
                rbtnFemale.Checked = true;
            }
            txtMail.Text = staff.Mail;
            txtSDT.Text  = staff.SDT;
            CBBItem item = new CBBItem();

            foreach (CBBItem i in cbbRole.Items)
            {
                if (i.Value == account.ID_Position)
                {
                    item = i;
                }
            }
            txtMail.Text          = staff.Mail;
            txtSDT.Text           = staff.SDT;
            txtIDUser.Text        = staff.ID_User.ToString();
            cbbRole.SelectedIndex = cbbRole.Items.IndexOf(item);
            txtUserName.Text      = account.UserName;
            txtPass.Text          = account.Password;
        }
Ejemplo n.º 3
0
        private void btnTim_Click(object sender, EventArgs e)
        {
            CBBItem cbi       = cboDanhMuc.SelectedItem as CBBItem;
            int     idDanhMuc = cbi.Value;
            string  st        = txtSearch.Text;

            Show(idDanhMuc, st);
        }
Ejemplo n.º 4
0
 private void btnTim_Click(object sender, EventArgs e)
 {
     txtSearch.ForeColor = Color.Black;
     if (txtSearch.Text != "Tên món (không dấu), giá")
     {
         CBBItem cbi       = cboDanhMuc.SelectedItem as CBBItem;
         int     idDanhMuc = cbi.Value;
         string  st        = txtSearch.Text;
         Show(idDanhMuc, st);
     }
 }
Ejemplo n.º 5
0
 private void getCBBItem()
 {
     Hang[] listHang = bll.getAllHangs();
     foreach (Hang h in listHang)
     {
         CBBItem i = new CBBItem
         {
             Text  = h.Name_hang,
             Value = h.ID_hang
         };
         comboBox1.Items.Add(i);
     }
 }
Ejemplo n.º 6
0
        public CBBItem getItemById(String id)
        {
            CBBItem cbb_item = null;

            foreach (CBBItem i in comboBox1.Items)
            {
                if (i.Value == id)
                {
                    cbb_item = i;
                }
            }
            return(cbb_item);
        }
Ejemplo n.º 7
0
        private string GetSortByFromCBB()
        {
            CBBItem item = ((CBBItem)this.cbbSort.SelectedItem);

            if (item == null)
            {
                return("None");
            }
            else
            {
                return(((CBBItem)this.cbbSort.SelectedItem).value);
            }
        }
Ejemplo n.º 8
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.id == null)
     {
         if (!checkEmpty())
         {
             MessageBox.Show("Không được để trống !");
         }
         else
         {
             CBBItem i  = (CBBItem)comboBox1.SelectedItem;
             DT      ex = new DT
             {
                 MDT        = textBox1.Text,
                 Name_DT    = textBox2.Text,
                 Soluong_DT = Int16.Parse(textBox3.Text),
                 Gia_DT     = Int32.Parse(textBox4.Text),
                 Date_DT    = DateTime.Parse(dateTimePicker1.Value.ToString()),
                 ID_Hang    = i.Value,
                 Gender_DT  = bool.Parse("true")
             };
             bll.addDienthoai(ex);
             this.myDelegate(null);
             this.Close();
         }
     }
     else
     {
         if (!checkEmpty())
         {
             MessageBox.Show("Không được để trống !");
         }
         else
         {
             CBBItem i  = (CBBItem)comboBox1.SelectedItem;
             DT      ex = new DT
             {
                 MDT        = textBox1.Text,
                 Name_DT    = textBox2.Text,
                 Soluong_DT = Int16.Parse(textBox3.Text),
                 Gia_DT     = Int32.Parse(textBox4.Text),
                 Date_DT    = DateTime.Parse(dateTimePicker1.Value.ToString()),
                 ID_Hang    = i.Value,
                 Gender_DT  = radioButton1.Checked ? true : false
             };
             bll.updateDTBBL(ex);
             this.myDelegate(null);
             this.Close();
         }
     }
 }
Ejemplo n.º 9
0
        private void btnSort_Click(object sender, EventArgs e)
        {
            if (cboSortType.SelectedIndex == -1)
            {
                MessageBox.Show("Chọn kiểu sắp xếp!");
                return;
            }
            string  name   = txtSearch.Text;
            CBBItem cbLop  = cboDanhMuc.SelectedItem as CBBItem;
            int     IDLop  = cbLop.Value;
            CBBItem cbSort = cboSortType.SelectedItem as CBBItem;
            int     idSort = cbSort.Value;

            dgvDanhSachMon.DataSource = BusinessLogicLayer.Instance.Sort(idSort, IDLop, name);
        }
        public void ResetGUI()
        {
            txtIDStaff.Text    = "";
            txtName.Text       = "";
            dateBirth.Value    = DateTime.Now;
            txtAddress.Text    = "";
            rbtnMale.Checked   = false;
            rbtnFemale.Checked = false;
            txtMail.Text       = "";
            txtSDT.Text        = "";
            CBBItem item = new CBBItem();

            txtIDUser.Text        = "";
            cbbRole.SelectedIndex = -1;
            txtUserName.Text      = "";
            txtPass.Text          = "";
        }
Ejemplo n.º 11
0
        private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewSelectedRowCollection r = dataGridView1.SelectedRows;

            if (r.Count == 1)
            {
                txtbID_TaiLieu.ReadOnly = true;
                txtbID_TaiLieu.Text     = dataGridView1.SelectedRows[0].Cells["ID_TaiLieu"].Value.ToString();
                txtNameTL.Text          = dataGridView1.SelectedRows[0].Cells["Name_TaiLieu"].Value.ToString();
                txtTacGia.Text          = dataGridView1.SelectedRows[0].Cells["TacGia"].Value.ToString();
                txtNhaXB.Text           = dataGridView1.SelectedRows[0].Cells["NXB"].Value.ToString();
                string idtheloai = dataGridView1.SelectedRows[0].Cells["ID_TheLoai"].Value.ToString();
                txtSoLuong.Text  = dataGridView1.SelectedRows[0].Cells["SoLuong"].Value.ToString();
                txtNamXB.Text    = dataGridView1.SelectedRows[0].Cells["NamXB"].Value.ToString();
                txtGiaThanh.Text = dataGridView1.SelectedRows[0].Cells["GiaThanh"].Value.ToString();
                string idvitri = dataGridView1.SelectedRows[0].Cells["ID_ViTri"].Value.ToString();

                CBBItem theloai = new CBBItem();
                foreach (CBBItem i in cbbTheLoai.Items)
                {
                    if (i.Value == idtheloai)
                    {
                        theloai = i;
                    }
                }
                cbbTheLoai.SelectedIndex = cbbTheLoai.Items.IndexOf(theloai);

                CBBItem vitri = new CBBItem();
                foreach (CBBItem j in cbbVitri.Items)
                {
                    if (j.Value == idvitri)
                    {
                        vitri = j;
                    }
                }
                cbbVitri.SelectedIndex = cbbVitri.Items.IndexOf(vitri);
            }
        }
Ejemplo n.º 12
0
 public void showData(CBBItem item)
 {
     dataGridView1.DataSource = bll.getAllDienthoaiBLL();
 }