Exemplo n.º 1
0
        private void gridViewMain_DoubleClick(object sender, EventArgs e)
        {
            ShowPanel(3);
            ThuocNo focusedRow = gridViewMain.GetFocusedRow() as ThuocNo;

            textBoxMaThuocNo.Text       = focusedRow.MaThuocNo;
            textBoxTenThuocNo.Text      = focusedRow.TenThuocNo;
            textBoxTocDoNo.Text         = focusedRow.TocDoNo.ToString();
            textBoxKhaNangSinhCong.Text = focusedRow.KhaNangSinhCong.ToString();
            textBoxMatDoNapThuoc.Text   = focusedRow.MatDoNapThuoc.ToString();
            textBoxChiuNuoc.Text        = focusedRow.ChiuNuoc;
            textBoxHeSoChuyenDoi.Text   = focusedRow.HS_ChuyenDoi.ToString();
            textBoxDonViTinh.Text       = focusedRow.DonViTinh_TN.ToString();
            textBoxGiaThanh.Text        = focusedRow.GiaThanh_TN.ToString();
        }
Exemplo n.º 2
0
        private void buttonInsert_Click(object sender, EventArgs e)
        {
            ThuocNo inserted = gridViewMain.GetFocusedRow() as ThuocNo;

            inserted.TenThuocNo = textBoxTenThuocNo2.Text;
            if (textBoxTocDoNo2.Text != String.Empty)
            {
                inserted.TocDoNo = double.Parse(textBoxTocDoNo2.Text);
            }
            if (textBoxKhaNangSinhCong2.Text != String.Empty)
            {
                inserted.KhaNangSinhCong = double.Parse(textBoxKhaNangSinhCong2.Text);
            }
            if (textBoxMatDoNapThuoc2.Text != String.Empty)
            {
                inserted.MatDoNapThuoc = double.Parse(textBoxMatDoNapThuoc2.Text);
            }
            inserted.ChiuNuoc = textBoxChiuNuoc2.Text;
            if (textBoxHeSoChuyenDoi2.Text != String.Empty)
            {
                inserted.HS_ChuyenDoi = double.Parse(textBoxHeSoChuyenDoi2.Text);
            }
            if (textBoxDonViTinh2.Text != String.Empty)
            {
                inserted.DonViTinh_TN = double.Parse(textBoxDonViTinh2.Text);
            }
            if (textBoxGiaThanh2.Text != String.Empty)
            {
                inserted.GiaThanh_TN = double.Parse(textBoxGiaThanh2.Text);
            }
            try
            {
                BS_ThuocNo.ThemThuocNo(inserted);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Lỗi - " + exc.Message);
            }
            ShowPanel(1);
            HienThiDuLieu_ThuocNo();
        }