コード例 #1
0
        public void load_data()
        {
            thBus = new ThuocBUS();
            List <ThuocDTO> listThuoc = thBus.select();

            this.loadData_Vao_GridView(listThuoc);
        }
コード例 #2
0
ファイル: Ketoa.xaml.cs プロジェクト: krypton99/QLPM-test
        public void load_data()
        {
            db1.Clear();
            db1.Columns.Add("soLuong", typeof(System.Int32));
            db1.Columns.Add("maThuoc", typeof(string));
            db1.Columns.Add("tenThuoc", typeof(string));
            db1.Columns.Add("DVT", typeof(string));
            db1.Columns.Add("Dongia", typeof(float));
            db1.Columns.Add("CachDung", typeof(string));
            ThuocBUS        thBus     = new ThuocBUS();
            List <ThuocDTO> listThuoc = thBus.select();

            this.loadData_Vao_Combobox(listThuoc);
            ttBus      = new ToathuocBUS();
            matoa.Text = ttBus.autogenerate_matoa().ToString();
        }
コード例 #3
0
        private void BtnTim_Click(object sender, RoutedEventArgs e)
        {
            thBus = new ThuocBUS();
            string sKeyword = mathuoc.Text;

            if (sKeyword == null || sKeyword == string.Empty || sKeyword.Length == 0) // tìm tất cả
            {
                List <ThuocDTO> listThuoc = thBus.select();
                this.loadData_Vao_GridView(listThuoc);
            }
            else
            {
                List <ThuocDTO> listThuoc = thBus.selectByKeyWord(sKeyword);
                this.loadData_Vao_GridView(listThuoc);
            }
        }
コード例 #4
0
ファイル: Ketoa.xaml.cs プロジェクト: krypton99/QLPM-test
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            bool kt;

            try
            {
                int.Parse(soluong.Text);
                kt = true;
            }
            catch (Exception)
            {
                if (thuoc.Text == "")
                {
                    MessageBox.Show("Vui lòng chọn thuốc", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                    kt = false;
                }
                else
                {
                    MessageBox.Show("Vui lòng nhập số và không được để trống", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                    kt = false;
                }
            }

            if (kt == false)
            {
                soluong.Text = "";
                soluong.Focus();
            }
            else
            {
                if (thuoc.Text == "")
                {
                    MessageBox.Show("Vui lòng chọn thuốc", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    bool      notExist = true;
                    DataRow[] rows     = db1.Select();
                    if (rows.Length == 0)
                    {
                        thBus = new ThuocBUS();
                        List <ThuocDTO> listThuoc = thBus.select();
                        this.loadData_Vao_GridView(listThuoc, soluong.Text);
                        grid.ItemsSource = db1.DefaultView;
                    }
                    else
                    {
                        for (int i = 0; i < rows.Length; i++)
                        {
                            if (rows[i]["tenThuoc"].ToString() == thuoc.Text.ToString())
                            {
                                int sl = 0;
                                sl             = int.Parse(rows[i]["soLuong"].ToString());
                                db1.Rows[i][0] = sl + int.Parse(soluong.Text.ToString());
                                notExist       = false;
                                break;
                            }
                        }
                        if (notExist == true)
                        {
                            thBus = new ThuocBUS();
                            List <ThuocDTO> listThuoc = thBus.select();
                            this.loadData_Vao_GridView(listThuoc, soluong.Text);
                            grid.ItemsSource = db1.DefaultView;
                        }
                    }
                }
            }
        }