private void btnXacNhan_Click(object sender, EventArgs e) { string TenBN = txtTenBN.Text; string GT = txtGioiTinh.Text; string NgaySinh = dtpNgaySinh.Value.ToString("MM/dd/yyyy"); int SDT = Convert.ToInt32(txtSDT.Text); string Email = txtEmail.Text; string DiaChi = txtDiaChi.Text; string GhiChu = txtGhiChu.Text; string NgayKham = lbNgay.Text; string[] formats = { "dd/MM/yyyy", "dd-MMM-yyyy", "yyyy-MM-dd", "dd-MM-yyyy", "M/d/yyyy", "dd MMM yyyy" }; string converted = DateTime.ParseExact(NgayKham, formats, CultureInfo.InvariantCulture, DateTimeStyles.None).ToString("MM/dd/yyyy"); BacSi bacSi = new BacSi(-1, lbTenBS.Text, "", -1, -1, -1, ""); BenhNhan benhNhan = new BenhNhan(-1, TenBN, GT, NgaySinh, SDT, Email, DiaChi); PhieuHen phieuHen = new PhieuHen(-1, -1, lbThoiGian.Text, GhiChu, converted); if (phieuhen.PhieuHen_Insert(bacSi, benhNhan, phieuHen) == true) { MessageBox.Show("Đặt lịch thành công, chi tiết xem tại mục dành cho bệnh nhân", "Thông báo"); } else { MessageBox.Show("ERROR"); } }
public bool PhieuHen_Insert(BacSi bacSi, BenhNhan benhNhan, PhieuHen phieuHen) { try { string query = "BenhNhan_Select N'" + bacSi.TenBS + "',N'" + benhNhan.TenBN + "','" + phieuHen.ThoiGian + "','" + phieuHen.NgayKham + "',N'" + phieuHen.GhiChu + "',N'" + benhNhan.GioiTinh + "','" + benhNhan.NgaySinh + "','" + benhNhan.SDT + "','" + benhNhan.Email + "',N'" + benhNhan.DiaChi + "'"; DataTable result = DataProvider.Instance.ExecuteQuery(query); return(true); } catch (Exception e) { } return(false); }
public ActionResult ChiTietPH(int id) { PhieuHen phieuhen = (from s in db.PhieuHens orderby s.id_PhieuHen descending where s.id_PhieuHen == id select s).SingleOrDefault(); ViewBag.id_PhieuHen = phieuhen.id_PhieuHen; if (phieuhen == null) { Response.StatusCode = 404; } return(View(phieuhen)); }
public bool PhieuHen_Insert(BacSi bacSi, BenhNhan benhNhan, PhieuHen phieuHen) { return(phieuhen.PhieuHen_Insert(bacSi, benhNhan, phieuHen)); }
public ActionResult GetFile(string id, string typeReport) { byte[] pdf = null; con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandText = "Select * from DangKyThongTin where Id = 1"; SqlDataReader abc = cmd.ExecuteReader(); while (abc.Read()) { string col = abc["Ho"].ToString(); } string path = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\", ""); try { string json = ""; string type = ""; if (typeReport.Equals("DANG_KY_DU_TUYEN")) { type = "DANG_KY_DU_TUYEN"; DangKyThongTin dangKyThongTin = new DangKyThongTin(); dangKyThongTin.Id = 0; dangKyThongTin.ViTriDuTuyen = "ViTriDuTuyen"; dangKyThongTin.DonViDuTuyen = "DonViDuTuyen"; dangKyThongTin.HoTen = "Trần Văn Hậu ABC"; dangKyThongTin.NgaySinh = "24/05/1997"; dangKyThongTin.MaDuThi = "ABC"; dangKyThongTin.GioiTinh = true; dangKyThongTin.DanToc = "Kinh"; dangKyThongTin.TonGiao = "TC"; dangKyThongTin.CMND = "163363955"; dangKyThongTin.NgayCapCMNDString = DateTime.Now.ToString("dd/MM/yyyy"); dangKyThongTin.NoiCapCMND = "NAM DINH"; dangKyThongTin.DienThoaiLienHe = "0123456789"; dangKyThongTin.Email = "*****@*****.**"; dangKyThongTin.QueQuan = "Nam Dinh"; dangKyThongTin.HoKhauThuongTru = "Nam Dinh"; dangKyThongTin.ChoOHienNay = "Ha Dong Ha Noi"; dangKyThongTin.SucKhoe = "Tot"; dangKyThongTin.ChieuCao = "123"; dangKyThongTin.CanNang = "123"; dangKyThongTin.BanThanHienNay = "ABC"; dangKyThongTin.TrinhDoVanHoa = "BCD"; dangKyThongTin.TrinhDoChuyenMon = "BCD"; dangKyThongTin.LoaiHinhDaoTao = "LoaiHinhDaoTao"; dangKyThongTin.NgayDangKyString = ".........., ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month.ToString() + " " + DateTime.Now.Year.ToString(); json = JsonConvert.SerializeObject(dangKyThongTin, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); } else { type = "PHIEU_HEN"; PhieuHen phieuHen = new PhieuHen(); phieuHen.id = 0; phieuHen.MaHoSo = "ABC"; phieuHen.HoVaTen = "Tran Van Hau"; phieuHen.NgaySinh = "24/05/1997"; phieuHen.CMND = "163363955"; phieuHen.DienThoai = "123456789"; phieuHen.Email = "*****@*****.**"; phieuHen.ViTriDuTuyen = "ViTriDuTuyen"; phieuHen.DonViDuTuyen = "DonViDuTuyen"; phieuHen.NgayHenNopHoSo = DateTime.Now.ToString("dd/MM/yyyy"); json = JsonConvert.SerializeObject(phieuHen, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); } string base64 = Utils.Base64Encode(json); var process = Process.Start(path + "\\pdf\\App.exe", type + " " + base64 + " " + id); Console.WriteLine(path); if (process == null) // failed to start { //return InternalServerError(); } else // Started, wait for it to finish { process.WaitForExit(); pdf = System.IO.File.ReadAllBytes(path + "\\pdf\\" + id + "value.pdf"); } } catch (Exception e) { Console.WriteLine(e.Message); } //return response; byte[] byteArray = null; if (System.IO.File.Exists(path + "\\pdf\\" + id + "value.pdf")) { byteArray = System.IO.File.ReadAllBytes(path + "\\pdf\\" + id + "value.pdf"); System.IO.File.Delete(path + "\\pdf\\" + id + "value.pdf"); } return(new FileContentResult(byteArray, "application/pdf")); }