| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using NEducation.Code;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Threading;
- using System.Web;
- using System.Web.Mvc;
- using System.Web.Services.Description;
- namespace NEducation.Controllers
- {
- public class LanguageController : Controller
- {
- // GET: Language
- public ActionResult Index()
- {
- return View();
- }
- private static log4net.ILog log { get; set; } = log4net.LogManager.GetLogger(typeof(HomeController));
- public ActionResult ChangeLanguage(String LanguageAbbrevation)
- {
- System.Diagnostics.Debug.WriteLine("LanguageAbbrevation: " + LanguageAbbrevation);
- if (LanguageAbbrevation != null)
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(LanguageAbbrevation);
- Thread.CurrentThread.CurrentUICulture = new CultureInfo(LanguageAbbrevation);
- }
- String mMsisdn = Session["msisdn"] as String;
- String lang = "1";
- if (LanguageAbbrevation == "en")
- {
- lang = "0";
- }
-
- SetLanguageRequest reqStatus = new SetLanguageRequest {
- users = mMsisdn,
- language = lang
- };
- string rsStatus = UtilsController.SendPost(reqStatus, Session.SessionID, UtilsController.WsType.usersSetLanguage);
- SetLanguageResult resStatus = new SetLanguageResult(rsStatus);
- if (resStatus.status == UtilsController.Constant.SUCCESS)
- {
- log.Debug("ChangeLanguage_SUCCESS");
- }
- else
- {
- log.Debug("ChangeLanguage_Faild");
- }
- Response.Cookies.Remove("Language");
- HttpCookie cookie = new HttpCookie("Language");
- cookie.Value = LanguageAbbrevation;
- Response.Cookies.Add(cookie);
- return Json(new
- {
- });
- }
- }
- }
|