/// <summary> /// 获取题目数据 /// </summary> /// <param name="pid">题目ID</param> /// <param name="dataPath">题目数据路径</param> /// <param name="error">错误信息</param> /// <returns>获取是否成功</returns> public static Boolean TryGetProblemDataPath(String pid, out String dataPath, out String error) { dataPath = String.Empty; try { error = JudgeStatusManager.GetJudgeServerLoginStatus(); if (!String.IsNullOrEmpty(error)) { return false; } Int32 problemID = pid.ToInt32(0); String path = ProblemDataManager.GetProblemDataRealPath(problemID); if (String.IsNullOrEmpty(path)) { error = "Problem data does not exist!"; return false; } dataPath = path; return true; } catch (System.Exception ex) { error = ex.Message; return false; } }
public void VisualizarGrafico(String id) { PesquisaOpiniaoVO p = Pesquisas.Find(x=> x.Id == id.ToInt32()); setChart(p.Respostas.ToList()); winGrafico.Render(); winGrafico.Show(); }
public void AdicionarConhecimento(String id) { LimparCamposConhecimento(); TopicoSelecionado = new TopicoBaseConhecimentoBO().SelectById(id.ToInt32()); this.AcaoTelaBaseConhecimento = Common.AcaoTela.Inclusao; winBaseConhecimento.Title = "Cadastrando Conhecimento"; CarregarTopicos(); cboTopico.SetValue(TopicoSelecionado.Id); winBaseConhecimento.Show(); }
public void AdicionarArquivo(String id) { LimparCamposArquivo(); TipoSelecionado = new TipoArquivoBO().SelectById(id.ToInt32()); this.AcaoTelaArquivo = Common.AcaoTela.Inclusao; winArquivo.Title = "Cadastrando Arquivo"; CarregarTipos(TipoSelecionado); cboTipo.SetValue(TipoSelecionado.Id); winArquivo.Show(); }
public void AdicionarVideo(String id) { LimparCamposVideo(); GaleriaSelecionado = new GaleriaBO().SelectById(id.ToInt32()); this.AcaoTelaVideo = Common.AcaoTela.Inclusao; winVideo.Title = "Cadastrando Video"; CarregarGalerias(GaleriaSelecionado); cboGaleria.SetValue(GaleriaSelecionado.Id); winVideo.Show(); }
public void AdicionarItemManual(String id) { LimparCamposItemManual(); TopicoSelecionado = new TopicoManualColaboradorBO().SelectById(id.ToInt32()); this.AcaoTelaItemManual = Common.AcaoTela.Inclusao; winItemManual.Title = "Cadastrando Item"; CarregarTopicos(); cboTopico.SetValue(TopicoSelecionado.Id); winItemManual.Show(); }
public ActionResult Statistic(Int32 pid = 0, Int32 id = 1, String lang = "all", String order = "default") { ContestEntity contest = ViewData["Contest"] as ContestEntity; ProblemStatistic ps = SolutionManager.GetProblemStatistic(contest.ContestID, pid); String reallang = lang.ToByte(LanguageType.Null.ID).ToString(); String realorder = order.ToInt32(-1).ToString(); Dictionary<String, Byte> langs = LanguageManager.GetSupportLanguages(contest.SupportLanguage); ViewBag.Languages = langs; PagedList<SolutionEntity> list = SolutionManager.GetSolutionList(id, contest.ContestID, pid, null, reallang, ((Byte)ResultType.Accepted).ToString(), realorder); ViewBag.ContestProblemID = pid.ToString(); ViewBag.Language = lang; ViewBag.Order = order; return ViewWithPager(list, ps, id); }
public void OpenNoticia(String noticia) { winHtmlNoticia.Html = new NoticiaBO().SelectById(noticia.ToInt32()).HTML; winHtmlNoticia.Show(); }
public void RemoverTipo(String id) { try { TipoArquivoVO tipo = new TipoArquivoBO().SelectById(id.ToInt32()); new TipoArquivoBO(tipo).DeleteUpdate(); LoadPagina(); } catch (Exception ex) { base.MostrarMensagem("Erro", "Erro ao tentar remover pasta.", ""); } }
public ActionResult Statistic(Int32 pid = 0, Int32 id = 1, String lang = "all", String order = "default") { ProblemStatistic ps = SolutionManager.GetProblemStatistic(-1, pid); String reallang = lang.ToByte(LanguageType.Null.ID).ToString(); String realorder = order.ToInt32(-1).ToString(); Dictionary<String, Byte> langs = LanguageManager.MainSubmitSupportLanguages; ViewBag.Languages = langs; PagedList<SolutionEntity> list = SolutionManager.GetSolutionList(id, -1, pid, null, reallang, ((Byte)ResultType.Accepted).ToString(), realorder); ViewBag.Language = lang; ViewBag.Order = order; return ViewWithPager(list, ps, id); }
private void PreencherCampos(String id) { TipoSelecionado = new TipoArquivoBO().SelectById(id.ToInt32()); txtTipoNome.Text = TipoSelecionado.Nome; txtNome.Hidden = true; txtDescricao.Hidden = true; txtNome.AllowBlank = true; fufArquivoTipo.Hidden = true; fufArquivoTipo.AllowBlank = true; winTipoArquivo.Height = 120; }
public void RemoverGaleria(String id) { try { GaleriaVO galeria = new GaleriaBO().SelectById(id.ToInt32()); new GaleriaBO(galeria).DeleteUpdate(); LoadPagina(); } catch (Exception ex) { base.MostrarMensagem("Erro", "Erro ao tentar remover galeria.", ""); } }
/// <summary> /// 更新评测状态 /// </summary> /// <param name="sid">提交ID</param> /// <param name="pid">题目ID</param> /// <param name="username">用户名</param> /// <param name="result">评测结果</param> /// <param name="detail">出错信息</param> /// <param name="tcost">花费时间</param> /// <param name="mcost">花费内存</param> /// <param name="error">错误信息</param> /// <returns>是否更新成功</returns> public static Boolean TryUpdateSolutionStatus(String sid, String pid, String username, String result, String detail, String tcost, String mcost, out String error) { try { error = JudgeStatusManager.GetJudgeServerLoginStatus(); if (!String.IsNullOrEmpty(error)) { return false; } SolutionEntity entity = new SolutionEntity() { SolutionID = Int32.Parse(sid), ProblemID = pid.ToInt32(0), UserName = username, Result = (ResultType)result.ToByte(0), TimeCost = tcost.ToInt32(0), MemoryCost = mcost.ToInt32(0) }; if (entity.Result > ResultType.Accepted)//没有题目数据则评测失败 否则重新评测 { entity.Result = String.IsNullOrEmpty(ProblemDataManager.GetProblemDataRealPath(entity.ProblemID)) ? ResultType.JudgeFailed : ResultType.RejudgePending; } SolutionManager.JudgeUpdateSolutionAllResult(entity, detail); return true; } catch (System.Exception ex) { error = ex.Message; return false; } }
public void RemoverTopico(String id) { try { TopicoBaseConhecimentoVO topico = new TopicoBaseConhecimentoBO().SelectById(id.ToInt32()); new TopicoBaseConhecimentoBO(topico).Delete(); LoadPagina(); } catch (Exception ex) { base.MostrarMensagem("Erro", "Erro ao tentar remover tópico.", ""); } }
private void PreencherCampos(String id) { TopicoSelecionado = new TopicoBaseConhecimentoBO().SelectById(id.ToInt32()); txtTitulo.Text = TopicoSelecionado.Titulo; txtConhecimentoTopico.AllowBlank = true; txtConhecimentoTopico.Hidden = true; winTopico.Height = 120; }
/// <summary> /// 获取评测列表的Json信息 /// </summary> /// <param name="lanaugeSupport">评测机支持语言</param> /// <param name="count">评测机请求个数</param> /// <returns>评测列表Json信息</returns> public static Boolean TryGetPendingListJson(String lanaugeSupport, String count, out String result, out String error) { result = String.Empty; try { error = JudgeStatusManager.GetJudgeServerLoginStatus(); if (!String.IsNullOrEmpty(error)) { return false; } StringBuilder ret = new StringBuilder(); Int32 requestCount = Math.Max(1, count.ToInt32(1)); List<SolutionEntity> pendingList = SolutionManager.JudgeGetPendingSolution(requestCount, GetJudgeSupportLanguages(lanaugeSupport)); Dictionary<Int32, ProblemEntity> problemCache = new Dictionary<Int32, ProblemEntity>(); Dictionary<Int32, String> problemVersionCache = new Dictionary<Int32, String>(); ProblemEntity problem = null; String problemDataVersion = String.Empty; SolutionEntity solution = null; Int32 listCount = (pendingList == null ? 0 : pendingList.Count); ret.Append("["); for (Int32 i = 0; i < listCount; i++) { if (i > 0) ret.Append(","); solution = pendingList[i]; if (!problemCache.TryGetValue(solution.ProblemID, out problem)) { problem = ProblemManager.GetJudgeProblem(solution.ProblemID); problemCache[solution.ProblemID] = problem; } if (!problemVersionCache.TryGetValue(solution.ProblemID, out problemDataVersion)) { problemDataVersion = ProblemDataManager.GetProblemDataVersion(solution.ProblemID); problemVersionCache[solution.ProblemID] = problemDataVersion; } if (problem != null) { Double scale = solution.LanguageType.Scale; Int32 timeLimit = (Int32)(problem.TimeLimit * scale); Int32 memoryLimit = (Int32)(problem.MemoryLimit * scale); ret.Append("{"); ret.Append("\"sid\":\"").Append(solution.SolutionID.ToString()).Append("\","); ret.Append("\"pid\":\"").Append(solution.ProblemID.ToString()).Append("\","); ret.Append("\"username\":\"").Append(solution.UserName).Append("\","); ret.Append("\"dataversion\":\"").Append(problemDataVersion).Append("\","); ret.Append("\"timelimit\":\"").Append(timeLimit.ToString()).Append("\","); ret.Append("\"memorylimit\":\"").Append(memoryLimit.ToString()).Append("\","); ret.Append("\"language\":\"").Append(solution.LanguageType.Type).Append("[]\","); ret.Append("\"sourcecode\":\"").Append(JsonEncoder.JsonEncode(solution.SourceCode)).Append("\""); ret.Append("}"); } } ret.Append("]"); result = ret.ToString(); return true; } catch (System.Exception ex) { error = ex.Message; return false; } }
private void PreencherCampos(String id) { GaleriaSelecionado = new GaleriaBO().SelectById(id.ToInt32()); txtNome.Text = GaleriaSelecionado.Nome; txtDescricao.Text = GaleriaSelecionado.Descricao; }
public void AlterarTema(String nomeTema, String idTema) { Theme myTheme = (Theme)Enum.Parse(typeof(Theme), nomeTema); UsuarioLogado.Tema = new TemaVO() { Id = idTema.ToInt32(), Nome = nomeTema }; new UsuarioBO(UsuarioLogado).Salvar(); ResourceManager1.SetTheme(myTheme); }
private void PreencherCampos(String id) { TopicoSelecionado = new TopicoManualColaboradorBO().SelectById(id.ToInt32()); txtTitulo.Text = TopicoSelecionado.Titulo; txtItemManual.AllowBlank = true; txtItemManual.Hidden = true; winTopico.Height = 120; }