private void btnThem_Click(object sender, EventArgs e) { // Tạo mã bệnh án BenhAn b = new BenhAn(); b = a.GetLastID(); long s = -1; if (b != null) { s = long.Parse(b.MaBenhAn.Substring(2)); } s++; string kq = "BA" + s; while (kq.Length < 13) { kq = kq.Insert(2, "0"); } //----------------------------------------- BenhAn ba = GetFormBenhAn(); ba.MaBenhAn = kq; a.Add(ba); LoadGridView(); }
//button Tạo hóa đơn private void simpleButton1_Click(object sender, EventArgs e) { this.btnKedon.Enabled = true; this.btnDichvu.Enabled = true; this.btnTaohoadon.Enabled = false; HoaDon h = new HoaDon(); h.LoaiHoaDon = true; h.TenKhachHang = txtHoten.Text; h.TenNhaCungCap = "Phòng khám ABC"; h.MaKhachHang = txtMabenhan.Text; //Tạo mã hóa đơn HoaDon b = new HoaDon(); b = hd.GetLastID(); long s = -1; if (b != null) { s = long.Parse(b.MaHoaDon.Substring(2)); } s++; string kq = "HD" + s; while (kq.Length < 13) { kq = kq.Insert(2, "0"); } //----------------------------------------------------- h.MaHoaDon = kq; this.MaHoaDon = kq; hd.Add(h); }
private void btnThemmoi_Click(object sender, EventArgs e) { BenhNhan bn = new BenhNhan(); bn = GetBenhNhanForm(); BenhNhan b = new BenhNhan(); b = t.GetLastID(); long s = -1; if (b != null) { s = long.Parse(b.MaBenhNhan.Substring(2)); } s++; string kq = "BN" + s; while (kq.Length < 13) { kq = kq.Insert(2, "0"); } bn.MaBenhNhan = kq; t.Add(bn); gridcontrol1.DataSource = t.SelectAll(); }