private void btnxacnhansieuam_Click_1(object sender, EventArgs e) { string getmacls = cbsieuam.SelectedValue.ToString(); string getphieunhap = txtmaphieukham.Text; string linksieuam = "File\\Sieu-am\\SA"; string mabn = txtmabenhnhan.Text; if(getphieunhap != "") { int result = libraryService.InsertChiTietCLS(getphieunhap, getmacls, linksieuam); ChiTietCLS cls = new ChiTietCLS(); cls = libraryService.LayketQua(getphieunhap, getmacls); string ketqua = cls.KetQua.ToString(); string linkdansieuam = @ketqua + "" + mabn + "" + getphieunhap; if (result > 0) { MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { // đưa dữ liệu từ file vào sieu am // đọc từ file word try { var word = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document document = word.Documents.Open(link + "" + @linkdansieuam + "" + @"\ketqua.docx"); document.ActiveWindow.Selection.WholeStory(); document.ActiveWindow.Selection.Copy(); document.Close(); IDataObject data = Clipboard.GetDataObject(); txtmotasieuam.Text = data.GetData(DataFormats.UnicodeText).ToString(); // chèn ảnh vào picturebox string filepath1 = link + "" + @linkdansieuam + "" + @"\pcb1.jpg"; OpenFileDialog ofdImage1s = new OpenFileDialog(); pcbsieuam1.SizeMode = PictureBoxSizeMode.StretchImage; pcbsieuam1.Image = Image.FromFile(filepath1.ToString()); string filepath2 = link + "" + @linkdansieuam + "" + @"\pcb2.jpg"; OpenFileDialog ofdImages2 = new OpenFileDialog(); pcbsieuam1.SizeMode = PictureBoxSizeMode.StretchImage; pcbsieuam2.Image = Image.FromFile(filepath2.ToString()); } catch { MessageBox.Show("Cập nhật thất bại, đã có sẳn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("Không được để trống phiếu khám", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ChiTietCLS LayketQua(string maphieu, string macls) { ChiTietCLS cls = new ChiTietCLS(); DataTable table = DataProvider.Instane.ExecuteReader("EXECUTE dbo.SP_LayKetQuaCLS @maphieu , @macls", new object[] { maphieu, macls }); foreach (DataRow row in table.Rows) { cls = new ChiTietCLS(row); } return(cls); }
private void btnxacnhanxquang_Click_1(object sender, EventArgs e) { string getmacls = cbxquang.SelectedValue.ToString(); string getphieunhap = txtmaphieukham.Text; string mabn = txtmabenhnhan.Text; string linkxquang = "File\\X-quang\\XQ"; if (getphieunhap != "") { int result = libraryService.InsertChiTietCLS(getphieunhap, getmacls, linkxquang); ChiTietCLS cls = new ChiTietCLS(); cls = libraryService.LayketQua(getphieunhap, getmacls); string ketqua = cls.KetQua.ToString(); string linkdanxquang = @ketqua + "" + mabn + "" + getphieunhap; if (result > 0) { MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { try { // chèn ảnh vào picturebox string filepath1 = link + "" + @linkdanxquang + "" + @"\pcb1.jpg"; OpenFileDialog ofdImage1s = new OpenFileDialog(); pcbxquang1.SizeMode = PictureBoxSizeMode.StretchImage; pcbxquang1.Image = Image.FromFile(filepath1.ToString()); string filepath2 = link + "" + @linkdanxquang + "" + @"\pcb2.jpg"; OpenFileDialog ofdImages2 = new OpenFileDialog(); pcbxquang1.SizeMode = PictureBoxSizeMode.StretchImage; pcbxquang2.Image = Image.FromFile(filepath2.ToString()); } catch { MessageBox.Show("Cập nhật thất bại, đã có sẳn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Không được để trống phiếu khám", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnxacnhanxetnghiem_Click(object sender, EventArgs e) { string getmacls = cbxetnghiem.SelectedValue.ToString(); string getphieunhap = txtmaphieukham.Text; string linkxetnghiem = "File\\Xet-nghiem\\XN"; string mabn = txtmabenhnhan.Text; if(getphieunhap != "") { int result = libraryService.InsertChiTietCLS(getphieunhap, getmacls, linkxetnghiem); ChiTietCLS cls = new ChiTietCLS(); cls = libraryService.LayketQua(getphieunhap, getmacls); string ketqua = cls.KetQua.ToString(); string linkdanxetnghiem = @ketqua + "" + mabn + "" + getphieunhap; if (result > 0) { MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { // đưa dữ liệu từ file vào sieu am // đọc từ file word try { string file = link + "" + @linkdanxetnghiem + "" + @"\ketqua.xlsx"; dgvketquaxetnghiem.DataSource = libraryService.GetCLS(file); dgvdsphieukham.RowHeadersVisible = false; } catch { MessageBox.Show("Cập nhật thất bại, đã có sẳn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }