public string Get(int idPonto) { var repoPonto = GetServiceHelper.GetService <PontoDao>(); var ponto = repoPonto.Get(idPonto); ponto.Sincronizar = false; repoPonto.Save(ponto); var playLists = GetServiceHelper.GetService <PlayListDao>() .GetPorPontoData(idPonto) .Select(p => new { p.Id, p.Nome, p.DataInicio, p.DataFim, midias = p.PlayListsMidias.Where(m => m.Midia.Status).OrderBy(m => m.Ordem) .Select(m => new { m.IdMidia, m.Ordem, m.Midia.Nome, m.Midia.Extensao }) } ); var newObject = new { playLists, template = ponto.Template.Html, idEmpresa = ponto.Empresa.Id, logo = ponto.Empresa.Logo, ponto.Empresa.NomeAmigavel }; return(JsonConvert.SerializeObject(newObject)); }
public static void DeletarMidia(int idMidia) { var repoMidia = GetServiceHelper.GetService <MidiaDao>(); var midia = repoMidia.Get(idMidia); repoMidia.Delete(midia); }
public string AtualizarDropTemplate(int idEmpresa) { var empresa = GetServiceHelper.GetService <EmpresaDao>().Get(idEmpresa); var dropDownDataList = GetServiceHelper.GetService <TemplateDao>().GetAll(empresa); var dropDownOptions = dropDownDataList.Select(t => new { Text = t.Nome, Value = t.Id.ToString() }); return(JsonConvert.SerializeObject(dropDownOptions)); }
private void MontaDropDownEmpresas() { var dropDownDataList = GetServiceHelper.GetService <EmpresaDao>().GetAll(); var dropDownOptions = dropDownDataList.Select(t => new SelectListItem { Text = t.Nome, Value = t.Id.ToString() }); ViewBag.DropDownEmpresas = dropDownOptions; }
public ActionResult Visualizar(int?idPonto, int?idEmpresa) { if (idPonto == null || idEmpresa == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var empresa = GetServiceHelper.GetService <EmpresaDao>().Get((int)idEmpresa); return(Redirect(string.Format("~/Player/Execute/{0}/{1}", empresa.NomeAmigavel, idPonto))); }
private void MontaDropDownTemplates(Empresa empresa) { var dropDownDataList = empresa != null ? GetServiceHelper.GetService <TemplateDao>().GetAll(empresa) : GetServiceHelper.GetService <TemplateDao>().GetAll(); var dropDownOptions = dropDownDataList.Select(t => new SelectListItem { Text = t.Nome, Value = t.Id.ToString() }); ViewBag.DropDownTemplates = dropDownOptions; }
public bool VerificaParaSincronizar(int idPonto) { try { var ponto = GetServiceHelper.GetService <PontoDao>().Get(idPonto); return(ponto.Sincronizar); } catch (Exception) { return(false); } }
public ActionResult SincronizarPonto(int idPonto) { try { var repoPonto = GetServiceHelper.GetService <PontoDao>(); var ponto = repoPonto.Get(idPonto); ponto.Sincronizar = true; repoPonto.Save(ponto); return(Json("true", JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json("false", JsonRequestBehavior.AllowGet)); } }
public static Midia SalvarMidia(HttpPostedFile file, Empresa empresa) { var newMidia = new Midia { IdEmpresa = empresa.Id, Nome = Path.GetFileNameWithoutExtension(file.FileName).Replace(" ", "_"), Status = true, Extensao = Path.GetExtension(file.FileName), Tamanho = file.ContentLength }; var midia = GetServiceHelper.GetService <MidiaDao>().Save(newMidia); midia.Nome = string.Format("{0}_{1}", midia.Nome, midia.Id); return(GetServiceHelper.GetService <MidiaDao>().Save(newMidia)); }
// // GET: /Player/ public ActionResult Execute(string empresa, int idPonto) { if (string.IsNullOrEmpty(empresa)) { return(View("Error")); } var oEmpresa = GetServiceHelper.GetService <EmpresaDao>().GetPorNomeAmigavel(empresa); if (oEmpresa == null) { return(View("Error")); } ViewBag.HiddenIdPonto = idPonto; ViewBag.HiddenNomeAmigavel = oEmpresa.NomeAmigavel; return(View()); }