示例#1
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;
        }