public ActionResult EnviarBandeira(Int32? id, String errorMessage, String fileName)
        {
            // Primeiro deve ser verificado se houve erros ou alertas
            if (!String.IsNullOrWhiteSpace(errorMessage))
            {
                var jsonResult = ((JsonRequestResult)new JavaScriptSerializer().Deserialize(errorMessage, typeof(JsonRequestResult)));
                if (jsonResult.Message != null)
                {
                    ViewBag.ErrorMessage = errorMessage;
                }
            }
            // Pegar o Nome da Imagem enviada e Grava no ViewBag
            if (!String.IsNullOrWhiteSpace(fileName))
            {
                ViewBag.TempFile = fileName;
                ViewBag.Nome = fileName;
            }

            if (id != null && id != 0) // Update
            {
                var tempObj = new IdiomaService().GetRecords(i => i.IdIdioma == id).FirstOrDefault();
                if (tempObj != null)
                {
                    ViewBag.TempFile = tempObj.CaminhoImagem;
                    ViewBag.Nome = tempObj.Nome;
                    return View(tempObj);
                }
            }

            return View();
        }
Exemple #2
0
 public void loadLang()
 {
     try
     {
         if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "config.ini"))
         {
             this.idiomaToolStripMenuItem.DropDownItems.Clear();
             foreach (Idioma idioma in IdiomaService.getInstance().listar())
             {
                 var item = new ToolStripMenuItem();
                 item.Name    = idioma.Code;
                 item.Size    = new Size(210, 30);
                 item.Text    = idioma.Nombre;
                 item.Click  += new EventHandler(this.changeLanguage);
                 item.Checked = idioma.Code == "es";
                 this.idiomaToolStripMenuItem.DropDownItems.Add(item);
             }
         }
         else
         {
             showError(i18n().GetString("errors.1001"));
         }
     }
     catch (ProEasyException pEx)
     {
         showError(i18n().GetString("errors." + pEx.Code));
     }
     catch (Exception)
     {
         showError(i18n().GetString("errors.1"));
     }
 }
        public ActionResult ChangeLanguage()
        {
            var languages = new IdiomaService().GetIdiomas();
            ViewBag.selectedLanguage = GetCurrentSiglaIdioma();

            return PartialView(languages);
        }
        /// <summary>
        /// Listagem.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns></returns>
        public ActionResult Listagem(Int32? page)
        {
            page = page ?? 1;
            var itens = new IdiomaService().GetByPage(page.Value);

            var list = new MvcList<Idioma>(itens.Item1, page.Value, itens.Item2, Settings.QuantityRegistersPerPage);
            return PartialView(list);
        }
Exemple #5
0
 public CurriculoController(ClienteService clienteService, CursoSuperiorService cursoSuperior, CursoTecnicoService cursoTecnicoService, ExperienciaService experiencia, IdiomaService idioma, CurriculoService curriculoService)
 {
     _curriculoService     = curriculoService;
     _clienteService       = clienteService;
     _cursoSuperiorService = cursoSuperior;
     _cursoTecnicoService  = cursoTecnicoService;
     _experienciaService   = experiencia;
     _idiomaService        = idioma;
 }
Exemple #6
0
 public SearchCandidatoView()
 {
     InitializeComponent();
     _departamentoService = new DepartamentoService();
     _capacitacionService = new CapacitacionService();
     _competenciaService  = new CompetenciaService();
     _puestoService       = new PuestoService();
     _candidatoService    = new CandidatoService();
     _idiomasService      = new IdiomaService();
     //
     _puestos        = new List <Puesto>();
     _competencias   = new List <Competencia>();
     _capacitaciones = new List <Capacitacion>();
     _departamentos  = new List <Departamento>();
     _idiomas        = new List <Idioma>();
 }
Exemple #7
0
 public CandidatoView()
 {
     InitializeComponent();
     _idiomas = new List <Idioma>();
     _puestos = new List <Puesto>();
     _experienciasLaborales = new List <ExperienciaLaboral>();
     _competencias          = new List <Competencia>();
     _departamentos         = new List <Departamento>();
     //
     _solicitudPendiente        = new SolicitudPendienteService();
     _candidatoService          = new CandidatoService();
     _idiomaService             = new IdiomaService();
     _puestoService             = new PuestoService();
     _competenciaService        = new CompetenciaService();
     _departamentoService       = new DepartamentoService();
     _capacitacionService       = new CapacitacionService();
     _experienciaLaboralService = new ExperienciaLaboralService();
     //CurrentUser.Nombre;
 }
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var req = System.Web.HttpContext.Current.Request;

            var cookie = req.Cookies[Settings.NameSite + "culture"] ?? new HttpCookie(Settings.NameSite + "culture");
            cookie.Expires = DateTime.Now.AddYears(1);
            
            string language = null;

            if (req.QueryString["language"] != null && req.QueryString["language"] != cookie.Values["sigla"]) //change language
            {
                var sigla = req.QueryString["language"];
                var lang = new IdiomaService().GetRecords(x => x.Sigla == sigla && x.IsAtivo).FirstOrDefault();
                cookie.Values["id"] = lang.IdIdioma.ToString();
                cookie.Values["sigla"] = sigla;
                System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
            }

            if (string.IsNullOrWhiteSpace(cookie.Value)) //get default language
            {
                var lang = new IdiomaService().GetRecords(x => x.IsAtivo && x.IsPadrao).FirstOrDefault();
                if (lang != null)
                {
                    cookie.Values["id"] = lang.IdIdioma.ToString();
                    cookie.Values["sigla"] = lang.Sigla;
                    System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
                }
            }

            if (cookie.Value != null) //check if there is a language in cookie
            {
                language = cookie.Values["sigla"];
            }

            //Start language
            if (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName != language)
                Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(language);

            //base.OnActionExecuting(filterContext);
        }
        /// <summary>
        /// Returns a view for a "New Product"
        /// </summary>
        /// <returns></returns>
        public ActionResult Novo()
        {
            //Instância das Controllers
            var marcaController = new MarcaController();
            var linhaController = new LinhaController();

            //Instância das Services
            var categoriaService = new CategoriaService();
            var aplicacaoService = new AplicacaoService();
            var idiomaService = new IdiomaService();
            var tipoService = new TipoProdutoService();
            
            //GetAll
            var getAllAplicacoes = aplicacaoService.GetAll();
            var getAllCategorias = categoriaService.GetCategoriesAddMasterCateg();



            var getAllIdiomas = idiomaService.GetAll();
            var getAllTipos = tipoService.GetAll();

            //Adicionando SelectListItens na ViewBag
            ViewBag.Marks = marcaController.GetMarkSelectListItem(new MarcaService().GetAll(), null);
            ViewBag.Lines =
                linhaController.GetLineSelectListItem(new LinhaService()
                                                          .GetAll(), null).OrderBy(x => x.Text).ToList();
            //ViewBag.Skins = tipoPeleController.GetSkinTypeSelectListItem(new TipoPeleService().GetAll(), null);
            ViewBag.Categories = GetProdCategoryListItem(getAllCategorias, null);
            ViewBag.Applications = GetProdAppListItem(getAllAplicacoes, null);
            ViewBag.Types = GetProdTypesListItem(getAllTipos, null);
            ViewBag.Idiomas = getAllIdiomas;
            
            //Adicionando valores selecionados na ViewBag - NULL pois é novo Registro
            ViewBag.selApplications = null;
            ViewBag.selCategories = null;
            ViewBag.selTypes = null;

            return View();
        }
Exemple #10
0
 public HomeController()
 {
     IdiomaService = IdiomaService.GetInstance();
 }
Exemple #11
0
 public IdiomaView()
 {
     InitializeComponent();
     _idiomaService = new IdiomaService();
 }
Exemple #12
0
 public ConfiguracaoController()
 {
     IdiomaService = IdiomaService.GetInstance();
 }
 /// <summary>
 /// Editar the specified id.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <returns></returns>
 public ActionResult Editar(Int32 id)
 {
     var tempObj = new IdiomaService().GetRecords(i => i.IdIdioma == id).FirstOrDefault();
     return View(tempObj);
 }
        public ActionResult EnviarBandeira(Int32 idIdioma, String tempFile)
        {
            var jsonResult = new JsonRequestResult();
            try
            {
                // Verifica os Diretorios
                VerifyDirectories(TipoArquivo.Imagem);

                // Verifica se foi postado alguma coisa
                if (Request.Files.Count > 0)
                {
                    foreach (String file in Request.Files)
                    {
                        var postedFile = Request.Files[file];
                        if (postedFile != null && postedFile.ContentLength > 0)
                        {
                            // Verifica a extensão
                            if (!HasExtension(TipoArquivo.Imagem, postedFile.FileName))
                            {
                                jsonResult.Message = String.Format(Constants._msgUnauthorizedExtension, Path.GetExtension(postedFile.FileName), Settings.ImgAllowedExtensions);
                                jsonResult.ResultType = JsonRequestResultType.Alert;
                            }

                            // Verifica o Tamanho do Arquivo
                            if (!VerifyFileSize(postedFile.ContentLength))
                            {
                                jsonResult.Message = String.Format(Constants._msgFileSizeExceeded, Settings.MaxFileSize);
                                jsonResult.ResultType = JsonRequestResultType.Alert;
                            }

                            // Arquivo temporário
                            tempFile = Path.GetFileName(String.Format("imgFlag{0}{1}", Path.GetFileNameWithoutExtension(postedFile.FileName), Path.GetExtension(postedFile.FileName)));
                            var completePathFromServer = Path.Combine(Server.MapPath(Settings.UrlGalleryFlags), tempFile);

                            // Verificar se existe arquivo com mesmo Nome e o elimina
                            if (System.IO.File.Exists(completePathFromServer))
                            {
                                System.IO.File.Delete(completePathFromServer);
                            }

                            // Salva o arquivo no Disco do Servidor
                            postedFile.SaveAs(completePathFromServer);

                            // Atualiza Objeto
                            if (idIdioma != 0)
                            {
                                var tempObj = new IdiomaService().GetRecords(i => i.IdIdioma == idIdioma).FirstOrDefault();
                                if (tempObj != null)
                                {
                                    tempObj.CaminhoImagem = tempFile;
                                    new IdiomaService().UpdateIdioma(tempObj);
                                }
                            }
                        }
                        else
                        {
                            jsonResult.Message = Constants._msgFileNotFound;
                            jsonResult.ResultType = JsonRequestResultType.Alert;
                        }
                    }
                }
                else
                {
                    jsonResult.Message = Constants._msgFileNotFound;
                    jsonResult.ResultType = JsonRequestResultType.Alert;
                }
            }
            catch (Exception ex)
            {
                LogService.Log("UploadController.EnviarBandeira()", ex);

                jsonResult.Message = Constants._msgError;
                jsonResult.Description = CustomException.GetInnerException(ex).Message;
                jsonResult.ResultType = JsonRequestResultType.Error;
            }
            // Serializará o JsonResult para ser exibido em um Alert do sistema
            var dict = new JavaScriptSerializer().Serialize(jsonResult);
            return RedirectToAction("EnviarBandeira",
                                    new RouteValueDictionary(
                                        new
                                        {
                                            controller = "Upload",
                                            action = "EnviarBandeira",
                                            id = idIdioma,
                                            errorMessage = dict,
                                            fileName = tempFile
                                        }));
        }
        /// <summary>
        /// Returns a view to edit a product
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Editar(int id)
        {
            //Retorna o produto
            var produto = new ProdutoService().GetById(id);

            //Instância das Controllers
            var marcaController = new MarcaController();
            var linhaController = new LinhaController();
            var tipoPeleController = new TipoPeleController();

            //Instância das Services
            var categoriaService = new CategoriaService();
            var aplicacaoService = new AplicacaoService();
            var idiomaService = new IdiomaService();
            var produtoCategoriaService = new ProdutoCategoriaService();
            var produtoAplicacaoService = new ProdutoAplicacaoService();
            var produtoTipoService = new ProdutoTipoProdutoService();
            var tipoService = new TipoProdutoService();

            //GetAll
            var getAllAplicacoes = aplicacaoService.GetAll();
            var getAllCategorias = categoriaService.GetCategoriesAddMasterCateg();
            var getAllIdiomas = idiomaService.GetAll();
            var getAllTipos = tipoService.GetAll();

            //GetByProductId
            var getAllProdutoCategorias = produtoCategoriaService.GetRecords(x => x.IdProduto == produto.IdProduto);
            var getAllProdutoAplicacoes = produtoAplicacaoService.GetRecords(x => x.IdProduto == produto.IdProduto);
            var getAllProdutoTipos = produtoTipoService.GetRecords(x => x.IdProduto == produto.IdProduto);
            
            //Adicionando SelectListItens na ViewBag
            ViewBag.Marks = marcaController.GetMarkSelectListItem(new MarcaService().GetAll(), null);
            ViewBag.Lines = linhaController.GetLineSelectListItem(new LinhaService().GetAll(), null);
            ViewBag.Skins = tipoPeleController.GetSkinTypeSelectListItem(new TipoPeleService().GetAll(), null);
            ViewBag.Categories = GetProdCategoryListItem(getAllCategorias, null);
            ViewBag.Applications = GetProdAppListItem(getAllAplicacoes, produto.IdProduto);
            ViewBag.Types = GetProdTypesListItem(getAllTipos, null);
            ViewBag.Idiomas = getAllIdiomas;

            //Adicionando valores selecionados na ViewBag
            ViewBag.selApplications = CreateApplicationsSelectedList(getAllAplicacoes,
                                                                     getAllProdutoAplicacoes);

            ViewBag.selCategories = CreateCategoriesSelectedList(getAllCategorias,
                                                                 getAllProdutoCategorias);

            ViewBag.selTypes = CreateTypesSelectedList(getAllTipos,
                                                     getAllProdutoTipos);

            return View(produto);
        }