Exemple #1
0
        public CuocThiMap(CuocThi ct, List <ThuocTinh> tt, Dictionary <string, string> dm_cuoc_thi, string ten_de_thi, bool expired)
        {
            if (!string.IsNullOrEmpty(ct.id_cha))
            {
                foreach (var dm in dm_cuoc_thi.Where(x => x.Key == ct.id_cha))
                {
                    ten_dm_cuoc_thi = dm.Value;
                }
            }

            this.expired  = expired;
            id            = ct.id;
            id_cha        = ct.id_cha;
            ten_dm_cha    = ten_dm_cuoc_thi;
            ten           = ct.ten;
            pass_thi      = ct.pass_thi;
            ngay_bat_dau  = ct.ngay_bat_dau;
            ngay_ket_thuc = ct.ngay_ket_thuc;
            ngay_tao      = ct.ngay_tao;
            ngay_sua      = ct.ngay_sua;
            nguoi_tao     = ct.nguoi_tao;
            nguoi_sua     = ct.nguoi_sua;
            var item_thuoc_tinh = new List <int>();

            if (ct.thuoc_tinh != null)
            {
                item_thuoc_tinh = ct.thuoc_tinh;
            }
            thuoc_tinh      = tt.Where(x => item_thuoc_tinh.Contains(x.gia_tri)).ToDictionary(x => x.gia_tri, y => y.ten);
            loai_cuoc_thi   = ct.loai_cuoc_thi;
            id_de_thi       = ct.id_de_thi;
            this.ten_de_thi = ten_de_thi;
            noi_dung        = ct.noi_dung;
        }
Exemple #2
0
        public KetQuaThiMap(KetQuaThi kq, TaiKhoan tk, CuocThi ct, List <ThuocTinh> tt)
        {
            id        = kq.id;
            nguoi_tao = kq.nguoi_tao;
            ngay_tao  = kq.ngay_tao;
            nguoi_sua = kq.nguoi_sua;
            ngay_sua  = kq.ngay_sua;
            ngay_thi  = kq.ngay_thi;
            if (tk != null)
            {
                id_tai_khoan = tk.id;
                username     = tk.username;
            }

            if (ct != null)
            {
                id_cuoc_thi  = ct.id;
                ten_cuoc_thi = ct.ten;
            }

            diem_thi         = kq.diem_thi;
            ket_qua_thi_json = kq.ket_qua_thi_json;
            var item_thuoc_tinh = new List <int>();

            if (kq.thuoc_tinh != null)
            {
                item_thuoc_tinh = kq.thuoc_tinh;
            }
            thuoc_tinh = tt.Where(x => item_thuoc_tinh.Contains(x.gia_tri)).ToDictionary(x => x.gia_tri, y => y.ten);
        }
Exemple #3
0
        public DanhSachThiMap(CuocThi ct, TaiKhoan tk, DanhSachThi ds, List <ThuocTinh> tt, bool exam, bool expired, bool start, bool luot_thi)
        {
            id = ds.id;
            if (ct != null)
            {
                id_cuoc_thi   = ct.id;
                ten_cuoc_thi  = ct.ten;
                ngay_bat_dau  = ct.ngay_bat_dau;
                ngay_ket_thuc = ct.ngay_ket_thuc;
            }
            if (tk != null)
            {
                id_tai_khoan  = tk.username;
                ten_tai_khoan = tk.username;
                fullname      = tk.fullname;
            }
            var item_thuoc_tinh = new List <int>();

            if (ds.thuoc_tinh != null)
            {
                item_thuoc_tinh = ds.thuoc_tinh;
            }
            thuoc_tinh     = tt.Where(x => item_thuoc_tinh.Contains(x.gia_tri)).ToDictionary(x => x.gia_tri, y => y.ten);
            ngay_tao       = ds.ngay_tao;
            ngay_sua       = ds.ngay_sua;
            nguoi_sua      = ds.nguoi_sua;
            nguoi_tao      = ds.nguoi_tao;
            tinh_trang_thi = exam;
            is_expired     = expired;
            this.start     = start;
            so_lan_thi_lai = ct.so_lan_thi_lai;
            this.luot_thi  = luot_thi;
            this.pass_thi  = ct.pass_thi;
        }
Exemple #4
0
        public bool Update(CuocThi data)
        {
            if (!string.IsNullOrEmpty(data.ten))
            {
                string id = $"{data.id}";
                data.id       = string.Empty;
                data.ngay_sua = XMedia.XUtil.TimeInEpoch(DateTime.Now);
                return(Update(_default_index, data, id));
            }

            return(false);
        }
Exemple #5
0
 public DanhSachThiMap(CuocThi ct, TaiKhoan tk, DanhSachThi ds)
 {
     id            = ds.id;
     id_cuoc_thi   = ct.id;
     ten_cuoc_thi  = ct.ten;
     id_tai_khoan  = tk.id;
     ten_tai_khoan = tk.username;
     ngay_tao      = ds.ngay_tao;
     ngay_sua      = ds.ngay_sua;
     nguoi_sua     = ds.nguoi_sua;
     nguoi_tao     = ds.nguoi_tao;
     ngay_bat_dau  = ct.ngay_bat_dau;
     ngay_ket_thuc = ct.ngay_ket_thuc;
 }
Exemple #6
0
        private CuocThi ConvertDoc(IHit <CuocThi> hit)
        {
            CuocThi u = new CuocThi();

            try
            {
                u    = hit.Source;
                u.id = hit.Id;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(u);
        }
Exemple #7
0
 public DanhSach(CuocThi ct, TaiKhoan tk, DanhSachThi ds)
 {
     id           = ds.id;
     id_cuoc_thi  = ct.id;
     ten_cuoc_thi = ct.ten;
     if (tk != null)
     {
         id_tai_khoan  = tk.id;
         ten_tai_khoan = tk.username;
         fullname      = tk.fullname;
     }
     ngay_tao  = ds.ngay_tao;
     ngay_sua  = ds.ngay_sua;
     nguoi_sua = ds.nguoi_sua;
     nguoi_tao = ds.nguoi_tao;
 }
Exemple #8
0
        public bool Index(CuocThi data)
        {
            int  retry = 0; int max_retry = 5;
            bool need_retry = true;

            if (!string.IsNullOrEmpty(data.ten))
            {
                while (retry++ < max_retry && need_retry)
                {
                    need_retry = !Index(_default_index, data, "");
                    if (need_retry)
                    {
                        Task.Delay(1000).Wait();
                    }
                }
            }
            return(!need_retry);
        }