Ejemplo n.º 1
0
 private void SuaCTTTDaTonTai(GhiKQVaoPKDTO a)
 {
     if (GhiKQVaoPKBUS.SuaCTTTDaTonTai(a) == true)
     {
         return;
     }
 }
Ejemplo n.º 2
0
        public void TaiDuLieuVaoDataGirdView()
        {
            if (KiemTraMaPK() == false)
            {
                return;
            }
            GhiKQVaoPKDTO a = new GhiKQVaoPKDTO();

            a.Mapk = int.Parse(txtMaPK.Text);
            if (GhiKQVaoPKBUS.LoadCTTT(a) == null)
            {
                MessageBox.Show("Không có dữ liệu chi tiết toa thuốc!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.dgvCTTT.Columns.Clear();
                return;
            }

            this.dgvCTTT.Columns.Clear();
            this.dgvCTTT.DataSource = null;

            this.dgvCTTT.AutoGenerateColumns = false;
            this.dgvCTTT.AllowUserToAddRows  = false;
            this.dgvCTTT.DataSource          = GhiKQVaoPKBUS.LoadCTTT(a);

            DataGridViewTextBoxColumn tenthuocCol = new DataGridViewTextBoxColumn();

            tenthuocCol.Name             = "TenThuoc";
            tenthuocCol.HeaderText       = "Tên thuốc";
            tenthuocCol.DataPropertyName = "TenThuoc";
            tenthuocCol.Width            = 130;
            this.dgvCTTT.Columns.Add(tenthuocCol);

            DataGridViewTextBoxColumn soluongCol = new DataGridViewTextBoxColumn();

            soluongCol.Name             = "SoLuong";
            soluongCol.HeaderText       = "Số lượng";
            soluongCol.DataPropertyName = "SoLuong";
            soluongCol.Width            = 80;
            this.dgvCTTT.Columns.Add(soluongCol);

            DataGridViewTextBoxColumn donvitinhCol = new DataGridViewTextBoxColumn();

            donvitinhCol.Name             = "DonViTinh";
            donvitinhCol.HeaderText       = "Đơn vị tính";
            donvitinhCol.DataPropertyName = "DonViTinh";
            this.dgvCTTT.Columns.Add(donvitinhCol);

            DataGridViewTextBoxColumn cachdungCol = new DataGridViewTextBoxColumn();

            cachdungCol.Name             = "CachDung";
            cachdungCol.HeaderText       = "Cách dùng";
            cachdungCol.DataPropertyName = "CachDung";
            cachdungCol.Width            = 500;
            this.dgvCTTT.Columns.Add(cachdungCol);


            CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[this.dgvCTTT.DataSource];

            myCurrencyManager.Refresh();
        }
Ejemplo n.º 3
0
        private bool XoaCTTT()
        {
            if (LayDTO.Tenthuoc == null)
            {
                MessageBox.Show("Bạn phải chọn chi tiết toa thuốc trước!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }

            if (GhiKQVaoPKBUS.XoaCTTT(LayDTO) == true)
            {
                return(true);
            }
            return(true);
        }
Ejemplo n.º 4
0
        // THÊM CTTT

        private void btnThem_Click(object sender, EventArgs e)
        {
            GhiKQVaoPKDTO gkqDTO = new GhiKQVaoPKDTO();

            if (txtCachDung.Text == "" || nudSoLuong.Text == "0")
            {
                MessageBox.Show("Vui lòng nhập đầy đủ thông tin!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (KiemTraMaPK() == false)
            {
                return;
            }
            gkqDTO.Mapk     = int.Parse(txtMaPK.Text);
            gkqDTO.Tenthuoc = cbbTenThuoc.Text;
            //gkqDTO.Trangthai = 1;
            gkqDTO.Soluong  = int.Parse(nudSoLuong.Text);
            gkqDTO.Cachdung = txtCachDung.Text;

            if (gkqBus.LayGiaThuoc(gkqDTO) == null)
            {
                MessageBox.Show("Vui lòng nhập đúng Tên thuốc!", "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            float x = gkqBus.LayGiaThuoc(gkqDTO).Gia;
            float y = x * gkqDTO.Soluong;

            gkqDTO.Dongia = y;
            if (GhiKQVaoPKBUS.ThemCTTT(gkqDTO) == false)
            {
                SuaCTTTDaTonTai(gkqDTO);
            }

            MessageBox.Show("Thêm thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);


            TaiDuLieuVaoDataGirdView();
        }
Ejemplo n.º 5
0
        private void SuaCTTT()
        {
            GhiKQVaoPKDTO SuaDTO = new GhiKQVaoPKDTO();

            if (txtCachDung.Text == "" || nudSoLuong.Text == "0")
            {
                MessageBox.Show("Vui lòng nhập đầy đủ thông tin!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            SuaDTO.Tenthuoc = cbbTenThuoc.Text;
            SuaDTO.Soluong  = int.Parse(nudSoLuong.Text);
            if (gkqBus.LayGiaThuoc(SuaDTO) == null)
            {
                MessageBox.Show("Vui lòng nhập đúng Tên thuốc!", "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            float x = gkqBus.LayGiaThuoc(SuaDTO).Gia;
            float y = x * SuaDTO.Soluong;

            SuaDTO.Dongia   = y;
            SuaDTO.Cachdung = txtCachDung.Text;
            if (LayDTO.Tenthuoc == null)
            {
                MessageBox.Show("Bạn phải chọn chi tiết toa thuốc trước!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (GhiKQVaoPKBUS.SuaCTTT(LayDTO, SuaDTO) == false)
            {
                XoaCTTT();
                SuaDTO.Mapk = int.Parse(txtMaPK.Text);
                SuaCTTTDaTonTai(SuaDTO);
            }

            MessageBox.Show("Sửa chi tiết toa thuốc thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            TaiDuLieuVaoDataGirdView();
        }
Ejemplo n.º 6
0
 private void frmGhiKetQuaVaoPK_Load(object sender, EventArgs e)
 {
     this.gkqBus = new GhiKQVaoPKBUS();
     this.loadTenThuoc();
 }