Esempio n. 1
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         DSSV.EndCurrentEdit();
         db.SubmitChanges();
         enableNutLenh(false);
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        public List<TAPTINTHONGBAO> SelectTAPTINTHONGBAOsAll()
        {
            List<TAPTINTHONGBAO> list = new List<TAPTINTHONGBAO>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<TAPTINTHONGBAO_getallResult> lp = db.TAPTINTHONGBAO_getall();
                foreach (TAPTINTHONGBAO_getallResult TAPTINTHONGBAO in lp)
                {
                    TAPTINTHONGBAO var1 = new TAPTINTHONGBAO();
                    var1.MaTapTin  = TAPTINTHONGBAO.MaTapTin ;
                    var1.TenTapTin  = TAPTINTHONGBAO.TenTapTin ;
                    var1.DuongDan  = TAPTINTHONGBAO.DuongDan;
                    var1.MaThongBao  = TAPTINTHONGBAO.MaThongBao;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
        public int getMaBaiVietLichLamViec()
        {
            int ma = -1;

            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {

                ISingleResult<TAPTINBAIVIET_getmabaivietlichlamviecResult> lp = db.TAPTINBAIVIET_getmabaivietlichlamviec();
                foreach (TAPTINBAIVIET_getmabaivietlichlamviecResult lichlamviec in lp)
                {
                    ma = lichlamviec.MaBaiViet;
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return ma;
        }
        public List<HETHONGTOCHUC> SelectHETHONGTOCHUCsAll()
        {
            List<HETHONGTOCHUC> list = new List<HETHONGTOCHUC>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {

                ISingleResult<HETHONGTOCHUC_getallResult> lp = db.HETHONGTOCHUC_getall  ();
                foreach (HETHONGTOCHUC_getallResult HETHONGTOCHUC in lp)
                {
                    HETHONGTOCHUC var1 = new HETHONGTOCHUC();
                    var1.MaBai = HETHONGTOCHUC.MaBai;
                    var1.TieuDe   = HETHONGTOCHUC.TieuDe ;
                    var1.NoiDung  = HETHONGTOCHUC.NoiDung ;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
        public List<DANGKYHOATDONG_getallResult> SelectDANGKYHOATDONGsAll()
        {
            List<DANGKYHOATDONG_getallResult> list = new List<DANGKYHOATDONG_getallResult>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<DANGKYHOATDONG_getallResult> lp = db.DANGKYHOATDONG_getall();
                foreach (DANGKYHOATDONG_getallResult DANGKYHOATDONG in lp)
                {
                    DANGKYHOATDONG_getallResult var1 = new DANGKYHOATDONG_getallResult();
                    var1.MaHoatDong = DANGKYHOATDONG.MaHoatDong ;
                    var1.MaNguoiDung  = DANGKYHOATDONG.MaNguoiDung ;
                    var1.Username = DANGKYHOATDONG.Username;
                    var1.TenHoatDong = DANGKYHOATDONG.TenHoatDong;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 6
0
        public List<KHAOSAT> SelectKHAOSATsAll()
        {
            List<KHAOSAT> list = new List<KHAOSAT>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<KHAOSAT_getallResult> lp = db.KHAOSAT_getall();
                foreach (KHAOSAT_getallResult KHAOSAT in lp)
                {
                    KHAOSAT var1 = new KHAOSAT();
                    var1.MaDapAn  = KHAOSAT.MaDapAn ;
                    var1.MaYKKS  = KHAOSAT.MaYKKS ;
                    var1.YKienKhac  = KHAOSAT.YKienKhac ;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
        public List<DANGKYHOATDONG> SelectDANGKYHOATDONGbyMASV(int MaNguoiDung)
        {
            List<DANGKYHOATDONG> dsDKHoatDong = new List<DANGKYHOATDONG>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<DANGKYHOATDONG_selectbySinhVienResult> lp = db.DANGKYHOATDONG_selectbySinhVien(MaNguoiDung);
                foreach (DANGKYHOATDONG_selectbySinhVienResult aDKHoatDong in lp)
                {
                    DANGKYHOATDONG var1 = new DANGKYHOATDONG();
                    var1.MaHoatDong = aDKHoatDong.MaHoatDong;
                    var1.MaNguoiDung = aDKHoatDong.MaNguoiDung;
                    dsDKHoatDong.Add(var1);
                }

                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }
            return dsDKHoatDong;
        }
        public List<LOAIBAIVIET> SelectLOAIBAIVIETsAll()
        {
            List<LOAIBAIVIET> list = new List<LOAIBAIVIET>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<LOAIBAIVIET_getallResult> lp = db.LOAIBAIVIET_getall();
                foreach (LOAIBAIVIET_getallResult LOAIBAIVIET in lp)
                {
                    LOAIBAIVIET var1 = new LOAIBAIVIET();
                    var1.MaLoaiBaiViet = LOAIBAIVIET.MaLoaiBaiViet;
                    var1.TenLoaiBaiViet = LOAIBAIVIET.TenLoaiBaiViet;
                    var1.MaChuyenMuc = LOAIBAIVIET.MaChuyenMuc;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 9
0
        public List<GIOITHIEU> SelectGIOITHIEUsAll()
        {
            List<GIOITHIEU> list = new List<GIOITHIEU>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<GIOITHIEU_getallResult> lp = db.GIOITHIEU_getall();
                foreach (GIOITHIEU_getallResult GIOITHIEU in lp)
                {
                    GIOITHIEU var1 = new GIOITHIEU();
                    var1.MaBai  = GIOITHIEU.MaBai ;
                    var1.TieuDe  = GIOITHIEU.TieuDe ;
                    var1.NoiDung  = GIOITHIEU.NoiDung ;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
        public int CapNhat(DANGKYMUONPHONG lpDTO)
        {
            try
            {
                LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString);
                db.DANGKYMUONPHONG_update(
                    lpDTO.MaDangKy,

                    lpDTO.MaNguoiDung,
                    lpDTO.NgayDangKy,
                    lpDTO.NgaySuDung,
                    lpDTO.SoLuong,
                    lpDTO.MucDich,
                    lpDTO.DonViMuon,
                    lpDTO.KQPhong,
                    lpDTO.TGBatDau,
                    lpDTO.TGKetThuc,
                    lpDTO.KetQua
                    );
                db.SubmitChanges();
                return 0;

            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Esempio n. 11
0
        public List<HINHANH> SelectHINHANHsAll()
        {
            List<HINHANH> list = new List<HINHANH>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {

                ISingleResult<HINHANH_getallResult> lp = db.HINHANH_getall();
                foreach (HINHANH_getallResult HINHANH in lp)
                {
                    HINHANH var1 = new HINHANH();
                    var1.MaHinhAnh  = HINHANH.MaHinhAnh ;
                    var1.DuongDan  = HINHANH.DuongDan   ;
                    var1.MaAlbum  = HINHANH.MaAlbum ;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 12
0
        public List<ALBUM> SelectALBUMsAll()
        {
            List<ALBUM> list = new List<ALBUM>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<ALBUM_getallResult> lp = db.ALBUM_getall();
                foreach (ALBUM_getallResult ALBUM in lp)
                {
                    ALBUM var1 = new ALBUM();
                    var1.MaAlbum  = ALBUM.MaAlbum ;
                    var1.TenAlbum  = ALBUM.TenAlbum ;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 13
0
        public List<GOPY> SelectGopYsAll()
        {
            List<GOPY> list = new List<GOPY>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<GOPY_getallResult> lp = db.GOPY_getall();
                foreach (GOPY_getallResult GOPY in lp)
                {
                    GOPY var1 = new GOPY();
                    var1.MaGopY = GOPY.MaGopY;
                    var1.TieuDe = GOPY.TieuDe;
                    var1.NoiDungGopY = GOPY.NoiDungGopY;
                    var1.MSSV = GOPY.MSSV;
                    var1.Email = GOPY.Email;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 14
0
        public List<HOATDONG> SelectHOATDONGByLoai(int iMaLoaiHoatDong)
        {
            List<HOATDONG> KetQua = new List<HOATDONG>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<HOATDONG_GetByLoaiResult> dsHoatDong = db.HOATDONG_GetByLoai(iMaLoaiHoatDong);
                foreach (HOATDONG_GetByLoaiResult HOATDONG in dsHoatDong)
                {
                    HOATDONG aHoatDong = new HOATDONG();
                    aHoatDong.MaHoatDong = HOATDONG.MaHoatDong;
                    aHoatDong.TenHoatDong = HOATDONG.TenHoatDong;
                    aHoatDong.NgayDienRa = HOATDONG.NgayDienRa;
                    aHoatDong.MaLoaiHoatDong = HOATDONG.MaLoaiHoatDong;
                    aHoatDong.ThoiGianBatDauDangKy = HOATDONG.ThoiGianBatDauDangKy;
                    aHoatDong.ThoiGianKetThucDangKy = HOATDONG.ThoiGianKetThucDangKy;
                    aHoatDong.HinhAnh = HOATDONG.HinhAnh;
                    KetQua.Add(aHoatDong);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return KetQua;
        }
Esempio n. 15
0
        public List<BAIHAT> SelectBAIHATsAll()
        {
            List<BAIHAT> list = new List<BAIHAT>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<BAIHAT_getallResult> lp = db.BAIHAT_getall();
                foreach (BAIHAT_getallResult BAIHAT in lp)
                {
                    BAIHAT var1 = new BAIHAT();
                    var1.MaBaiHat  = BAIHAT.MaBaiHat ;
                    var1.TenBaiHat  = BAIHAT.TenBaiHat ;
                    var1.LinkBaiHat  = BAIHAT.LinkBaiHat ;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
        public List<TAPTINBAIVIET> getLichLamViec()
        {
            List<TAPTINBAIVIET> list = new List<TAPTINBAIVIET>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {

                ISingleResult<TAPTINBAIVIET_getLichLamViecResult> lp = db.TAPTINBAIVIET_getLichLamViec();
                foreach (TAPTINBAIVIET_getLichLamViecResult TAPTINBAIVIET in lp)
                {
                    TAPTINBAIVIET var1 = new TAPTINBAIVIET();
                    var1.MaTapTin = TAPTINBAIVIET.MaTapTin;
                    var1.TenTapTin = TAPTINBAIVIET.TenTapTin;
                    var1.DuongDan = TAPTINBAIVIET.DuongDan;
                    var1.MaBaiViet = TAPTINBAIVIET.MaBaiViet;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
        public List<CAUHOIKHAOSAT> SelectCAUHOIKHAOSATsAll()
        {
            List<CAUHOIKHAOSAT> list = new List<CAUHOIKHAOSAT>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<CAUHOIKHAOSAT_getallResult> lp = db.CAUHOIKHAOSAT_getall();
                foreach (CAUHOIKHAOSAT_getallResult CAUHOIKHAOSAT in lp)
                {
                    CAUHOIKHAOSAT var1 = new CAUHOIKHAOSAT();
                    var1.MaCauHoiKhaoSat  = CAUHOIKHAOSAT.MaCauHoiKhaoSat ;
                    var1.NoiDung  = CAUHOIKHAOSAT.NoiDung ;
                    var1.BiKhoa  = CAUHOIKHAOSAT.BiKhoa ;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 18
0
        // lấy danh sách các câu hỏi:
        public List<CAUHOITHUONGGAP> LayDanhSachTatCaCauHoi()
        {
            List<CAUHOITHUONGGAP> lstCauHoi = new List<CAUHOITHUONGGAP>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {

                ISingleResult<FAQ_getallCauHoiResult> lp = db.FAQ_getallCauHoi();
                foreach (FAQ_getallCauHoiResult CAUHOITHUONGGAP in lp)
                {
                    CAUHOITHUONGGAP var1 = new CAUHOITHUONGGAP();
                    var1.MaCauHoi = CAUHOITHUONGGAP.MaCauHoi;
                    var1.NoiDungCauHoi = CAUHOITHUONGGAP.NoiDungCauHoi;
                    lstCauHoi.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return lstCauHoi;
        }
        public List<LOAIHOATDONG> SelectLOAIHOATDONGsAll()
        {
            List<LOAIHOATDONG> list = new List<LOAIHOATDONG>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<LOAIHOATDONG_getallResult> lp = db.LOAIHOATDONG_getall();
                foreach (LOAIHOATDONG_getallResult LOAIHOATDONG in lp)
                {
                    LOAIHOATDONG var1 = new LOAIHOATDONG();
                    var1.MaLoaiHoatDong  = LOAIHOATDONG.MaLoaiHoatDong ;
                    var1.TenLoaiHoatDong  = LOAIHOATDONG.TenLoaiHoatDong ;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 20
0
        //Cập nhật tài khoản
        public void UpdateAccount(Account account)
        {
            db = new LinQDataContext();
            Account ac = new Account();

            ac = db.Accounts.Single(x => x.AccountId == account.AccountId);
            setAccountUpdate(ac, account);
            db.SubmitChanges();
        }
Esempio n. 21
0
        //Xóa tài khoản
        public void DeleteAccount(int accountId)
        {
            db = new LinQDataContext();
            Account ac = new Account();

            ac = db.Accounts.Single(x => x.AccountId == accountId);
            db.Accounts.DeleteOnSubmit(ac);
            db.SubmitChanges();
        }
Esempio n. 22
0
        //Tạo tài khoản
        public void CreateAccount(Account account)
        {
            db = new LinQDataContext();
            Account ac = new Account();

            ac = account;
            db.Accounts.InsertOnSubmit(ac);
            db.SubmitChanges();
        }
        //Xóa chức vụ
        public void DeletePosition(int positionId)
        {
            db = new LinQDataContext();
            Position po = new Position();

            po = db.Positions.Single(x => x.PositionId == positionId);
            db.Positions.DeleteOnSubmit(po);
            db.SubmitChanges();
        }
Esempio n. 24
0
        //Cập nhật nhân viên
        public void UpdateEmployee(Employee employee)
        {
            db = new LinQDataContext();
            Employee emp = new Employee();

            emp = db.Employees.Single(x => x.EmployeeId == employee.EmployeeId);
            setEmployeeUpdate(emp, employee);
            db.SubmitChanges();
        }
        //Cập nhật phòng ban
        public void UpdateDepartment(Department department)
        {
            db = new LinQDataContext();
            Department dep = new Department();

            dep = db.Departments.Single(x => x.DepartmentId == department.DepartmentId);
            setDepartmentUpdate(dep, department);
            db.SubmitChanges();
        }
Esempio n. 26
0
        public void AddScheduleForPostion(SchedulePosition schedulePosition)
        {
            db = new LinQDataContext();
            SchedulePosition schedule = new SchedulePosition();

            schedule = schedulePosition;
            db.SchedulePositions.InsertOnSubmit(schedule);
            db.SubmitChanges();
        }
        //Xóa phòng ban
        public void DeleteDepartment(int departmentId)
        {
            db = new LinQDataContext();
            Department dep = new Department();

            dep = db.Departments.Single(x => x.DepartmentId == departmentId);
            db.Departments.DeleteOnSubmit(dep);
            db.SubmitChanges();
        }
Esempio n. 28
0
        public void AddScheduleForDepartment(ScheduleDepartment scheduleDepartment)
        {
            db = new LinQDataContext();
            ScheduleDepartment schedule = new ScheduleDepartment();

            schedule = scheduleDepartment;
            db.ScheduleDepartments.InsertOnSubmit(schedule);
            db.SubmitChanges();
        }
Esempio n. 29
0
        //Tạo nhân viên mới
        public void CreateEmployee(Employee employee)
        {
            db = new LinQDataContext();
            Employee emp = new Employee();

            emp = employee;
            db.Employees.InsertOnSubmit(emp);
            db.SubmitChanges();
        }
        //Cập nhật chức vụ
        public void UpdatePosition(Position position)
        {
            db = new LinQDataContext();
            Position po = new Position();

            po = db.Positions.Single(x => x.PositionId == position.PositionId);
            setPositionUpdate(po, position);
            db.SubmitChanges();
        }
Esempio n. 31
0
        //Xóa nhân viên
        public void DeleteEmployee(int employeeId)
        {
            db = new LinQDataContext();
            Employee emp = new Employee();

            emp = db.Employees.Single(x => x.EmployeeId == employeeId);
            db.Employees.DeleteOnSubmit(emp);
            db.SubmitChanges();
        }
        public User createUser(User user)
        {
            db = new LinQDataContext();
            User us = new User();

            us = user;
            db.Users.InsertOnSubmit(us);
            db.SubmitChanges();
            return(us);
        }
        public Prescription createPrescription(Prescription prescription)
        {
            db = new LinQDataContext();
            Prescription pre = new Prescription();

            pre = prescription;
            db.Prescriptions.InsertOnSubmit(pre);
            db.SubmitChanges();
            return(pre);
        }
Esempio n. 34
0
        public DrugInPrescription createDrugInPrescription(DrugInPrescription drugInPrescription)
        {
            db = new LinQDataContext();
            DrugInPrescription drug = new DrugInPrescription();

            drug = drugInPrescription;
            db.DrugInPrescriptions.InsertOnSubmit(drug);
            db.SubmitChanges();
            return(drug);
        }
        //Thêm phòng ban
        public Department CreateDepartment(Department department)
        {
            db = new LinQDataContext();
            Department dep = new Department();

            dep = department;
            db.Departments.InsertOnSubmit(dep);
            db.SubmitChanges();
            return(dep);
        }
        //Thêm chức vụ
        public Position CreatePosition(Position position)
        {
            db = new LinQDataContext();
            Position po = new Position();

            po = position;
            db.Positions.InsertOnSubmit(po);
            db.SubmitChanges();
            return(po);
        }
Esempio n. 37
0
        public void DeleteSchedulePostion(SchedulePosition schedule)
        {
            db = new LinQDataContext();
            SchedulePosition sch = new SchedulePosition();

            sch = db.SchedulePositions.FirstOrDefault(x => x.idSchedule == schedule.idSchedule && x.idPosition == schedule.idPosition);
            if (sch != null)
            {
                db.SchedulePositions.DeleteOnSubmit(sch);
                db.SubmitChanges();
            }
        }
Esempio n. 38
0
        public void deleteSchdeduleDepartment(ScheduleDepartment scheduleDepartment)
        {
            db = new LinQDataContext();
            ScheduleDepartment sch = new ScheduleDepartment();

            sch = db.ScheduleDepartments.FirstOrDefault(x => x.idSchedule == scheduleDepartment.idSchedule && x.idDepartment == scheduleDepartment.idDepartment);
            if (sch != null)
            {
                db.ScheduleDepartments.DeleteOnSubmit(sch);
                db.SubmitChanges();
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string reserid = TextBox1.Text;

            using (LinQDataContext dbcontext = new LinQDataContext())
            {
                Reservation reserv = dbcontext.Reservations.FirstOrDefault(reserve => reserve.ReservationId == reserid);
                reserv.Status = "Cancel";
                dbcontext.SubmitChanges();
            }
            Response.Write("<script>alert('Record cancel successfully')</script>");
        }
Esempio n. 40
0
 public int CapNhat(LOAIBAIVIET lpDTO)
 {
     try
     {
         LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString);
         db.LOAIBAIVIET_update(
             lpDTO.MaLoaiBaiViet,
             lpDTO.TenLoaiBaiViet,
             lpDTO.MaChuyenMuc
             );
         db.SubmitChanges();
         return 1;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
 public int CapNhat(CAUHOIKHAOSAT lpDTO)
 {
     try
     {
         LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString);
         db.CAUHOIKHAOSAT_update(
             lpDTO.MaCauHoiKhaoSat,
             lpDTO.NoiDung,
             lpDTO.BiKhoa
             );
         db.SubmitChanges();
         return 0;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Esempio n. 42
0
        public List<BAIVIET> LayBaiVietMoiNhat(int SoLuong)
        {
            List<BAIVIET> list = new List<BAIVIET>();
            using (LinQDataContext db = new LinQDataContext())
            {
                ISingleResult<BAIVIET_LayBaiVietMoiNhatResult> lp = db.BAIVIET_LayBaiVietMoiNhat();

                int i = 0;
                foreach(BAIVIET_LayBaiVietMoiNhatResult bv in lp)
                {
                    if (i == SoLuong)
                    {
                        break;
                    }
                    //BAIVIET_LayBaiVietMoiNhatResult bv = temp[i];
                    BAIVIET var1 = new BAIVIET();
                    var1.MaBaiViet = bv.MaBaiViet;
                    var1.TieuDe = bv.TieuDe;
                    var1.NoiDung = bv.NoiDung;
                    var1.MaLoaiBaiViet = bv.MaLoaiBaiViet;
                    var1.NgayDang = bv.NgayDang;
                    var1.HinhAnh = bv.HinhAnh;
                    var1.TomTat = bv.TomTat;
                    if (bv.CapNhat!=null)
                        var1.CapNhat = (DateTime)bv.CapNhat;
                    list.Add(var1);
                    i++;
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 43
0
 public int CapNhat(BAIVIET lpDTO)
 {
     try
     {
         LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString);
       db.BAIVIET_update(
             lpDTO.MaBaiViet,
             lpDTO.TieuDe,
             lpDTO.NoiDung,
             lpDTO.MaLoaiBaiViet,
             lpDTO.NgayDang, lpDTO.CapNhat,
             lpDTO.HinhAnh,
             lpDTO.TomTat, lpDTO.TinNoiBat
             );
       db.SubmitChanges();
       return 0;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
        public List<DANGKYMUONPHONG> SelectDANGKYMUONPHONGBYDATE(DateTime NgayXoa)
        {
            List<DANGKYMUONPHONG> list = new List<DANGKYMUONPHONG>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<DANGKYMUONPHONG> lp = db.DANGKYMUONPHONG_getbydate(NgayXoa);
                foreach (DANGKYMUONPHONG DANGKYMUONPHONG in lp)
                {
                    DANGKYMUONPHONG var1 = new DANGKYMUONPHONG();
                    var1.MaDangKy = DANGKYMUONPHONG.MaDangKy;
                    var1.MaNguoiDung = DANGKYMUONPHONG.MaNguoiDung;
                    var1.NgaySuDung = DANGKYMUONPHONG.NgaySuDung;
                    var1.SoLuong = DANGKYMUONPHONG.SoLuong;
                    var1.MucDich = DANGKYMUONPHONG.MucDich;
                    var1.DonViMuon = DANGKYMUONPHONG.DonViMuon;
                    var1.KQPhong = DANGKYMUONPHONG.KQPhong;
                    var1.NgayDangKy = DANGKYMUONPHONG.NgayDangKy;
                    var1.KetQua = DANGKYMUONPHONG.KetQua;

                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
 public int Xoa(int macauhoikhaosat)
 {
     try
     {
         LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString);
         db.CAUHOIKHAOSAT_delete(macauhoikhaosat);
         db.SubmitChanges();
         return 0;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Esempio n. 46
0
 public int Xoa(int maalbum)
 {
     try
     {
         LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString);
        db.ALBUM_delete(maalbum);
        db.SubmitChanges();
        return 0;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Esempio n. 47
0
        public List<HOATDONG> SelectHOATDONGsAll()
        {
            List<HOATDONG> list = new List<HOATDONG>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<HOATDONG_getallResult> lp = db.HOATDONG_getall();
                foreach (HOATDONG_getallResult HOATDONG in lp)
                {
                    HOATDONG var1 = new HOATDONG();
                    var1.MaHoatDong = HOATDONG.MaHoatDong ;
                    var1.TenHoatDong = HOATDONG.TenHoatDong ;
                    var1.NgayDienRa   = HOATDONG.NgayDienRa  ;
                    var1.MaLoaiHoatDong  = HOATDONG.MaLoaiHoatDong ;
                    var1.ThoiGianBatDauDangKy  = HOATDONG.ThoiGianBatDauDangKy ;
                    var1.ThoiGianKetThucDangKy  = HOATDONG.ThoiGianKetThucDangKy ;
                    var1.HinhAnh = HOATDONG.HinhAnh;
                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 48
0
        public List<BAIVIET> SelectBAIVIETsAll()
        {
            List<BAIVIET> list = new List<BAIVIET>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<BAIVIET_getallResult> lp = db.BAIVIET_getall();
                foreach (BAIVIET_getallResult BAIVIET in lp)
                {
                    BAIVIET var1 = new BAIVIET();
                    var1.MaBaiViet = BAIVIET.MaBaiViet;
                    var1.TieuDe = BAIVIET.TieuDe;
                    var1.NoiDung = BAIVIET.NoiDung;
                    var1.MaLoaiBaiViet = BAIVIET.MaLoaiBaiViet;
                    var1.NgayDang = BAIVIET.NgayDang;
                    var1.HinhAnh = BAIVIET.HinhAnh;
                    var1.TomTat = BAIVIET.TieuDe;
                    if (BAIVIET.CapNhat != null)
                        var1.CapNhat = (DateTime)BAIVIET.CapNhat;
                    list.Add(var1);
                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
Esempio n. 49
0
        public List<BAIVIET> TimKiemTheoLoaiBaiViet(int MaLoaiBaiViet)
        {
            List<BAIVIET> list = new List<BAIVIET>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {

            //                 ISingleResult<BAIVIET_TimKiemTheoLoaiBaiVietResult> lp = db.BAIVIET_TimKiemTheoLoaiBaiViet(MaLoaiBaiViet);
            //                 foreach (BAIVIET_TimKiemTheoLoaiBaiVietResult BAIVIET in lp)
            //                 {
            //                     BAIVIET var1 = new BAIVIET();
            //                     var1.MaBaiViet = BAIVIET.MaBaiViet;
            //                     var1.TieuDe = BAIVIET.TieuDe;
            //                     var1.NoiDung = BAIVIET.NoiDung;
            //                     var1.MaLoaiBaiViet = BAIVIET.MaLoaiBaiViet;
            //                     var1.NgayDang = BAIVIET.NgayDang;
            //                     var1.HinhAnh = BAIVIET.HinhAnh;
            //                     var1.TomTat = BAIVIET.TomTat;
            //                     if (BAIVIET.CapNhat != null)
            //                         var1.CapNhat = (DateTime)BAIVIET.CapNhat;
            //                     list.Add(var1);
            //                 }
                var rs = from n in db.BAIVIETs
                         where n.MaLoaiBaiViet == MaLoaiBaiViet
                         orderby n.MaBaiViet descending
                         select n;
                list = rs.ToList();
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }

            return list;
        }
 public List<DANGKYMUONPHONG> SelectDANGKYMUONPHONGbySinhVien(int MaSV)
 {
     List<DANGKYMUONPHONG> dsDKMuonPhong = new List<DANGKYMUONPHONG>();
     using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
     {
         ISingleResult<DANGKYMUONPHONG_selectBySinhVienResult> lp = db.DANGKYMUONPHONG_selectBySinhVien(MaSV);
         foreach (DANGKYMUONPHONG_selectBySinhVienResult DANGKYMUONPHONG in lp)
         {
             DANGKYMUONPHONG var1 = new DANGKYMUONPHONG();
             var1.MaDangKy = DANGKYMUONPHONG.MaDangKy;
             var1.MaNguoiDung = DANGKYMUONPHONG.MaNguoiDung;
             var1.TGBatDau = DANGKYMUONPHONG.TGBatDau;
             var1.TGKetThuc = DANGKYMUONPHONG.TGKetThuc;
             var1.NgaySuDung = DANGKYMUONPHONG.NgaySuDung;
             var1.SoLuong = DANGKYMUONPHONG.SoLuong;
             var1.MucDich = DANGKYMUONPHONG.MucDich;
             var1.DonViMuon = DANGKYMUONPHONG.DonViMuon;
             var1.KQPhong = DANGKYMUONPHONG.KQPhong;
             var1.NgayDangKy = DANGKYMUONPHONG.NgayDangKy;
             var1.KetQua = DANGKYMUONPHONG.KetQua;
             dsDKMuonPhong.Add(var1);
         }
         try
         {
             // Save the changes.
             db.SubmitChanges();
         }
         // Detect concurrency conflicts.
         catch (ChangeConflictException)
         {
             // Resolve conflicts.
             db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
         }
     }
     return dsDKMuonPhong;
 }
Esempio n. 51
0
        public List<BAIVIET> LayBaiVietMoiNhatTheoChuyenMuc(int MaChuyenMuc)
        {
            List<BAIVIET> list = new List<BAIVIET>();
            using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString))
            {
                ISingleResult<BAIVIET_LayTopBaiVietMoiNhatTheoChuyenMucResult> lp = db.BAIVIET_LayTopBaiVietMoiNhatTheoChuyenMuc(MaChuyenMuc);

                foreach (BAIVIET_LayTopBaiVietMoiNhatTheoChuyenMucResult bv in lp)
                {
                    //BAIVIET_LayBaiVietMoiNhatResult bv = temp[i];
                    BAIVIET var1 = new BAIVIET();
                    var1.MaBaiViet = bv.MaBaiViet;
                    var1.TieuDe = bv.TieuDe;
                    var1.NoiDung = bv.NoiDung;
                    var1.MaLoaiBaiViet = bv.MaLoaiBaiViet;
                    var1.NgayDang = bv.NgayDang;
                    var1.HinhAnh = bv.HinhAnh;
                    var1.TomTat = bv.TomTat;
                    if (bv.CapNhat != null)
                        var1.CapNhat = (DateTime)bv.CapNhat;
                    list.Add(var1);

                }
                try
                {
                    // Save the changes.
                    db.SubmitChanges();
                }
                // Detect concurrency conflicts.
                catch (ChangeConflictException)
                {
                    // Resolve conflicts.
                    db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                }
            }
            if (list.Count > 0)
                return list;
            else
                return null;
        }