Пример #1
0
    private void AddLanguage()
    {
        List <Language> lstLanguage      = LocalizationSqlDataProvider.GetPortalLanguages(PortalID);
        List <Language> lstLanguageFlags = LocaleController.AddNativeNamesToList(AddFlagPath(LocalizationSqlDataProvider.GetPortalLanguages(PortalID), GetApplicationName));

        if (lstLanguage.Count < 1 || lstLanguageFlags.Count < 1)
        {
            languageSetting.Visible = false;
        }
        else
        {
            var query = from listlang in lstLanguage
                        join listflag in lstLanguageFlags
                        on listlang.LanguageCode equals listflag.LanguageCode
                        select new
            {
                listlang.LanguageCode,
                listflag.FlagPath
            };
            StringBuilder ddlLanguage = new StringBuilder();
            string        cultureCode = GetCurrentCulture();
            ddlLanguage.Append("<ul id='languageSelect' class='sfListmenu'");
            ddlLanguage.Append("'>");
            foreach (var item in query)
            {
                if (item.LanguageCode == cultureCode)
                {
                    ddlLanguage.Append("<li value=\"" + item.LanguageCode + "\" class='languageSelected'>");
                    ddlLanguage.Append(item.LanguageCode + "-" + "<img src=\"" + item.FlagPath + "\">");
                    ddlLanguage.Append("</li>");
                }
                else
                {
                    ddlLanguage.Append("<li value=\"" + item.LanguageCode + "\">");
                    ddlLanguage.Append(item.LanguageCode + "-" + "<img src=\"" + item.FlagPath + "\">");
                    ddlLanguage.Append("</li>");
                }
            }
            ddlLanguage.Append("</ul>");
            languageSetting.Text = ddlLanguage.ToString();
        }
    }
        public void GetLanguageList()
        {
            string          mode = languageMode == "Native" ? "NativeName" : "LanguageName";
            List <Language> lstAvailableLocales = LocaleController.AddNativeNamesToList(LocalizationSqlDataProvider.GetAvailableLocales());

            ddlDefaultLanguage.DataSource     = lstAvailableLocales;
            ddlDefaultLanguage.DataTextField  = mode;
            ddlDefaultLanguage.DataValueField = "LanguageCode";
            ddlDefaultLanguage.DataBind();
            ddlDefaultLanguage.SelectedIndex = ddlDefaultLanguage.Items.IndexOf(ddlDefaultLanguage.Items.FindByValue(ViewState["SelectedLanguageCulture"].ToString()));
            ViewState["RowCount"]            = lstAvailableLocales.Count;
        }
 protected void AddToDataBase(Language objLang)
 {
     objLang.FallBackLanguage     = Thread.CurrentThread.CurrentCulture.EnglishName;
     objLang.FallBackLanguageCode = Thread.CurrentThread.CurrentCulture.ToString();
     LocalizationSqlDataProvider.AddLanguage(objLang);
 }
Пример #4
0
    private void LoadFlags(List <LanguageSwitchKeyValue> lstSetting)
    {
        List <Language> lstLanguage = LocaleController.AddNativeNamesToList(AddFlagPath(LocalizationSqlDataProvider.GetPortalLanguages(PortalID), GetApplicationName));

        BindFlags(lstLanguage, lstSetting);
    }
    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;
        }
    }