public static bool InsertDichVu(DichVuDTO dichvu)
        {
            bool result = false;

            try
            {
                //create a list parameter
                List <MySqlParameter> parameters = new List <MySqlParameter>();
                //parameters.Add(new MySqlParameter("@MaTK", taikhoan.MaTK));
                parameters.Add(new MySqlParameter("@MaDV", dichvu.MaDV));
                parameters.Add(new MySqlParameter("@NgayBD", dichvu.NgayDV));
                parameters.Add(new MySqlParameter("@FK_SoXe", dichvu.SoXe));

                //call store Procedure
                int n = MySqlDataAccessHelper.ExecuteNonQuery("INSERT INTO dichvu (MaDV, NgayBD, FK_SoXE) VALUES(@MaDV, @NgayBD, @FK_SoXe)", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        public static bool InsertTaiKhoan(TaiKhoanDTO taikhoan)
        {
            bool result = false;

            try
            {
                //create a list parameter
                List <MySqlParameter> parameters = new List <MySqlParameter>();
                //parameters.Add(new MySqlParameter("@MaTK", taikhoan.MaTK));
                parameters.Add(new MySqlParameter("@UserName", taikhoan.UserName));
                parameters.Add(new MySqlParameter("@Password", taikhoan.Password));
                parameters.Add(new MySqlParameter("@FK_NV", taikhoan.MaNhanVien));
                parameters.Add(new MySqlParameter("@TinhTrang", taikhoan.TinhTrang));
                //call store Procedure
                int n = MySqlDataAccessHelper.ExecuteNonQuery("INSERT INTO taikhoan (UserName, Password, FK_NV, TinhTrang) VALUES(@UserName, @Password, @FK_NV, @TinhTrang)", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Exemple #3
0
        public static bool InsertChiTietBaoDuong(ChiTietBaoDuongDTO chitietbaoduong)
        {
            bool result = false;

            try
            {
                //create a list parameter
                List <MySqlParameter> parameters = new List <MySqlParameter>();
                //parameters.Add(new MySqlParameter("@MaTK", taikhoan.MaTK));
                parameters.Add(new MySqlParameter("@MaCTBD", chitietbaoduong.MaCTBD));
                parameters.Add(new MySqlParameter("@TrangThai", chitietbaoduong.TrangThai));

                parameters.Add(new MySqlParameter("@Phi", chitietbaoduong.Phi));
                parameters.Add(new MySqlParameter("@FK_MaPT", chitietbaoduong.MaPT));
                parameters.Add(new MySqlParameter("@FK_MaDV_CTBD", chitietbaoduong.MaDV));
                parameters.Add(new MySqlParameter("@FK_MaHD", chitietbaoduong.MaHD));
                parameters.Add(new MySqlParameter("@FK_MaCV", chitietbaoduong.MaCV));
                parameters.Add(new MySqlParameter("@SoLuong", chitietbaoduong.SoLuong));
                parameters.Add(new MySqlParameter("@DonGia", chitietbaoduong.DonGia));

                //call store Procedure
                int n = MySqlDataAccessHelper.ExecuteNonQuery("INSERT INTO chitietbaoduong (MaCTBD, TrangThai,  Phi, FK_MaPT, FK_MaDV_CTBD, FK_MaHD, FK_MaCV,SoLuong, DonGia) VALUES(@MaCTBD, @TrangThai,  @Phi, @FK_MaPT, @FK_MaDV_CTBD, @FK_MaHD, @FK_MaCV, @SoLuong, @DonGia)", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        public static bool InsertHoaDon(HoaDonDTO hoadon)
        {
            bool result = false;

            try
            {
                //create a list parameter
                List <MySqlParameter> parameters = new List <MySqlParameter>();
                //parameters.Add(new MySqlParameter("@MaTK", taikhoan.MaTK));
                parameters.Add(new MySqlParameter("@MaHD", hoadon.MaHD));
                parameters.Add(new MySqlParameter("@NgayLapHD", hoadon.NgayLapHD));
                parameters.Add(new MySqlParameter("@TongTien", hoadon.TongTien));
                parameters.Add(new MySqlParameter("@MaKH", hoadon.MaKH));
                parameters.Add(new MySqlParameter("@ThanhTien", hoadon.ThanhTien));
                parameters.Add(new MySqlParameter("@GiamGia", hoadon.GiamGia));


                //call store Procedure
                int n = MySqlDataAccessHelper.ExecuteNonQuery("INSERT INTO hoadon (MaHD, NgayLapHD, TongTien, FK_MaKH, GiamGia, ThanhTien) VALUES(@MaHD, @NgayLapHD, @TongTien, @MaKH, @GiamGia, @ThanhTien)", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        public static bool InsertPhanCong(PhanCongDTO phancong)
        {
            bool result = false;

            try
            {
                //create a list parameter
                List <MySqlParameter> parameters = new List <MySqlParameter>();
                //parameters.Add(new MySqlParameter("@MaTK", taikhoan.MaTK));
                parameters.Add(new MySqlParameter("@MaPC", phancong.MaPC));
                parameters.Add(new MySqlParameter("@ThoiGian", phancong.ThoiGian));
                parameters.Add(new MySqlParameter("@GhiChu", phancong.GhiChu));
                parameters.Add(new MySqlParameter("@FK_MaCV", phancong.MaCV));
                parameters.Add(new MySqlParameter("@FK_MaNV", phancong.MaNV));
                parameters.Add(new MySqlParameter("@FK_MaDV", phancong.MaDV));
                //call store Procedure
                int n = MySqlDataAccessHelper.ExecuteNonQuery("INSERT INTO phancong (MaPC, NgayPC, GhiChu, MaCV, MaNV, MaDV) VALUES(@MaPC, @ThoiGian, @GhiChu, @FK_MaCV, @FK_MaNV, @FK_MaDV)", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }