/// <summary> /// sử lý lưu thông tin phòng khám /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLuu_Click(object sender, EventArgs e) { cPhongKhamDO ds = Getthongtinpk(); if (Checkdauvao(ds) == true) { if (Add && (BUS.cPhongKhamBUS.Checkmaphongkham(ds.MAPHONGKHAM) == true || BUS.cPhongKhamBUS.Checkphongkham(ds.TENPHONG) == true) && Update == false) { XtraMessageBox.Show("Mã phòng khám hoặc Tên phòng khám đã tồn tại: " + "!!", "Hỏi", MessageBoxButtons.OK, MessageBoxIcon.Warning); Enablediting(true); } else { if (Add && BUS.cPhongKhamBUS.Checkphongkham(ds.TENPHONG) == false && BUS.cPhongKhamBUS.Checkmaphongkham(ds.MAPHONGKHAM) == false && Update == false) { BUS.cPhongKhamBUS.Insertphongkham(ds.MAPHONGKHAM, ds.TENPHONG, ds.NGAYTAO, ds.TRANGTHAI); ucPhongkham_Load(sender, e); XtraMessageBox.Show("Lưu thành công", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (Update) { BUS.cPhongKhamBUS.Updatephongkham(ds.MAPHONGKHAM, ds.TENPHONG, ds.NGAYTAO, ds.TRANGTHAI); ucPhongkham_Load(sender, e); XtraMessageBox.Show("Lưu thành công", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
/// <summary> /// kiểm tra thông tin nhập vào /// </summary> /// <param name="ds"></param> /// <returns></returns> private static bool Checkdauvao(cPhongKhamDO ds) { if (ds.MAPHONGKHAM.Equals("")) { XtraMessageBox.Show("Vui lòng nhập lại mã phòng khám!"); return(false); } if (ds.TENPHONG.Equals("")) { XtraMessageBox.Show("Vui lòng nhập lại tên phòng khám!"); return(false); } return(true); }
public static string GetNameByClinicID(string ID) { ID = ID.ToLower(); cPhongKhamDO group = new cPhongKhamDO(); using (DB_HMS_Entities lst = new DB_HMS_Entities()) { var query = from u in lst.tbPHONGKHAMs where u.MAPHONGKHAM == ID select u; foreach (var row in query) { group.TENPHONG = row.TENPHONG; } } return(group.TENPHONG); }
public static string GetIDByClinicName(string Name) { Name = Name.ToLower(); cPhongKhamDO group = new cPhongKhamDO(); using (DB_HMS_Entities lst = new DB_HMS_Entities()) { var query = from u in lst.tbPHONGKHAMs where u.TENPHONG == Name select u; foreach (var row in query) { group.MAPHONGKHAM = row.MAPHONGKHAM; } } return(group.MAPHONGKHAM); }
/// <summary> /// lấy thông tin phòng khám /// </summary> /// <returns></returns> public cPhongKhamDO Getthongtinpk() { cPhongKhamDO ds = new cPhongKhamDO(); ds.TENPHONG = txtTenphongkham.Text; ds.MAPHONGKHAM = txtMaphongkham.Text; ds.NGAYTAO = DateTime.Today; if (chkTrangThai.Checked == true) { ds.TRANGTHAI = true; } else { ds.TRANGTHAI = false; } return(ds); }
/// <summary> /// Lay danh sach phong kham tu entities /// </summary> /// <returns></returns> public static List <cPhongKhamDO> Getdsphongkham() { List <cPhongKhamDO> dsphongkham = new List <cPhongKhamDO>(); using (DB_HMS_Entities ds = new DB_HMS_Entities()) { var query = from ads in ds.tbPHONGKHAMs select ads; foreach (var row in query) { cPhongKhamDO dss = new cPhongKhamDO(); dss.MAPHONGKHAM = row.MAPHONGKHAM; dss.TENPHONG = row.TENPHONG; dss.NGAYTAO = row.NGAYTAO.Value; dss.TRANGTHAI = row.TRANGTHAI.Value; dsphongkham.Add(dss); } return(dsphongkham); } }