public bool Update(TaiKhoanChungChi data) { string id = $"{data.id}"; data.id = string.Empty; data.ngay_sua = XMedia.XUtil.TimeInEpoch(DateTime.Now); return(Update(_default_index, data, id)); }
private TaiKhoanChungChi ConvertDoc(IHit <TaiKhoanChungChi> hit) { TaiKhoanChungChi u = new TaiKhoanChungChi(); try { u = hit.Source; u.id = hit.Id; } catch { } return(u); }
public IActionResult Create(TaiKhoanChungChi tkcc) { SetMetaData(tkcc, false); var tai_khoan_cc = TaiKhoanChungChiRepository.Instance.Index(tkcc); if (tai_khoan_cc) { SetAlert($"Tạo chứng chỉ cho tài khoản {tkcc.id_tai_khoan} thành công", "success"); } else { SetAlert("Tạo mới thất bại", "error"); } return(View()); }
public bool Index(TaiKhoanChungChi data) { int retry = 0; int max_retry = 5; bool need_retry = true; while (retry++ < max_retry && need_retry) { need_retry = !Index(_default_index, data, "", data.id); if (need_retry) { Task.Delay(1000).Wait(); } } return(!need_retry); }
public IActionResult InsertKetQuaThi(string cuoc_thi, string tai_khoan, string json_ket_qua_thi, double diem_thi) { KetQuaThi kq = new KetQuaThi { id_tai_khoan = tai_khoan, id_cuoc_thi = cuoc_thi, diem_thi = diem_thi, ket_qua_thi_json = json_ket_qua_thi, ngay_tao = XMedia.XUtil.TimeInEpoch(DateTime.Now), ngay_sua = XMedia.XUtil.TimeInEpoch(DateTime.Now), nguoi_tao = tai_khoan, nguoi_sua = tai_khoan }; if (KetQuaThiRepository.Instance.Index(kq, out string id)) { var get_kieu_ket_qua = CuocThiRepository.Instance.GetById(kq.id_cuoc_thi)?.kieu_ket_qua; if (get_kieu_ket_qua != null) { var noi_dung_kieu_du_lieu = get_kieu_ket_qua .FirstOrDefault(x => x.min <kq.diem_thi && x.max> kq.diem_thi)?.ten; if (string.IsNullOrEmpty(noi_dung_kieu_du_lieu)) { noi_dung_kieu_du_lieu = string.Empty; } TaiKhoanChungChi tkcc = new TaiKhoanChungChi { id_ket_qua_thi = id, id_tai_khoan = tai_khoan, ngay_cap = kq.ngay_thi, id = id, noi_dung = noi_dung_kieu_du_lieu + $"(Điểm đạt được: {kq.diem_thi})", ngay_tao = kq.ngay_tao, ngay_sua = XMedia.XUtil.TimeInEpoch(DateTime.Now), nguoi_tao = tai_khoan, nguoi_sua = tai_khoan }; TaiKhoanChungChiRepository.Instance.Index(tkcc); } return(Json(new { msg = "Tạo kết quả thành công" })); } return(Json(new { msg = "Tạo kết quả thất bại" })); }
public IActionResult TaiKhoanChungChi(TaiKhoanChungChi tkcc) { if (is_admin || tkcc.id_tai_khoan == user() || allow_create) { if (tkcc != null) { SetMetaData(tkcc, true); if (TaiKhoanChungChiRepository.Instance.Update(tkcc)) { SetAlert("Lưu thành công", "success"); } else { SetAlert("Lưu thất bại", "error"); } } return(View(tkcc)); } return(RedirectToAction("Index")); }
public IActionResult Edit(TaiKhoanChungChi tkcc) { return(View()); }