Exemplo n.º 1
0
        public void BindLanguageList()
        {
            try
            {
                string          mode                = languageMode == "Native" ? "NativeName" : "LanguageName";
                List <Language> lstAllCultures      = LocaleController.GetCultures();
                List <Language> lstAvailableLocales = LocalizationSqlDataProvider.GetAvailableLocales();
                List <Language> filterLocales       = FilterLocales(lstAllCultures, lstAvailableLocales);
                ddlLanuage.DataSource = filterLocales;
                // .OrderBy(item => mode);
                //ddlLanuage.DataTextField = mode;
                //ddlLanuage.DataValueField = "LanguageCode";
                ddlLanuage.DataBind();

                //List<ListItem> listCopy = new List<ListItem>();
                //foreach (ListItem item in ddlLanuage.Items)
                //    listCopy.Add(item);
                //ddlLanuage.Items.Clear();
                //foreach (ListItem item in listCopy.OrderBy(item => item.Text))
                //    ddlLanuage.Items.Add(item);
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Exemplo n.º 2
0
    public static List <Language> GetCountryList()
    {
        List <Language> lstLanguage = LocaleController.GetCultures();

        foreach (Language obj in lstLanguage)
        {
            obj.LanguageCode = obj.LanguageCode.Substring(0, obj.LanguageCode.IndexOf("-"));
        }

        return(lstLanguage);
    }
Exemplo n.º 3
0
    public void CheckAndAddLanguageToDatabase()
    {
        List <Language> lstAvailableLocales = LocalizationSqlDataProvider.GetAvailableLocales();
        List <Language> lstAllLocales       = LocaleController.GetCultures();
        int             index = lstAvailableLocales.FindIndex(delegate(Language obj){ return(obj.LanguageCode == GetLocaleFromZipFileName()); });

        if (index < 0)
        {
            int localeIndex = lstAllLocales.FindIndex(delegate(Language obj) { return(obj.LanguageCode == GetLocaleFromZipFileName()); });
            AddToDataBase(lstAllLocales[localeIndex]);
        }
    }
Exemplo n.º 4
0
 public void BindLanguageList()
 {
     try
     {
         string          mode                = languageMode == "Native" ? "NativeName" : "LanguageName";
         List <Language> lstAllCultures      = LocaleController.GetCultures();
         List <Language> lstAvailableLocales = LocalizationSqlDataProvider.GetAvailableLocales();
         List <Language> filterLocales       = FilterLocales(lstAllCultures, lstAvailableLocales);
         ddlLanuage.DataSource = filterLocales;
         ddlLanuage.DataBind();
         ddlLanuage.SelectedValue = GetCurrentCulture();
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
    public void GetLocale()
    {
        List <string> localeList = new List <string>();

        localeList = GetLocaleList("~/Modules", ".resx", localeList);
        localeList = GetLocaleList("~/Modules", ".js", localeList);
        localeList = GetLocaleList("~/Modules", ".xml", localeList);
        localeList = GetLocaleList("~/XMLMessage", ".xml", localeList);
        localeList = GetLocaleList("~/Sagin", ".resx", localeList);
        localeList = GetLocaleList("~/Controls", ".resx", localeList);
        localeList = GetLocaleList("~/js/SystemLocale", ".js", localeList);

        List <string>   localeListWihoutDuplicates = localeList.Distinct().ToList();
        List <Language> lstAllCultures             = LocaleController.GetCultures();
        List <Language> lstNewCulture = new List <Language>();

        foreach (string locale in localeListWihoutDuplicates)
        {
            int index = lstAllCultures.FindIndex(delegate(Language obj) { return(obj.LanguageCode == locale); });
            if (index > -1)
            {
                lstNewCulture.Add(lstAllCultures[index]);
            }
        }
        List <Language> lstAvailableLocales = LocaleController.AddNativeNamesToList(LocalizationSqlDataProvider.GetAvailableLocales());

        ddlResourceLocale.DataSource     = lstAvailableLocales;
        ddlResourceLocale.DataTextField  = "LanguageName";
        ddlResourceLocale.DataValueField = "LanguageCode";
        ddlResourceLocale.DataBind();

        List <ListItem> listCopy = new List <ListItem>();

        foreach (ListItem item in ddlResourceLocale.Items)
        {
            listCopy.Add(item);
        }
        ddlResourceLocale.Items.Clear();
        foreach (ListItem item in listCopy.OrderBy(item => item.Text))
        {
            ddlResourceLocale.Items.Add(item);
        }
    }
Exemplo n.º 6
0
    public void LoadAllCultures()
    {
        string          mode                = languageMode == "Native" ? "NativeName" : "LanguageName";
        List <Language> lstAllCultures      = LocaleController.GetCultures();
        List <Language> lstAvailableLocales = LocalizationSqlDataProvider.GetAvailableLocales();
        List <Language> filterLocales       = FilterLocales(lstAllCultures, lstAvailableLocales);

        ddlLanguage.DataSource     = filterLocales.OrderBy(item => mode);
        ddlLanguage.DataTextField  = mode;
        ddlLanguage.DataValueField = "LanguageCode";
        ddlLanguage.DataBind();

        List <ListItem> listCopy = new List <ListItem>();

        foreach (ListItem item in ddlLanguage.Items)
        {
            listCopy.Add(item);
        }
        ddlLanguage.Items.Clear();
        foreach (ListItem item in listCopy.OrderBy(item => item.Text))
        {
            ddlLanguage.Items.Add(item);
        }
    }
    public void GetUserDetails()
    {
        try
        {
            UserProfileInfo objinfo = new UserProfileInfo();
            objinfo = UserProfileController.GetProfile(GetUsername, GetPortalID);
            string UserImage = Server.MapPath("~/Modules/Admin/UserManagement/UserPic/");
            if (!Directory.Exists(UserImage))
            {
                Directory.CreateDirectory(UserImage);
            }
            if (objinfo != null)
            {
                string[] Emails = objinfo.Email.Split(',');
                if (objinfo.Image != "")
                {
                    imgUser.ImageUrl = "~/Modules/Admin/UserManagement/UserPic/" + objinfo.Image;
                }
                else
                {
                    imgUser.ImageUrl = "~/Modules/Admin/UserManagement/UserPic/NoImage.png";
                }
                imgUser.Visible        = true;
                imgProfileEdit.Visible = true;

                Session[SessionKeys.SageFrame_UserProfilePic] = objinfo.Image;

                //else
                //{
                //    imgUser.Visible = false;
                //    imgProfileEdit.Visible = false;
                //}
                string          mode                = "LanguageName";// "NativeName" : "LanguageName";
                List <Language> lstAllCultures      = LocaleController.GetCultures();
                List <Language> lstAvailableLocales = LocalizationSqlDataProvider.GetAvailableLocales();

                lblDisplayUserName.Text = objinfo.UserName;
                txtFName.Text           = objinfo.FirstName;
                txtLName.Text           = objinfo.LastName;
                txtFullName.Text        = objinfo.FullName;
                txtLocation.Text        = objinfo.Location;
                txtAboutYou.Text        = objinfo.AboutYou;
                txtEmail1.Text          = Emails[0];
                txtBirthDate.Text       = (objinfo.BirthDate.ToShortDateString() == falseDate || objinfo.BirthDate.ToShortDateString() == defaultDate) ? "" : objinfo.BirthDate.ToShortDateString();
                rdbGender.SelectedIndex = objinfo.Gender;
                if (Emails.Length == 3)
                {
                    //txtEmail2.Text = Emails[1];
                }
                if (Emails.Length == 4)
                {
                    //txtEmail2.Text = Emails[1];
                    //txtEmail3.Text = Emails[2];
                }
                txtResPhone.Text = objinfo.ResPhone;

                txtMobile.Text = objinfo.Mobile != string.Empty ? objinfo.Mobile : txtMobile.Text = string.Empty;
                //txtMobile.Text = objinfo.Mobile;
                txtOthers.Text = objinfo.Others;
            }
        }
        catch (Exception)
        {
            throw;
        }
    }