Ejemplo n.º 1
0
        public void Kethuoc()
        {
            KethuocDTO  kt  = new KethuocDTO();
            ToathuocDTO toa = new ToathuocDTO();

            toabus        = new ToathuocBUS();
            ktbus         = new KethuocBUS();
            toa.MaToa     = toabus.autogenerate_matoa().ToString();
            toa.MaPkb     = "1";
            toa.NgayKetoa = DateTime.UtcNow.Date;
            kt.MaToa      = toa.MaToa;
            kt.MaThuoc    = "2";
            kt.SoLuong    = 2;
            Assert.AreEqual(true, toabus.them(toa) && ktbus.kethuoc(kt));
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int row = db1.Rows.Count;

            if (row == 0)
            {
                MessageBox.Show("Vui lòng kê thuốc");
            }
            else
            {
                ToathuocDTO tt = new ToathuocDTO();
                tt.MaToa     = matoa.Text.ToString();
                tt.MaPkb     = mapkb.Text.ToString();
                tt.NgayKetoa = DateTime.UtcNow.Date;
                ttBus        = new ToathuocBUS();
                bool kq = ttBus.them(tt);
                if (kq == false)
                {
                    MessageBox.Show("Kê toa thất bại", "Result", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
                }
                else
                {
                    MessageBox.Show("Kê toa thành công", "Result");
                }
                KethuocDTO kt = new KethuocDTO();
                for (int i = 0; i < row; i++)
                {
                    kt.MaToa = matoa.Text;
                    TextBlock x = grid.Columns[0].GetCellContent(grid.Items[i]) as TextBlock;
                    kt.MaThuoc = x.Text;
                    TextBlock y = grid.Columns[5].GetCellContent(grid.Items[i]) as TextBlock;
                    int       val;
                    bool      check = Int32.TryParse(y.Text, out val);
                    if (!check)
                    {
                        return;
                    }
                    else
                    {
                        kt.SoLuong = val;
                    }
                    ktBus = new KethuocBUS();
                    bool kq1 = ktBus.kethuoc(kt);
                }
            }
        }