public bool TaoHoaDonNhap(HoaDonNhap HDN, ArrayList arrCTHDN) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Thêm hóa đơn nhập"); busUser.SetSystemLog(systemLog); int i = hdnQ.InsertHDN(HDN); if (i > 0) { int MaHDN = hdnQ.SelectLastMaHoaDonNhap(); int j = 0; foreach (ChiTietHoaDonNhap ctHDN in arrCTHDN) { ctHDN.MaDHN = MaHDN; j += hdnQ.InsertChiTietHDN(ctHDN); } if (j == arrCTHDN.Count) { foreach (ChiTietHoaDonNhap ctHDN in arrCTHDN) { hdnQ.UpdateSoLuongThuoc(ctHDN.IDThuoc, ctHDN.SoLuong); } return true; } else{ hdnQ.DelHoaDonNhapByMaHDN(MaHDN); return false; } } else { return false; } }
public Boolean UpdateThuoc(Thuoc thuoc) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Sửa thuốc"); busUser.SetSystemLog(systemLog); if (thuocQ.UpdateThuoc(thuoc) > 0) { return true; } else return false; }
public Boolean UpdateDVT(DonViTinh DVT) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Sửa đơn vị tính"); busUser.SetSystemLog(systemLog); if (DvtQ.UpdateDVT(DVT) > 0) { return true; } else return false; }
public Boolean TaoNNPP() { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Thêm nhà phân phối"); busUser.SetSystemLog(systemLog); if (NppQ.InsertNPP() > 0) { return true; } else return false; }
public Boolean UpdateNPP(NhaPhanPhoi NPP) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Sửa nhà phân phối"); busUser.SetSystemLog(systemLog); if (NppQ.UpdateNPP(NPP) > 0) { return true; } else return false; }
public Boolean TaoDVT() { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Thêm đơn vị tính"); busUser.SetSystemLog(systemLog); if (DvtQ.InsertNDVT() > 0) { return true; } else return false; }
public Boolean TaoNSX() { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Thêm nhà sản xuất"); busUser.SetSystemLog(systemLog); if (NsxQ.InsertNSX() > 0) { return true; } else return false; }
public Boolean UpdateNSX(NhaSanXuat NSX) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Sửa nhà sản xuất"); busUser.SetSystemLog(systemLog); if (NsxQ.UpdateNSX(NSX) > 0) { return true; } else return false; }
public Boolean UpdateNhomThuoc(NhomThuoc NT) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Sửa nhóm thuốc "); busUser.SetSystemLog(systemLog); if (NhomQ.UpdateNhomThuoc(NT) > 0) { return true; } else return false; }
public bool DelHoaDonNhap(int MaHDN) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Xóa hóa đơn nhập"); busUser.SetSystemLog(systemLog); if (hdnQ.DelHoaDonNhapByMaHDN(MaHDN) > 0) { return true; } else return false; }
public bool DelNPPByMaNPP(int MaNPP) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Xóa nhà phân phôi"); busUser.SetSystemLog(systemLog); if (NppQ.KiemTraNPP(MaNPP)) return false; else { NppQ.DelNhaPhanPhoiByMaNPP(MaNPP); return true; } }
public bool DelNhaSanXuatByMaNSX(int MaNSX) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Xóa nhà sản xuất"); busUser.SetSystemLog(systemLog); if (NsxQ.KiemTraNSX(MaNSX)) return false; else { NsxQ.DelNhaSanXuatByMaNSX(MaNSX); return true; } }
public bool DelDonViTInhByMaDVT(int MaDVT) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Xóa đơn vị tính"); busUser.SetSystemLog(systemLog); if (DvtQ.KiemTraDVT(MaDVT)) return false; else { DvtQ.DelDonViTInhByMaDVT(MaDVT); return true; } }
public bool DelNhomThuocByMaNhom(int MaNhom) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Xóa nhóm thuốc "); busUser.SetSystemLog(systemLog); if (NhomQ.KiemTraNhomThuoc(MaNhom)) return false; else { NhomQ.DelNhomThuocByMaNhom(MaNhom); return true; } }
public ArrayList SelectAllSystem(String _FromDate,String _ToDate) { SqlDataReader rd = dbHelper.ExecuteQuery("getAllSystem '"+_FromDate+"','"+_ToDate+"'"); ArrayList arrSys = new ArrayList(); while (rd.Read()) { SystemLog sys = new SystemLog(rd.GetInt32(0), rd.GetInt32(1), rd.GetString(2), rd.GetDateTime(3).ToString(), rd.GetString(4)); arrSys.Add(sys); } rd.Close(); return arrSys; }
public bool TaoNhomThuoc(NhomThuoc NT) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Thêm nhóm thuốc "); busUser.SetSystemLog(systemLog); int i = NhomQ.InsertNhomThuoc(NT); if (i > 0) { return true; } else { return false; } }
public void InsertSystemLog(SystemLog systemLog) { List<SqlParameter> paramList = new List<SqlParameter>(); SqlParameter param = new SqlParameter(); param = new SqlParameter("@IDUser", SqlDbType.Int); param.Value = systemLog.IDUser; paramList.Add(param); param = new SqlParameter("@DateLogin", SqlDbType.DateTime); param.Value = DateTime.Now.ToString(); paramList.Add(param); param = new SqlParameter("@Description", SqlDbType.NVarChar); param.Value = systemLog.Description; paramList.Add(param); dbHelper.ExecuteNonQuery("SetDateLoginUser", paramList); }
private void button2_Click(object sender, EventArgs e) { bool flag = busHDX.TaoHoaDonXuat(hdx, arrList); SystemLog systemLog = new SystemLog(SellMedicine.IDUser, DateTime.Now.ToString(), "Tạo đơn thuốc"); busUser.SetSystemLog(systemLog); if (flag) { HoaDonXuat hdxTemp = busHDX.GetLastHoaDonXuat(); RPTDonThuoc rptDT = new RPTDonThuoc(hdxTemp.MaHDX); rptDT.ShowDialog(); dgDT(flag); this.Close(); } }
public string DelThuocByMaThuoc(string MaThuoc) { SystemLog systemLog = new SystemLog(QuanLy.IDUser, DateTime.Now.ToString(), "Xóa thuốc "); busUser.SetSystemLog(systemLog); String kq; if (thuocQ.KiemTraThuocHDN(MaThuoc)) kq = "Xóa hết Hóa Đơn Nhập liên quan đến Thuốc này"; else if (thuocQ.KiemTraThuocHDX(MaThuoc)) kq = "Xóa hết Hóa Đơn Xuất liên quan đến Thuốc này"; else { kq = "OK"; thuocQ.DelThuocByMaThuoc(MaThuoc); } return kq; }
public void Submit() { if (!ValidateFrom.CheckEmty(txtUsername.Text)) { txtUsername.Focus(); MessageBox.Show(this, "UserName Invalid!"); } else if (!ValidateFrom.CheckEmty(txtPassword.Text)) { txtPassword.Focus(); MessageBox.Show(this, "Password Invalid!"); } else { User user = busUser.GetUser(txtUsername.Text,txtPassword.Text); if (user != null) { if (radioButton1.Checked) { SystemLog systemLog = new SystemLog(user.IDUser, DateTime.Now.ToString(), "Đăng nhập vào quản lý"); busUser.SetSystemLog(systemLog); QuanLy ql = new QuanLy(user); ql.Visible = true; this.Visible = false; } else if (radioButton2.Checked) { SystemLog systemLog = new SystemLog(user.IDUser, DateTime.Now.ToString(), "Đăng nhập vào kê đơn"); busUser.SetSystemLog(systemLog); SellMedicine mm = new SellMedicine(user); mm.Show(); this.Visible = false; } } else { MessageBox.Show("Not find user!"); txtUsername.Focus(); } } }
public SystemLog SelectLastLoginUser(int _IDUser) { List<SqlParameter> paramList = new List<SqlParameter>(); SqlParameter param = new SqlParameter(); param = new SqlParameter("@IDUser", SqlDbType.Int); param.Value = _IDUser; paramList.Add(param); SqlDataReader rd = null; rd = dbHelper.ExecuteQuery("GetLastLoginUser", paramList); if (rd.Read()) { SystemLog systemLog = new SystemLog(rd.GetInt32(0),rd.GetInt32(1), rd.GetDateTime(2).ToString(), rd.GetString(3)); rd.Close(); return systemLog; } else { rd.Close(); return null; } }
public void SetSystemLog(SystemLog _SystemLog) { userQ.InsertSystemLog(_SystemLog); }
public void XoaDonThuoc() { if (lVSanhSachHDX.SelectedItems.Count > 0) { if (MessageBox.Show(this,"Bạn có muốn xóa không?!", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { HoaDonXuat hdx = (HoaDonXuat)arrLAllHDX.ToArray()[lVSanhSachHDX.FocusedItem.Index]; busHDX.DelHoaDonXuat(hdx.MaHDX); SystemLog systemLog = new SystemLog(SellMedicine.IDUser, DateTime.Now.ToString(), "Xóa đơn thuốc"); busUser.SetSystemLog(systemLog); MessageBox.Show(this, "Xóa thành công!","Thông báo"); this.lVDanhSachHDX(); } } else { MessageBox.Show(this, "Chọn một hóa đơn", "Thông báo"); } }
private void button1_Click(object sender, EventArgs e) { if (mode == 1) { if (CheckFrom()) { BenhNhan benhNhan = new BenhNhan(txtMaBN.Text, txtHoTen.Text, Convert.ToInt32(txtTuoi.Text),txtDiaChi.Text,txtDienThoai.Text); int i = busBN.InsertBenhNhan(benhNhan); if (i > 0) { SystemLog systemLog = new SystemLog(SellMedicine.IDUser, DateTime.Now.ToString(), "Thêm bệnh nhân"); busUser.SetSystemLog(systemLog); MessageBox.Show(this,"Thêm bệnh nhân thành công!","Thông báo"); BenhNhan lastBenhNhan = busBN.GetLastBenhNhan(); dgBN(lastBenhNhan, index); this.Close(); } } } else if (mode == 2) { if (CheckFrom()) { BenhNhan benhNhan = new BenhNhan(this.benhNhan.IDBN, txtMaBN.Text, txtHoTen.Text, Convert.ToInt32(txtTuoi.Text), txtDiaChi.Text, txtDienThoai.Text); int i = busBN.UpdateBenhNhan(benhNhan); if (i > 0) { SystemLog systemLog = new SystemLog(SellMedicine.IDUser, DateTime.Now.ToString(), "Sửa thông tin bệnh nhân"); busUser.SetSystemLog(systemLog); MessageBox.Show(this, "Sửa thông tin bệnh nhân thành công!", "Thông báo"); dgBN(benhNhan,index); this.Close(); } } } }
private void toolStripButton7_Click(object sender, EventArgs e) { if (lVDanhSachBenhNhan.SelectedItems.Count > 0) { if (MessageBox.Show(this, "Bạn có muốn xóa bệnh nhân không?\n Nếu xóa tất cả các đơn thuốc của bệnh nhân này cũng sẽ bị xóa!", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int index = lVDanhSachBenhNhan.FocusedItem.Index; BenhNhan benhNhan = (BenhNhan)arrLDSBenhNhan.ToArray()[index]; int i = busBenhNhan.DeleteBenhNhan(benhNhan.IDBN); if (i > 0) { SystemLog systemLog = new SystemLog(SellMedicine.IDUser, DateTime.Now.ToString(), "Thêm bệnh nhân"); busUser.SetSystemLog(systemLog); MessageBox.Show(this, "Xóa thành công!", "Thông báo"); arrLDSBenhNhan.RemoveAt(index); RefreshListBenhNhan(); } } } else { MessageBox.Show(this, "Chọn một bệnh nhân", "Thông báo"); } }
private void xoaHoaDonToolStripMenuItem1_Click(object sender, EventArgs e) { if (lvDanhSachHDX.SelectedItems.Count > 0) { if (MessageBox.Show(this, "Bạn có muốn xóa không?!", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { HoaDonXuat hdx = (HoaDonXuat)arrLAllHDX.ToArray()[lvDanhSachHDX.FocusedItem.Index]; SystemLog systemLog = new SystemLog(currentUser.IDUser, DateTime.Now.ToString(), "Xóa đơn thuốc"); busUser.SetSystemLog(systemLog); busHDX.DelHoaDonXuat(hdx.MaHDX); DanhSachHDX(); } } else { MessageBox.Show(this, "Chọn một hóa đơn", "Thông báo"); } }
public void UserLogout() { SystemLog systemLog = new SystemLog(currentUser.IDUser, DateTime.Now.ToString(), "Logout"); busUser.SetSystemLog(systemLog); }