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));
        }
Example #2
0
        public static void DeletarMidia(int idMidia)
        {
            var repoMidia = GetServiceHelper.GetService <MidiaDao>();
            var midia     = repoMidia.Get(idMidia);

            repoMidia.Delete(midia);
        }
Example #3
0
        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));
        }
Example #4
0
        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;
        }
Example #5
0
        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)));
        }
Example #6
0
        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);
            }
        }
Example #8
0
        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));
            }
        }
Example #9
0
        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));
        }
Example #10
0
        //
        // 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());
        }