public ActionResult Index() { if (Request.QueryString["teamid"] != null) { string teamid = Request.QueryString["teamid"].ToString(); Api.Team.Team _apiteam = new Api.Team.Team(); _apiteam.UpdateTeambyteamid(teamid); } if (Session["Paid_User"] != null && Session["Paid_User"].ToString() == "Unpaid") { return(RedirectToAction("Billing", "PersonalSetting")); } else { ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; #region Count Used Accounts try { User objUser = (User)Session["User"]; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); apiobjSocialProfile.GetAllSocialProfiles(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); ViewBag.AccountType = objUser.AccountType; //if (Session["GroupName"] == null) //{ // Groups objGroupDetails = objGroupRepository.getGroupDetail(user.Id); // team = objTeamRepo.getAllDetails(objGroupDetails.Id, user.EmailId); // Session["GroupName"] = team; //} //else //{ // team = (SocioBoard.Domain.Team)Session["GroupName"]; //} } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion if (Session["SocialManagerInfo"] != null) { } int ProfileCount = int.Parse(Session["ProfileCount"].ToString()); return(View(User)); // return PartialView("_HomePartial"); } }
public ActionResult Index(string teamid) { User objUser = (User)Session["User"]; if (teamid != null) { if (objUser != null) { Api.Team.Team ApiobjTeam = new Api.Team.Team(); Team objuserinfo = (Team)(new JavaScriptSerializer().Deserialize(ApiobjTeam.GetTeamById(teamid), typeof(Team))); if (objuserinfo.InviteStatus == 0) { ApiobjTeam.UpdateTeam(objUser.Id.ToString(), teamid, objUser.UserName); } Response.Redirect("../Home/Index", true); } else { //Response.Redirect("Index/Registration?teamid="+teamid +""); return(RedirectToAction("Registration", "Index", new { teamid = teamid })); } } Session["fblogin"] = null; ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; #region Count Used Accounts try { Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); apiobjSocialProfile.GetAllSocialProfiles(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion if (Session["SocialManagerInfo"] != null) { } return(View(User)); // return PartialView("_HomePartial"); }
//[CustomAuthorize] public async Task <ActionResult> Facebook(string code) { if (Session["fblogin"] != null) { if ((string)Session["fblogin"] == "fblogin") { Session["fblogin"] = null; if (String.IsNullOrEmpty(code)) { return(RedirectToAction("Index", "Index")); } Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; string facebookcode = code; string fbloginreturn = apiobjFacebook.FacebookLogin(code); string[] arrfbloginreturn = Regex.Split(fbloginreturn, "_#_"); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(arrfbloginreturn[0], typeof(Domain.Socioboard.Domain.User))); Session["AccesstokenFblogin"] = arrfbloginreturn[1]; Session["fblogin"] = "******"; try { checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false); } catch (Exception e) { checkuserexist = null; } if (checkuserexist != null) { objUser = checkuserexist; Session["User"] = checkuserexist; Session["group"] = await SBHelper.LoadGroups(objUser.Id); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary <string, string> re = await ac.GetTokenDictionary(checkuserexist.EmailId, checkuserexist.Password); Session["access_token"] = re["access_token"]; } catch (Exception e) { return(RedirectToAction("Index", "Home")); } daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion } else { Session["Paid_User"] = "******"; } ApiobjUser.UpdateLastLoginTime(checkuserexist.Id.ToString()); HttpCookie myCookie = new HttpCookie("referal_url"); myCookie = Request.Cookies["referal_url"]; if (myCookie != null) { Response.Redirect(".." + myCookie.Value); } return(RedirectToAction("Index", "Home")); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return(RedirectToAction("Registration", "Index")); } } else if ((string)Session["fblogin"] == "page") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List <Domain.Socioboard.Domain.AddFacebookPage> lstAddFacebookPage = new List <Domain.Socioboard.Domain.AddFacebookPage>(); lstAddFacebookPage = (List <Domain.Socioboard.Domain.AddFacebookPage>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookPages(code), typeof(List <Domain.Socioboard.Domain.AddFacebookPage>))); Session["fbpage"] = lstAddFacebookPage; return(RedirectToAction("Index", "Home", new { hint = "fbpage" })); } else if ((string)Session["fblogin"] == "fbgroup") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List <Domain.Socioboard.Domain.AddFacebookGroup> lstAddFacebookGroup = new List <Domain.Socioboard.Domain.AddFacebookGroup>(); lstAddFacebookGroup = (List <Domain.Socioboard.Domain.AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookGroups(code), typeof(List <Domain.Socioboard.Domain.AddFacebookGroup>))); Session["fbgrp"] = lstAddFacebookGroup; return(RedirectToAction("Index", "Home", new { hint = "fbgrp" })); } else if ((string)Session["fblogin"] == "fbplugin") { Session["fblogin"] = null; if (String.IsNullOrEmpty(code)) { return(RedirectToAction("Index", "Index", new { hint = "plugin" })); } Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); Api.User.User ApiobjUser = new Api.User.User(); string fbloginreturn = apiobjFacebook.FacebookLogin(code); string[] arrfbloginreturn = Regex.Split(fbloginreturn, "_#_"); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(arrfbloginreturn[0], typeof(Domain.Socioboard.Domain.User))); Session["AccesstokenFblogin"] = arrfbloginreturn[1]; try { checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false); } catch (Exception e) { checkuserexist = null; } if (checkuserexist != null) { objUser = checkuserexist; Session["User"] = checkuserexist; ApiobjUser.UpdateLastLoginTime(checkuserexist.Id.ToString()); } else { if (!string.IsNullOrEmpty(objUser.EmailId)) { string user = ApiobjUser.Register(objUser.EmailId, "", "Free", objUser.UserName, "1"); objUser = (Domain.Socioboard.Domain.User) new JavaScriptSerializer().Deserialize(user, typeof(Domain.Socioboard.Domain.User)); Session["User"] = objUser; } else { return(RedirectToAction("Index", "Index", new { hint = "plugin" })); } } Session["group"] = await SBHelper.LoadGroups(objUser.Id); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary <string, string> re = await ac.GetTokenDictionary(checkuserexist.EmailId, checkuserexist.Password); Session["access_token"] = re["access_token"]; } catch (Exception e) { return(RedirectToAction("Index", "Home")); } #region Count Used Accounts try { Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Session["ProfileCount"] = 0; Session["TotalAccount"] = 0; } #endregion daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { Session["Paid_User"] = "******"; } else { Session["Paid_User"] = "******"; } Session["fblogin"] = "******"; return(RedirectToAction("Index", "Home", new { hint = "plugin" })); } } else { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); apiobjFacebook.Timeout = 120 * 1000; //string AddfacebookAccount = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); string AddfacebookAccount = ""; Domain.Socioboard.Domain.FacebookAccount objfacebookAccount = new Domain.Socioboard.Domain.FacebookAccount(); try { var res_addFacebook = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); AddfacebookAccount = res_addFacebook; try { objfacebookAccount = (Domain.Socioboard.Domain.FacebookAccount) new JavaScriptSerializer().Deserialize(res_addFacebook, typeof(Domain.Socioboard.Domain.FacebookAccount)); AddfacebookAccount = objfacebookAccount.FbUserId; } catch (Exception) { } } catch (Exception) { AddfacebookAccount = "issue_access_token"; } if (AddfacebookAccount == "issue_access_token") { Response.Redirect(Helper.SBUtils.GetFacebookRedirectLink()); } else if (AddfacebookAccount == "Account already Exist !") { } else { Session["SocialManagerInfo"] = AddfacebookAccount; //To enable the Facebook Message Pop up TempData["IsFacebookAccountAdded"] = 1; TempData["FacebookAccount"] = objfacebookAccount; } } return(RedirectToAction("Index", "Home")); }
public ActionResult Youtube() { string AddYoutubeAccount = string.Empty; string AddGPlusAccount = string.Empty; Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; string code = (String)Request.QueryString["code"]; Api.Youtube.Youtube apiobjYoutube = new Api.Youtube.Youtube(); Api.GooglePlus.GooglePlus ApiobjGooglePlus = new Api.GooglePlus.GooglePlus(); Api.User.User ApiobjUser = new Api.User.User(); if (Session["googlepluslogin"] != null) { if (!string.IsNullOrEmpty(code)) { if (Session["googlepluslogin"].ToString() == "googlepluslogin") { //objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjYoutube.GoogleLogin(code), typeof(Domain.Socioboard.Domain.User))); string Googleloginreturn = apiobjYoutube.GoogleLogin(code); string[] arrgoogleloginreturn = Regex.Split(Googleloginreturn, "_#_"); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(arrgoogleloginreturn[0], typeof(Domain.Socioboard.Domain.User))); Session["AccesstokenFblogin"] = arrgoogleloginreturn[1]; Session["googlepluslogin"] = "******"; checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); if (checkuserexist != null) { Session["User"] = checkuserexist; int daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["Paid_User"] = "******"; } FormsAuthentication.SetAuthCookie(objUser.UserName, false); ApiobjUser.UpdateLastLoginTime(checkuserexist.Id.ToString()); return RedirectToAction("Index", "Home"); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return RedirectToAction("Registration", "Index"); } } else if (Session["googlepluslogin"].ToString() == "gplus") { AddGPlusAccount = ApiobjGooglePlus.AddGPlusAccount(ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"], objUser.Id.ToString(), Session["group"].ToString(), code); if (AddGPlusAccount == "Refresh Token Not Found") { AuthenticateYoutube(Session["googlepluslogin"].ToString()); } else { Session["SocialManagerInfo"] = AddGPlusAccount; } } } else { return RedirectToAction("Index", "Index"); } } else { try { AddYoutubeAccount = apiobjYoutube.AddYoutubeAccount(ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"], objUser.Id.ToString(), Session["group"].ToString(), code); if (AddYoutubeAccount == "Refresh Token Not Found") { AuthenticateYoutube(""); } else { Session["SocialManagerInfo"] = AddYoutubeAccount; } } catch (Exception ex) { Console.WriteLine(ex.Message); } } return RedirectToAction("Index", "Home"); }
public ActionResult Twitter() { var requestToken = (String)Request.QueryString["oauth_token"]; var requestSecret = (String)Session["requestSecret"]; var requestVerifier = (String)Request.QueryString["oauth_verifier"]; Api.Twitter.Twitter apiobjTwitter = new Api.Twitter.Twitter(); if ((string)Session["twitterlogin"] == "twitterlogin") { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; Api.User.User ApiobjUser = new Api.User.User(); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjTwitter.TwitterLogIn(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], requestToken, requestSecret, requestVerifier), typeof(Domain.Socioboard.Domain.User))); try { checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoForSocialLogin(objUser.SocialLogin.ToString()), typeof(Domain.Socioboard.Domain.User))); System.Web.Security.FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false); } catch (Exception e) { } if (checkuserexist != null) { Session["twitterlogin"] = null; Session["User"] = checkuserexist; int daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["Paid_User"] = "******"; } return(RedirectToAction("Index", "Home")); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return(RedirectToAction("Registration", "Index")); } } else { try { string AddTwitterAccount = string.Empty; Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; apiobjTwitter.Timeout = 120 * 1000; //AddTwitterAccount = apiobjTwitter.AddTwitterAccount(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], objUser.Id.ToString(), Session["group"].ToString(), requestToken, requestSecret, requestVerifier); Domain.Socioboard.Domain.TwitterAccount objTwitterAccount = (Domain.Socioboard.Domain.TwitterAccount) new JavaScriptSerializer().Deserialize(apiobjTwitter.AddTwitterAccount(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], objUser.Id.ToString(), Session["group"].ToString(), requestToken, requestSecret, requestVerifier), typeof(Domain.Socioboard.Domain.TwitterAccount)); AddTwitterAccount = objTwitterAccount.TwitterUserId; Session["SocialManagerInfo"] = AddTwitterAccount; //To enable the Tweet Pop up TempData["IsTwitterAccountAdded"] = 1; TempData["TwitterAccount"] = objTwitterAccount; } catch (Exception ex) { logger.Error(ex.StackTrace); } if (Session["SocialManagerInfo"] == null) { return(RedirectToAction("Index", "Home")); } } return(RedirectToAction("Index", "Home")); }
public ActionResult Facebook(string code) { if (Session["fblogin"] != null) { if ((string)Session["fblogin"] == "fblogin") { Session["fblogin"] = null; if (String.IsNullOrEmpty(code)) { return(RedirectToAction("Index", "Index")); } Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; // string facebookcode = Request.QueryString["code"].ToString(); string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); Api.User.User ApiobjUser = new Api.User.User(); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User))); try { // objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User))); checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false); } catch (Exception e) { } if (checkuserexist != null) { Session["User"] = checkuserexist; int daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["Paid_User"] = "******"; } return(RedirectToAction("Index", "Home")); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return(RedirectToAction("Registration", "Index")); } } else if ((string)Session["fblogin"] == "page") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List <Domain.Socioboard.Domain.AddFacebookPage> lstAddFacebookPage = new List <Domain.Socioboard.Domain.AddFacebookPage>(); lstAddFacebookPage = (List <Domain.Socioboard.Domain.AddFacebookPage>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookPages(code), typeof(List <Domain.Socioboard.Domain.AddFacebookPage>))); Session["fbpage"] = lstAddFacebookPage; return(RedirectToAction("Index", "Home", new { hint = "fbpage" })); } else if ((string)Session["fblogin"] == "fbgroup") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List <Domain.Socioboard.Domain.AddFacebookGroup> lstAddFacebookGroup = new List <Domain.Socioboard.Domain.AddFacebookGroup>(); lstAddFacebookGroup = (List <Domain.Socioboard.Domain.AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookGroups(code), typeof(List <Domain.Socioboard.Domain.AddFacebookGroup>))); Session["fbgrp"] = lstAddFacebookGroup; return(RedirectToAction("Index", "Home", new { hint = "fbgrp" })); } } else { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); string AddfacebookAccount = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); //string AddfacebookAccount = apiobjFacebook.AddFacebookAccountAsync(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); if (AddfacebookAccount == "issue_access_token") { Response.Redirect(Helper.SBUtils.GetFacebookRedirectLink()); } else { Session["SocialManagerInfo"] = AddfacebookAccount; //try //{ // apiobjFacebook.AddFacebookAccountWithPaginationAsync(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); //} //catch (Exception ex) //{ // logger.Error(ex.StackTrace); // logger.Error(ex.Message); //} } } return(RedirectToAction("Index", "Home")); }
//[HttpPost] public ActionResult AjaxLogin(string username, string password) { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; User objUser = new User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); string logindata = obj.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist") { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); FormsAuthentication.SetAuthCookie(objUser.UserName, false); } else { objUser = null; // Edited by Antima HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim()); myCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(myCookie); returnmsg = "Invalid Email or Password"; return Content(returnmsg); } #region Unused code //JObject profile = JObject.Parse(obj.Login(uname, pass)); //objUser.Id = Guid.Parse(profile["Id"].ToString()); //objUser.UserName = profile["UserName"].ToString(); //objUser.AccountType = profile["AccountType"].ToString(); //objUser.ProfileUrl = profile["ProfileUrl"].ToString(); //objUser.EmailId = profile["EmailId"].ToString(); //objUser.CreateDate = Convert.ToDateTime(profile["CreateDate"].ToString()); //objUser.ExpiryDate = Convert.ToDateTime(profile["ExpiryDate"].ToString()); //objUser.UserStatus = Convert.ToInt16(profile["UserStatus"].ToString()); //objUser.Password = profile["Password"].ToString(); //objUser.TimeZone = profile["TimeZone"].ToString(); //objUser.PaymentStatus = profile["PaymentStatus"].ToString(); //objUser.ActivationStatus = profile["ActivationStatus"].ToString(); //objUser.CouponCode = profile["CouponCode"].ToString(); //objUser.ReferenceStatus = profile["ReferenceStatus"].ToString(); //objUser.RefereeStatus = profile["RefereeStatus"].ToString(); //objUser.UserType = profile["UserType"].ToString(); #endregion if (objUser.UserType != "SuperAdmin") { if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { Session["User"] = objUser; returnmsg = "user"; #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } } else { returnmsg = "SuperAdmin"; Session["User"] = objUser; } return Content(returnmsg); }
//[HttpPost] public async System.Threading.Tasks.Task<ActionResult> AjaxLogin(string username, string password) { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; User objUser = new User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); HttpResponseMessage response = await WebApiReq.GetReq("api/ApiUser/Login?EmailId=" + uname + "&PasswordHash=" + SBUtils.MD5Hash(pass), "", ""); if (response.IsSuccessStatusCode) { objUser = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.User>(); if (objUser != null) { Response.Cookies.Add(FormsAuthentication.GetAuthCookie(objUser.UserName, true)); // FormsAuthentication.SetAuthCookie(objUser.UserName, false); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary<string, string> re = await ac.GetTokenDictionary(username, SBUtils.MD5Hash(pass)); Session["access_token"] = re["access_token"]; } catch (Exception e) { objUser = null; // Edited by Antima HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim()); myCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(myCookie); returnmsg = "Invalid Email or Password"; return Content(returnmsg); } if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { Session["User"] = objUser; Session["group"] = await SBHelper.LoadGroups(objUser.Id); returnmsg = "user"; #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } if (objUser.UserType == "SuperAdmin") { returnmsg = "SuperAdmin"; Session["User"] = objUser; } } } else { objUser = null; HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim()); myCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(myCookie); returnmsg = "Invalid Email or Password"; return Content(returnmsg); } return Content(returnmsg); }
public ActionResult Twitter() { var requestToken = (String)Request.QueryString["oauth_token"]; var requestSecret = (String)Session["requestSecret"]; var requestVerifier = (String)Request.QueryString["oauth_verifier"]; Api.Twitter.Twitter apiobjTwitter = new Api.Twitter.Twitter(); if ((string)Session["twitterlogin"] == "twitterlogin") { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; Api.User.User ApiobjUser = new Api.User.User(); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjTwitter.TwitterLogIn(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], requestToken, requestSecret, requestVerifier), typeof(Domain.Socioboard.Domain.User))); try { checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoForSocialLogin(objUser.SocialLogin.ToString()), typeof(Domain.Socioboard.Domain.User))); System.Web.Security.FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false); } catch (Exception e) { } if (checkuserexist != null) { Session["twitterlogin"] = null; Session["User"] = checkuserexist; int daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["Paid_User"] = "******"; } return RedirectToAction("Index", "Home"); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return RedirectToAction("Registration", "Index"); } } else { try { string AddTwitterAccount = string.Empty; Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; apiobjTwitter.Timeout = 120 * 1000; //AddTwitterAccount = apiobjTwitter.AddTwitterAccount(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], objUser.Id.ToString(), Session["group"].ToString(), requestToken, requestSecret, requestVerifier); Domain.Socioboard.Domain.TwitterAccount objTwitterAccount = (Domain.Socioboard.Domain.TwitterAccount)new JavaScriptSerializer().Deserialize(apiobjTwitter.AddTwitterAccount(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], objUser.Id.ToString(), Session["group"].ToString(), requestToken, requestSecret, requestVerifier), typeof(Domain.Socioboard.Domain.TwitterAccount)); //code to follow socioboard if (Session["FollowTwitter"] != null && Session["FollowTwitter"].ToString().Equals("true")) { Session["FollowTwitter"] = null; Socioboard.Helper.TwitterHelper.FollowAccount(objTwitterAccount.OAuthToken, objTwitterAccount.OAuthSecret, "Socioboard", ""); } //follow socioboard code end AddTwitterAccount = objTwitterAccount.TwitterUserId; Session["SocialManagerInfo"] = AddTwitterAccount; //To enable the Tweet Pop up TempData["IsTwitterAccountAdded"] = 1; TempData["TwitterAccount"] = objTwitterAccount; } catch (Exception ex) { logger.Error(ex.StackTrace); } if (Session["SocialManagerInfo"] == null) { return RedirectToAction("Index", "Home"); } } return RedirectToAction("Index", "Home"); }
public ActionResult AjaxLogin(string username, string password) { string returnmsg = string.Empty; User objUser = new User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); string logindata = obj.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist") { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); } else { objUser = null; returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } #region Unused code //JObject profile = JObject.Parse(obj.Login(uname, pass)); //objUser.Id = Guid.Parse(profile["Id"].ToString()); //objUser.UserName = profile["UserName"].ToString(); //objUser.AccountType = profile["AccountType"].ToString(); //objUser.ProfileUrl = profile["ProfileUrl"].ToString(); //objUser.EmailId = profile["EmailId"].ToString(); //objUser.CreateDate = Convert.ToDateTime(profile["CreateDate"].ToString()); //objUser.ExpiryDate = Convert.ToDateTime(profile["ExpiryDate"].ToString()); //objUser.UserStatus = Convert.ToInt16(profile["UserStatus"].ToString()); //objUser.Password = profile["Password"].ToString(); //objUser.TimeZone = profile["TimeZone"].ToString(); //objUser.PaymentStatus = profile["PaymentStatus"].ToString(); //objUser.ActivationStatus = profile["ActivationStatus"].ToString(); //objUser.CouponCode = profile["CouponCode"].ToString(); //objUser.ReferenceStatus = profile["ReferenceStatus"].ToString(); //objUser.RefereeStatus = profile["RefereeStatus"].ToString(); //objUser.UserType = profile["UserType"].ToString(); #endregion if (objUser != null) { Session["User"] = objUser; returnmsg = "user"; #region Count Used Accounts try { Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } return(Content(returnmsg)); }
//[HttpPost] public async System.Threading.Tasks.Task <ActionResult> AjaxLogin(string username, string password) { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; User objUser = new User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); HttpResponseMessage response = await WebApiReq.GetReq("api/ApiUser/Login?EmailId=" + uname + "&PasswordHash=" + SBUtils.MD5Hash(pass), "", ""); if (response.IsSuccessStatusCode) { objUser = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.User>(); if (objUser != null) { Response.Cookies.Add(FormsAuthentication.GetAuthCookie(objUser.UserName, true)); // FormsAuthentication.SetAuthCookie(objUser.UserName, false); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary <string, string> re = await ac.GetTokenDictionary(username, SBUtils.MD5Hash(pass)); Session["access_token"] = re["access_token"]; } catch (Exception e) { objUser = null; // Edited by Antima HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim()); myCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(myCookie); returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { Session["User"] = objUser; Session["group"] = await SBHelper.LoadGroups(objUser.Id); returnmsg = "user"; #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } if (objUser.UserType == "SuperAdmin") { returnmsg = "SuperAdmin"; Session["User"] = objUser; } } } else { objUser = null; HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim()); myCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(myCookie); returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } return(Content(returnmsg)); }
public async System.Threading.Tasks.Task <ActionResult> AjaxPluginLogin() { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; string uname = Request.Form["email"].ToString(); string pass = Request.Form["password"].ToString(); User objUser = new User(); Api.User.User ApiUser = new Api.User.User(); string logindata = ApiUser.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist" && !str.Equals("Email Not Exist")) { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); FormsAuthentication.SetAuthCookie(objUser.UserName, false); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary <string, string> re = await ac.GetTokenDictionary(uname, SBUtils.MD5Hash(pass)); Session["access_token"] = re["access_token"]; } catch (Exception e) { returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } } else if (str.Equals("Email Not Exist")) { returnmsg = "Sorry, " + ConfigurationManager.AppSettings["domain"] + " doesn't recognize that username."; return(Content(returnmsg)); } else { returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); #region Count Used Accounts try { Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Session["ProfileCount"] = 0; Session["TotalAccount"] = 0; } #endregion if (daysremaining > 0) { Session["User"] = objUser; returnmsg = "user"; Session["Paid_User"] = "******"; } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } return(Content(returnmsg)); }
public ActionResult Facebook(string code) { if (Session["fblogin"] != null) { if ((string)Session["fblogin"] == "fblogin") { Session["fblogin"] = null; if (String.IsNullOrEmpty(code)) { return RedirectToAction("Index", "Index"); } Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; // string facebookcode = Request.QueryString["code"].ToString(); string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); Api.User.User ApiobjUser = new Api.User.User(); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User))); try { // objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User))); checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false); } catch (Exception e) { } if (checkuserexist != null) { Session["User"] = checkuserexist; int daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["Paid_User"] = "******"; } return RedirectToAction("Index", "Home"); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return RedirectToAction("Registration", "Index"); } } else if ((string)Session["fblogin"] == "page") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List<Domain.Socioboard.Domain.AddFacebookPage> lstAddFacebookPage = new List<Domain.Socioboard.Domain.AddFacebookPage>(); lstAddFacebookPage = (List<Domain.Socioboard.Domain.AddFacebookPage>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookPages(code), typeof(List<Domain.Socioboard.Domain.AddFacebookPage>))); Session["fbpage"] = lstAddFacebookPage; return RedirectToAction("Index", "Home", new { hint = "fbpage" }); } else if ((string)Session["fblogin"] == "fbgroup") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List<Domain.Socioboard.Domain.AddFacebookGroup> lstAddFacebookGroup = new List<Domain.Socioboard.Domain.AddFacebookGroup>(); lstAddFacebookGroup = (List<Domain.Socioboard.Domain.AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookGroups(code), typeof(List<Domain.Socioboard.Domain.AddFacebookGroup>))); Session["fbgrp"] = lstAddFacebookGroup; return RedirectToAction("Index", "Home", new { hint = "fbgrp" }); } } else { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); string AddfacebookAccount = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); //string AddfacebookAccount = apiobjFacebook.AddFacebookAccountAsync(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); if (AddfacebookAccount == "issue_access_token") { Response.Redirect(Helper.SBUtils.GetFacebookRedirectLink()); } else { Session["SocialManagerInfo"] = AddfacebookAccount; //try //{ // apiobjFacebook.AddFacebookAccountWithPaginationAsync(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); //} //catch (Exception ex) //{ // logger.Error(ex.StackTrace); // logger.Error(ex.Message); //} } } return RedirectToAction("Index", "Home"); }
//[HttpPost] public ActionResult AjaxLogin(string username, string password) { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; User objUser = new User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); string logindata = obj.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist") { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); FormsAuthentication.SetAuthCookie(objUser.UserName, false); } else { objUser = null; // Edited by Antima HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim()); myCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(myCookie); returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } #region Unused code //JObject profile = JObject.Parse(obj.Login(uname, pass)); //objUser.Id = Guid.Parse(profile["Id"].ToString()); //objUser.UserName = profile["UserName"].ToString(); //objUser.AccountType = profile["AccountType"].ToString(); //objUser.ProfileUrl = profile["ProfileUrl"].ToString(); //objUser.EmailId = profile["EmailId"].ToString(); //objUser.CreateDate = Convert.ToDateTime(profile["CreateDate"].ToString()); //objUser.ExpiryDate = Convert.ToDateTime(profile["ExpiryDate"].ToString()); //objUser.UserStatus = Convert.ToInt16(profile["UserStatus"].ToString()); //objUser.Password = profile["Password"].ToString(); //objUser.TimeZone = profile["TimeZone"].ToString(); //objUser.PaymentStatus = profile["PaymentStatus"].ToString(); //objUser.ActivationStatus = profile["ActivationStatus"].ToString(); //objUser.CouponCode = profile["CouponCode"].ToString(); //objUser.ReferenceStatus = profile["ReferenceStatus"].ToString(); //objUser.RefereeStatus = profile["RefereeStatus"].ToString(); //objUser.UserType = profile["UserType"].ToString(); #endregion if (objUser.UserType != "SuperAdmin") { if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { Session["User"] = objUser; returnmsg = "user"; #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } } else { returnmsg = "SuperAdmin"; Session["User"] = objUser; } return(Content(returnmsg)); }
public ActionResult Facebook(string code) { if (Session["fblogin"] != null) { if ((string)Session["fblogin"] == "fblogin") { Session["fblogin"] = null; if (String.IsNullOrEmpty(code)) { return(RedirectToAction("Index", "Index")); } Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; // string facebookcode = Request.QueryString["code"].ToString(); string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); Api.User.User ApiobjUser = new Api.User.User(); string fbloginreturn = apiobjFacebook.FacebookLogin(code); string[] arrfbloginreturn = Regex.Split(fbloginreturn, "_#_"); //objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User))); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(arrfbloginreturn[0], typeof(Domain.Socioboard.Domain.User))); Session["AccesstokenFblogin"] = arrfbloginreturn[1]; Session["fblogin"] = "******"; try { Response.Write("Facebook Returned email : " + objUser.EmailId); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); logger.Error(ex.Message); } try { // objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User))); checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false); } catch (Exception e) { checkuserexist = null; } if (checkuserexist != null) { Session["User"] = checkuserexist; int daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["Paid_User"] = "******"; } ApiobjUser.UpdateLastLoginTime(checkuserexist.Id.ToString()); return(RedirectToAction("Index", "Home")); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return(RedirectToAction("Registration", "Index")); } } else if ((string)Session["fblogin"] == "page") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List <Domain.Socioboard.Domain.AddFacebookPage> lstAddFacebookPage = new List <Domain.Socioboard.Domain.AddFacebookPage>(); lstAddFacebookPage = (List <Domain.Socioboard.Domain.AddFacebookPage>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookPages(code), typeof(List <Domain.Socioboard.Domain.AddFacebookPage>))); Session["fbpage"] = lstAddFacebookPage; return(RedirectToAction("Index", "Home", new { hint = "fbpage" })); } else if ((string)Session["fblogin"] == "fbgroup") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List <Domain.Socioboard.Domain.AddFacebookGroup> lstAddFacebookGroup = new List <Domain.Socioboard.Domain.AddFacebookGroup>(); lstAddFacebookGroup = (List <Domain.Socioboard.Domain.AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookGroups(code), typeof(List <Domain.Socioboard.Domain.AddFacebookGroup>))); Session["fbgrp"] = lstAddFacebookGroup; return(RedirectToAction("Index", "Home", new { hint = "fbgrp" })); } } else { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); apiobjFacebook.Timeout = 120 * 1000; //string AddfacebookAccount = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); string AddfacebookAccount = ""; Domain.Socioboard.Domain.FacebookAccount objfacebookAccount = new Domain.Socioboard.Domain.FacebookAccount(); try { var res_addFacebook = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); AddfacebookAccount = res_addFacebook; try { objfacebookAccount = (Domain.Socioboard.Domain.FacebookAccount) new JavaScriptSerializer().Deserialize(res_addFacebook, typeof(Domain.Socioboard.Domain.FacebookAccount)); AddfacebookAccount = objfacebookAccount.FbUserId; } catch (Exception) { } } catch (Exception) { AddfacebookAccount = "issue_access_token"; } if (AddfacebookAccount == "issue_access_token") { Response.Redirect(Helper.SBUtils.GetFacebookRedirectLink()); } else if (AddfacebookAccount == "Account already Exist !") { } else { Session["SocialManagerInfo"] = AddfacebookAccount; //To enable the Facebook Message Pop up TempData["IsFacebookAccountAdded"] = 1; TempData["FacebookAccount"] = objfacebookAccount; } } return(RedirectToAction("Index", "Home")); }
public async System.Threading.Tasks.Task<ActionResult> AjaxPluginLogin() { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; string uname = Request.Form["email"].ToString(); string pass = Request.Form["password"].ToString(); User objUser = new User(); Api.User.User ApiUser = new Api.User.User(); string logindata = ApiUser.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist" && !str.Equals("Email Not Exist")) { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); FormsAuthentication.SetAuthCookie(objUser.UserName, false); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary<string, string> re = await ac.GetTokenDictionary(uname, SBUtils.MD5Hash(pass)); Session["access_token"] = re["access_token"]; } catch (Exception e) { returnmsg = "Invalid Email or Password"; return Content(returnmsg); } } else if (str.Equals("Email Not Exist")) { returnmsg = "Sorry, " + ConfigurationManager.AppSettings["domain"] + " doesn't recognize that username."; return Content(returnmsg); } else { returnmsg = "Invalid Email or Password"; return Content(returnmsg); } if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); #region Count Used Accounts try { Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Session["ProfileCount"] = 0; Session["TotalAccount"] = 0; } #endregion if (daysremaining > 0) { Session["User"] = objUser; returnmsg = "user"; Session["Paid_User"] = "******"; } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } return Content(returnmsg); }
public ActionResult Index() { if (Session["User"] != null) { User objUser = (User)Session["User"]; if (TempData["IsTwitterAccountAdded"] != null && TempData["TwitterAccount"] != null) { //To enable the Tweet Pop up ViewBag.IsTwitterAccountAdded = TempData["IsTwitterAccountAdded"]; ViewBag.TwitterAccount = TempData["TwitterAccount"]; } if (TempData["IsFacebookAccountAdded"] != null && TempData["FacebookAccount"] != null) { //To enable the Tweet Pop up ViewBag.IsFacebookAccountAdded = TempData["IsFacebookAccountAdded"]; ViewBag.FacebookAccount = TempData["FacebookAccount"]; } if (Request.QueryString["teamid"] != null) { string teamid = Request.QueryString["teamid"].ToString(); Api.Team.Team _apiteam = new Api.Team.Team(); _apiteam.Timeout = 300000; _apiteam.UpdateTeambyteamid(teamid); } if (Session["Paid_User"] != null && Session["Paid_User"].ToString() == "Unpaid") { return(RedirectToAction("Billing", "PersonalSetting")); } else { ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; #region Count Used Accounts try { objUser = (User)Session["User"]; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); apiobjSocialProfile.Timeout = 300000; //apiobjSocialProfile.GetAllSocialProfiles(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); ViewBag.AccountType = objUser.AccountType; } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion if (Session["SocialManagerInfo"] != null) { } int ProfileCount = int.Parse(Session["ProfileCount"].ToString()); if (objUser.ActivationStatus == "1") { return(View(User)); } else { return(RedirectToAction("UserActivationByEmail", "Index", new { email = objUser.EmailId })); } } } else { return(RedirectToAction("Index", "Index")); } }
public ActionResult Index() { if (Session["User"] != null) { User objUser = (User)Session["User"]; if (TempData["IsTwitterAccountAdded"] != null && TempData["TwitterAccount"] != null) { //To enable the Tweet Pop up ViewBag.IsTwitterAccountAdded = TempData["IsTwitterAccountAdded"]; ViewBag.TwitterAccount = TempData["TwitterAccount"]; } if (TempData["IsFacebookAccountAdded"] != null && TempData["FacebookAccount"] != null) { //To enable the Tweet Pop up ViewBag.IsFacebookAccountAdded = TempData["IsFacebookAccountAdded"]; ViewBag.FacebookAccount = TempData["FacebookAccount"]; } if (Request.QueryString["teamid"] != null) { string teamid = Request.QueryString["teamid"].ToString(); Api.Team.Team _apiteam = new Api.Team.Team(); _apiteam.Timeout = 300000; _apiteam.UpdateTeambyteamid(teamid); } if (Session["Paid_User"] != null && Session["Paid_User"].ToString() == "Unpaid") { return RedirectToAction("Billing", "PersonalSetting"); } else { ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; #region Count Used Accounts try { objUser = (User)Session["User"]; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); apiobjSocialProfile.Timeout = 300000; //apiobjSocialProfile.GetAllSocialProfiles(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); ViewBag.AccountType = objUser.AccountType; } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion if (Session["SocialManagerInfo"] != null) { } int ProfileCount = int.Parse(Session["ProfileCount"].ToString()); if (objUser.ActivationStatus=="1") { return View(User); } else { return RedirectToAction("Index", "Index"); } } } else { return RedirectToAction("Index", "Index"); } }
public ActionResult Youtube() { string AddYoutubeAccount = string.Empty; Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; string code = (String)Request.QueryString["code"]; Api.Youtube.Youtube apiobjYoutube = new Api.Youtube.Youtube(); Api.User.User ApiobjUser = new Api.User.User(); if (Session["googlepluslogin"] != null) { if (!string.IsNullOrEmpty(code)) { objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjYoutube.GoogleLogin(code), typeof(Domain.Socioboard.Domain.User))); checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); if (checkuserexist != null) { Session["User"] = checkuserexist; int daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["Paid_User"] = "******"; } FormsAuthentication.SetAuthCookie(objUser.UserName, false); return(RedirectToAction("Index", "Home")); } else { Session["User"] = objUser; return(RedirectToAction("Registration", "Index")); } } else { return(RedirectToAction("Index", "Index")); } } else { try { AddYoutubeAccount = apiobjYoutube.AddYoutubeAccount(ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"], objUser.Id.ToString(), Session["group"].ToString(), code); if (AddYoutubeAccount == "Refresh Token Not Found") { AuthenticateYoutube(""); } else { Session["SocialManagerInfo"] = AddYoutubeAccount; } } catch (Exception ex) { Console.WriteLine(ex.Message); } } return(RedirectToAction("Index", "Home")); }
public ActionResult Facebook(string code) { if (Session["fblogin"] != null) { if ((string)Session["fblogin"] == "fblogin") { Session["fblogin"] = null; if (String.IsNullOrEmpty(code)) { return RedirectToAction("Index", "Index"); } Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; // string facebookcode = Request.QueryString["code"].ToString(); string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); Api.User.User ApiobjUser = new Api.User.User(); string fbloginreturn = apiobjFacebook.FacebookLogin(code); string[] arrfbloginreturn = Regex.Split(fbloginreturn, "_#_"); //objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User))); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(arrfbloginreturn[0], typeof(Domain.Socioboard.Domain.User))); Session["AccesstokenFblogin"] = arrfbloginreturn[1]; Session["fblogin"] = "******"; try { Response.Write("Facebook Returned email : " + objUser.EmailId); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); logger.Error(ex.Message); } try { // objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(apiobjFacebook.FacebookLogin(code), typeof(Domain.Socioboard.Domain.User))); checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); FormsAuthentication.SetAuthCookie(checkuserexist.UserName, false); } catch (Exception e) { checkuserexist = null; } if (checkuserexist != null) { Session["User"] = checkuserexist; int daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["Paid_User"] = "******"; } ApiobjUser.UpdateLastLoginTime(checkuserexist.Id.ToString()); return RedirectToAction("Index", "Home"); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return RedirectToAction("Registration", "Index"); } } else if ((string)Session["fblogin"] == "page") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List<Domain.Socioboard.Domain.AddFacebookPage> lstAddFacebookPage = new List<Domain.Socioboard.Domain.AddFacebookPage>(); lstAddFacebookPage = (List<Domain.Socioboard.Domain.AddFacebookPage>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookPages(code), typeof(List<Domain.Socioboard.Domain.AddFacebookPage>))); Session["fbpage"] = lstAddFacebookPage; return RedirectToAction("Index", "Home", new { hint = "fbpage" }); } else if ((string)Session["fblogin"] == "fbgroup") { Session["fblogin"] = null; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); List<Domain.Socioboard.Domain.AddFacebookGroup> lstAddFacebookGroup = new List<Domain.Socioboard.Domain.AddFacebookGroup>(); lstAddFacebookGroup = (List<Domain.Socioboard.Domain.AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(apiobjFacebook.GetFacebookGroups(code), typeof(List<Domain.Socioboard.Domain.AddFacebookGroup>))); Session["fbgrp"] = lstAddFacebookGroup; return RedirectToAction("Index", "Home", new { hint = "fbgrp" }); } } else { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; string facebookcode = code; Api.Facebook.Facebook apiobjFacebook = new Api.Facebook.Facebook(); apiobjFacebook.Timeout = 120 * 1000; //string AddfacebookAccount = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); string AddfacebookAccount = ""; Domain.Socioboard.Domain.FacebookAccount objfacebookAccount = new Domain.Socioboard.Domain.FacebookAccount(); try { var res_addFacebook = apiobjFacebook.AddFacebookAccount(facebookcode, objUser.Id.ToString(), Session["group"].ToString()); AddfacebookAccount = res_addFacebook; try { objfacebookAccount = (Domain.Socioboard.Domain.FacebookAccount)new JavaScriptSerializer().Deserialize(res_addFacebook, typeof(Domain.Socioboard.Domain.FacebookAccount)); AddfacebookAccount = objfacebookAccount.FbUserId; } catch (Exception) { } } catch (Exception) { AddfacebookAccount = "issue_access_token"; } if (AddfacebookAccount == "issue_access_token") { Response.Redirect(Helper.SBUtils.GetFacebookRedirectLink()); } else if (AddfacebookAccount == "Account already Exist !") { } else { Session["SocialManagerInfo"] = AddfacebookAccount; //To enable the Facebook Message Pop up TempData["IsFacebookAccountAdded"] = 1; TempData["FacebookAccount"] = objfacebookAccount; } } return RedirectToAction("Index", "Home"); }
public async Task <ActionResult> Youtube() { string AddYoutubeAccount = string.Empty; string AddGPlusAccount = string.Empty; Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Domain.Socioboard.Domain.User checkuserexist = (Domain.Socioboard.Domain.User)Session["User"]; string code = (String)Request.QueryString["code"]; Api.Youtube.Youtube apiobjYoutube = new Api.Youtube.Youtube(); Api.GooglePlus.GooglePlus ApiobjGooglePlus = new Api.GooglePlus.GooglePlus(); Api.GoogleAnalytics.GoogleAnalytics ApiGoogleAnalytics = new Api.GoogleAnalytics.GoogleAnalytics(); Api.User.User ApiobjUser = new Api.User.User(); if (Session["googlepluslogin"] != "youtube") { if (!string.IsNullOrEmpty(code)) { if (Session["googlepluslogin"].ToString() == "googlepluslogin") { string Googleloginreturn = apiobjYoutube.GoogleLogin(code); string[] arrgoogleloginreturn = Regex.Split(Googleloginreturn, "_#_"); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(arrgoogleloginreturn[0], typeof(Domain.Socioboard.Domain.User))); Session["AccesstokenFblogin"] = arrgoogleloginreturn[1]; Session["googlepluslogin"] = "******"; checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); if (checkuserexist != null) { objUser = checkuserexist; Session["User"] = checkuserexist; Session["group"] = await SBHelper.LoadGroups(objUser.Id); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary <string, string> re = await ac.GetTokenDictionary(checkuserexist.EmailId, checkuserexist.Password); Session["access_token"] = re["access_token"]; } catch (Exception e) { return(RedirectToAction("Index", "Home")); } daysremaining = 0; daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { #region Count Used Accounts try { Session["Paid_User"] = "******"; Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion } else { Session["Paid_User"] = "******"; } Response.Cookies.Add(FormsAuthentication.GetAuthCookie(objUser.UserName, true)); ApiobjUser.UpdateLastLoginTime(checkuserexist.Id.ToString()); HttpCookie myCookie = new HttpCookie("referal_url"); myCookie = Request.Cookies["referal_url"]; if (myCookie != null) { Response.Redirect(".." + myCookie.Value); } return(RedirectToAction("Index", "Home")); } else { objUser.ActivationStatus = "1"; Session["User"] = objUser; return(RedirectToAction("Registration", "Index")); } } else if (Session["googlepluslogin"].ToString() == "gplugin") { string Googleloginreturn = apiobjYoutube.GoogleLogin(code); string[] arrgoogleloginreturn = Regex.Split(Googleloginreturn, "_#_"); objUser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(arrgoogleloginreturn[0], typeof(Domain.Socioboard.Domain.User))); Session["AccesstokenFblogin"] = arrgoogleloginreturn[1]; checkuserexist = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(objUser.EmailId.ToString()), typeof(Domain.Socioboard.Domain.User))); if (checkuserexist != null) { objUser = checkuserexist; Session["User"] = checkuserexist; FormsAuthentication.SetAuthCookie(objUser.UserName, false); ApiobjUser.UpdateLastLoginTime(checkuserexist.Id.ToString()); } else { if (!string.IsNullOrEmpty(objUser.EmailId)) { string user = ApiobjUser.Register(objUser.EmailId, "", "Free", objUser.UserName, "1"); objUser = (Domain.Socioboard.Domain.User) new JavaScriptSerializer().Deserialize(user, typeof(Domain.Socioboard.Domain.User)); Session["User"] = objUser; } else { return(RedirectToAction("Index", "Index", new { hint = "plugin" })); } } Session["group"] = await SBHelper.LoadGroups(objUser.Id); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary <string, string> re = await ac.GetTokenDictionary(checkuserexist.EmailId, checkuserexist.Password); Session["access_token"] = re["access_token"]; } catch (Exception e) { return(RedirectToAction("Index", "Home")); } daysremaining = 0; try { daysremaining = (checkuserexist.ExpiryDate.Date - DateTime.Now.Date).Days; } catch (Exception ex) { } #region Count Used Accounts try { Session["ProfileCount"] = Convert.ToInt32(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Session["ProfileCount"] = 0; Session["TotalAccount"] = 0; } #endregion if (daysremaining > 0) { Session["Paid_User"] = "******"; } else { Session["Paid_User"] = "******"; } Session["googlepluslogin"] = "******"; return(RedirectToAction("Index", "Home", new { hint = "plugin" })); } else if (Session["googlepluslogin"].ToString() == "gplus") { AddGPlusAccount = ApiobjGooglePlus.AddGPlusAccount(ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"], objUser.Id.ToString(), Session["group"].ToString(), code); if (AddGPlusAccount == "Refresh Token Not Found") { AuthenticateYoutube(Session["googlepluslogin"].ToString()); } else { Session["SocialManagerInfo"] = AddGPlusAccount; } } else if (Session["googlepluslogin"].ToString() == "ga") { string ret_data = ApiGoogleAnalytics.GetAnalyticsProfile(code); if (ret_data == "Refresh Token Not Found") { AuthenticateYoutube(Session["googlepluslogin"].ToString()); } else { List <Domain.Socioboard.Helper.GoogleAnalyticsProfiles> lstGoogleAnalyticsProfiles = (List <Domain.Socioboard.Helper.GoogleAnalyticsProfiles>) new JavaScriptSerializer().Deserialize(ret_data, typeof(List <Domain.Socioboard.Helper.GoogleAnalyticsProfiles>)); Session["GAProfiles"] = lstGoogleAnalyticsProfiles; } return(RedirectToAction("Index", "Home", new { hint = "gaprofile" })); } } else { if (Session["googlepluslogin"].ToString() == "gplugin") { Session["googlepluslogin"] = null; return(RedirectToAction("Index", "Index", new { hint = "plugin" })); } return(RedirectToAction("Index", "Index")); } } else { try { AddYoutubeAccount = apiobjYoutube.AddYoutubeAccount(ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"], objUser.Id.ToString(), Session["group"].ToString(), code); if (AddYoutubeAccount == "Refresh Token Not Found") { AuthenticateYoutube(""); } else { Session["SocialManagerInfo"] = AddYoutubeAccount; } } catch (Exception ex) { Console.WriteLine(ex.Message); } } return(RedirectToAction("Index", "Home")); }