Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String langCode = "";
        string Lang;
        Dictionary<String, String> langs = Dicionario.getLangs();
        if (Request.UserLanguages != null)
        {
            Lang = Request.UserLanguages[0];
            foreach (String lc in langs.Keys)
            {
                if (Lang.Contains(lc))
                {
                    langCode = lc;
                    break;
                }
            }
        }
        if (langCode == "")
            langCode = "en";

        Dicionario dic = new Dicionario(langCode);

        Page.Title = dic.getResource(81);

        Content.InnerHtml = Server.HtmlDecode(dic.getResource(76));
    }
Exemplo n.º 2
0
 protected void DDLangs_SelectedIndexChanged(object sender, EventArgs e)
 {
     CurrDicionario = new Dicionario(DDLangs.SelectedValue);
     initListIDs();
     txtTexto.Text =  CurrDicionario.getResource(CurrID);
     Session.Add("_CurrDic", CurrDicionario);
 }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Users theUser;
        Utility.theServer = Server;

        #if AUTO_LOGIN
        theUser = Users.validateUser("JCanhoto", "IceCube1");
        Utility.theUser = theUser;
        Utility.userAccount = Account.getMyAccount(theUser.AccountID, theUser.signature);
        Utility.theDictionary = new Dicionario(Lang.getLang(Utility.userAccount.IdiomaID).langCode);
        //Utility.theDictionary.initTranslateTO("6"); // inicializa a tradução para Mexicano
        Utility.setValidationLang(Utility.theDictionary.currLang);
        ScriptManager.RegisterStartupScript(this, typeof(String), "langValidation", Utility.validationJSLib, false);
        RedirectToStartPage();
        #endif

        #if AUTO_LOGIN_TEMPLATE
        theUser = Users.validateUser("TEMPLATE", "newallo");
        Utility.theUser = theUser;
        Utility.userAccount = Account.getMyAccount(theUser.AccountID, theUser.signature);
        Utility.theDictionary = new Dicionario(Lang.getLang(Utility.userAccount.IdiomaID).langCode);
        //Utility.theDictionary.initTranslateTO("6"); // inicializa a tradução para Mexicano
        Utility.setValidationLang(Utility.theDictionary.currLang);
        ScriptManager.RegisterStartupScript(this, typeof(String), "langValidation", Utility.validationJSLib, false);
        RedirectToStartPage();
        #endif

        dic = Utility.theDictionary;

        errorMessageBox.Visible = false;
        loginScreen.Visible = true;
        resetPassword.Visible = false;

        if (IsPostBack)
        {
            if (Session["SIBOResetPassword"] != null)
            {
                // quer dizer que temos de verificar e guardar a nova password
                if (txtNewPassword1.Text != txtNewPassword2.Text)
                {
                    errorMessageBox.Visible = true;
                    errorMessageBox.InnerHtml = String.Format("<p>{0}</p>", dic.getResource(253));
                    loginScreen.Visible = false;
                    resetPassword.Visible = true;
                }
                else
                {
                    Users.setUserPassword(Utility.theUser.userID, txtNewPassword1.Text);
                    theUser = Users.validateUser(txtUserName.Text, txtNewPassword1.Text);
                    Utility.theUser = theUser;
                    // goto Dashboard
                    Utility.userAccount = Account.getMyAccount(theUser.AccountID, theUser.signature);

                    Utility.theUser = theUser;
                    Utility.userAccount = Account.getMyAccount(theUser.AccountID, theUser.signature);
                    Utility.theDictionary = new Dicionario(Lang.getLang(Utility.userAccount.IdiomaID).langCode);
                    Utility.setValidationLang(Utility.theDictionary.currLang);
                    ScriptManager.RegisterStartupScript(this, typeof(String), "langValidation", Utility.validationJSLib, false);

                    Session.Remove("SIBOResetPassword");
                    RedirectToStartPage();
                }
            }
            else
            {
                registerTry();
                if (countTry > 5)
                    Response.Redirect("~/GenericError.aspx");
                // valida o user extended e coloca em sessão
                if ((theUser = Users.validateUser(txtUserName.Text, txtPassword.Text)) != null)
                {
                    if (theUser.resetPassword == 1)
                    {
                        errorMessageBox.Visible = true;
                        errorMessageBox.InnerHtml = String.Format("<p>{0}</p>", dic.getResource(251));
                        Session.Add("SIBOResetPassword", 1);
                        Utility.theUser = theUser;
                        loginScreen.Visible = false;
                        resetPassword.Visible = true;

                    }
                    else
                    {
                        // Context.Session.Add("theSIUser", theUser);
                        Utility.theUser = theUser;
                        // goto Dashboard
                        Utility.userAccount = Account.getMyAccount(theUser.AccountID, theUser.signature);
                        Utility.theDictionary = new Dicionario(Lang.getLang(Utility.userAccount.IdiomaID).langCode);
                        Utility.setValidationLang(Utility.theDictionary.currLang);
                        ScriptManager.RegisterStartupScript(this, typeof(String), "langValidation", Utility.validationJSLib, false);
                        Session.Remove("SIBOResetPassword");
                        RedirectToStartPage();
                    }
                }
                else
                {
                    // caso de erro mensagem de erro visivel
                    errorMessageBox.Visible = true;
                    errorMessageBox.InnerHtml = String.Format("<p>{0}</p>", dic.getResource(191));
                }
            }
        }
        else {
            countTry = 0;
        }

        Utility.setValidationLang(Utility.theDictionary.currLang);
        ScriptManager.RegisterStartupScript(this, typeof(String), "langValidation", Utility.validationJSLib, false);
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // ver se está em manutenção
        List<String> paraRemover = new List<string>(); ;

        // limpar todas as variáveis de sessão
        foreach(String key in Session.Keys)
        {
            if (!key.StartsWith("SIBO"))
                paraRemover.Add(key);
        }
        foreach (String key in paraRemover)
            Session.Remove(key);

        // checkin passa a ser por aqui que todos os clientes vão entrar
        // actualmente dispomos de vários modelos de resposta que estão
        // dependentes do tipo, quantidade e características dos tickets

        // 1. VALIDAR O TICKET
        if (Request["ticket"] != null)
        {
            TheStrTicket = Request["ticket"];
            getTicketList();
            // actualmente existem os seguintes tipos de ticket:
            // SURVEY - Questionário genérico sobre diferentes temas
            // NULL (é o 360)
            // PERS - Teste Personalístico
            // CULTURA - Feito à medida e preferencialmente será descontinuado,
            // sendo substituido pelo SURVEY
            // MANAGER - Ticket de gestor de Projecto - Usado para acompanhamento do projecto

            // 2. OBTER INFORMAÇÕES SOBRE O PROJECTO DO TICKET APRESENTADO
            getProjectInfo();

            // 2.2 OBTER INFORMAÇÃO SOBRE O IDIOMA
            String langCode;
            if (ticketList[0].LangCode != null)
            {
                langCode = ticketList[0].LangCode;

            }
            else if (projecto.defaultLangCode != null)
            {
                langCode = projecto.defaultLangCode;
            }
            else if (projecto.defaultLangCode != null && projecto.defaultLangCode.Trim() == "")
            {
                langCode = "pt";
            }
            else
            {
                langCode = "pt";
            }

            DBHelper.CurrentLangCode = langCode.Trim();

            Dicionario dic = new Dicionario(langCode.Trim());
            Session.Add("Dicionario", dic);

            // se o lang code seleccionado é diferente do langcode do projecto, então temos de
            // carregar o prejecto traduzido e passar a user sempre esse projecto

            // 2.5 Não tem dados sobre o próprio
            // então redirecciona para a página de dados demográficos
            // TODO permitir a configuração desta página (dados demográficos) através da gestão de projecto
            if (proprio.PessoaID == 0)
                Response.Redirect("FO_Demografics.aspx");

            // 3. Analisando o tipo de ticket, o número de tickets para esta pessoa neste projecto,
            // as características do próprio, e o projecto
            // deverá ser possível determinar o percurso dele ao longo da sua estadia no sistema
            // vamos carregar alguma dessa informação em sessão para utilização ao longo da aplicação

            // 3.1 obter outros ticket neste contexto
            List<Ticket> TMP_listaTickets = Ticket.getAllTickets(proprio.PessoaID, projecto.ProjectoID, projecto.owner);

            // 3.2 tem um ou mais ?
            if (TMP_listaTickets.Count > 1 && !isManager)
                analisaVariosTickets(TMP_listaTickets);
            else
                analisaUmTicket();
        }
        else
        {
            // setup the chekin screen
            String langCode = "";
            if (Request.UserLanguages != null)
            {
                string Lang = Request.UserLanguages[0];
                Dictionary<String, String> langs = Dicionario.getLangs();
                foreach (String lc in langs.Keys)
                {
                    if (Lang == lc)
                    {
                        langCode = lc;
                        break;
                    }
                }
            }

            if (langCode == "" && Request.UserLanguages != null)
            {
                string Lang = Request.UserLanguages[0];
                Dictionary<String, String> langs = Dicionario.getLangs();
                foreach (String lc in langs.Keys)
                {
                    if (Lang.Contains(lc))
                    {
                        langCode = lc;
                        break;
                    }
                }

            }

            if (langCode == "")
                langCode = "en";

            Dicionario dic = new Dicionario(langCode);

            litInfo.Text = dic.getResource(118);
            botOK.Text = dic.getResource(119);

            // Utility.setValidationLang(Utility.theDictionary.currLang);
            String langSimple = langCode.Trim();
            langSimple = langSimple.Substring(0, 2);
            String path = String.Format("<script src=\"js/languages/{0}\" type=\"text/javascript\"></script>", String.Format("jquery.validationEngine-{0}.js", langSimple));
            ScriptManager.RegisterStartupScript(this, typeof(String), "langValidation", path, false);

        }
    }