public ActionResult RegisterViaTFC() { if (!Request.Cookies.AllKeys.Contains("version")) return RedirectToAction("Register", "User"); if (MyUtility.isUserLoggedIn()) { if (TempData["TFCnowCustomer"] != null) return RedirectToAction("ListEntitlements", "Migration"); return RedirectToAction("Index", "Home"); } var userHostAddress = Request.GetUserHostAddressFromCloudflare(); var context = new IPTV2Entities(); // Remove EU ME --- var ExcludedCountriesFromRegistrationDropDown = GlobalConfig.ExcludedCountriesFromRegistrationDropDown.Split(','); List<Country> countries = null; if (GlobalConfig.UseCountryListInMemory) { if (GlobalConfig.CountryList != null) countries = GlobalConfig.CountryList.Where(c => !ExcludedCountriesFromRegistrationDropDown.Contains(c.Code)).OrderBy(c => c.Description).ToList(); else countries = context.Countries.Where(c => !ExcludedCountriesFromRegistrationDropDown.Contains(c.Code)).OrderBy(c => c.Description).ToList(); } else countries = context.Countries.Where(c => !ExcludedCountriesFromRegistrationDropDown.Contains(c.Code)).OrderBy(c => c.Description).ToList(); ViewBag.ListOfCountries = countries; //Get User Country by Ip var country = MyUtility.getCountry(userHostAddress); int stateCount = 0; if (country != null) { var userCountry = country.getCode(); if (String.IsNullOrEmpty(userCountry) || userCountry == "--") userCountry = GlobalConfig.DefaultCountry; var uCountry = context.Countries.FirstOrDefault(c => c.Code == userCountry); ViewBag.UserCountry = uCountry; ViewBag.IsConnectedToSocialNetwork = false; stateCount = context.States.Count(s => s.CountryCode == userCountry); ViewBag.StateCount = stateCount; } if (TempData["qs"] != null) { ViewBag.IsConnectedToSocialNetwork = true; NameValueCollection qs = (NameValueCollection)TempData["qs"]; TempData["qs"] = qs; if (!String.IsNullOrEmpty(qs["UID"])) ViewBag.isConnectedToGigya = true; //Connected to Gigya. Get userInfo on View. Fill registrationSocial with userInfo from social network. SignUpModel model = new SignUpModel(); model.Email = (String.IsNullOrEmpty(qs["email"])) ? String.Empty : HttpUtility.UrlDecode(qs["email"]); model.FirstName = (String.IsNullOrEmpty(qs["firstName"])) ? String.Empty : HttpUtility.UrlDecode(qs["firstName"]); model.LastName = (String.IsNullOrEmpty(qs["lastName"])) ? String.Empty : HttpUtility.UrlDecode(qs["lastName"]); model.CountryCode = (String.IsNullOrEmpty(qs["country"])) ? String.Empty : HttpUtility.UrlDecode(qs["country"]); return View(model); } else { if (TempData["TFCnowCustomer"] != null) { Customer customer = (Customer)TempData["TFCnowCustomer"]; if (customer != null) { TempData["TFCnowCustomer"] = customer; SignUpModel model = new SignUpModel(); model.Email = customer.EmailAddress; model.FirstName = customer.FirstName; model.LastName = customer.LastName; return View(model); } } } return View(); }
private int setUserData(string uid, User user) { SignUpModel usr = new SignUpModel() { City = user.City, CountryCode = user.CountryCode, Email = user.EMail, FirstName = user.FirstName, LastName = user.LastName, State = user.State }; Dictionary<string, object> collection = new Dictionary<string, object>(); collection.Add("uid", uid); collection.Add("data", JsonConvert.SerializeObject(usr, Formatting.None)); //gcs.setUserData //GSResponse res = GigyaHelpers.createAndSendRequest("gcs.setUserData", GigyaHelpers.buildParameter(collection)); GSResponse res = GigyaHelpers.createAndSendRequest("ids.setAccountInfo", GigyaHelpers.buildParameter(collection)); return res.GetErrorCode(); }