コード例 #1
0
        public ActionResult SBApp(string profileType, string url, string content, string imageUrl, string name, string userImage, string screenName, string tweet, string tweetId, string type)
        {
            Domain.Socioboard.Helper.PluginData _PluginData = new Domain.Socioboard.Helper.PluginData();
            _PluginData.profileType = profileType;
            _PluginData.content     = content;
            _PluginData.imageUrl    = imageUrl;
            _PluginData.name        = name;
            _PluginData.screenName  = screenName;
            _PluginData.tweet       = tweet;
            _PluginData.tweetId     = tweetId;
            _PluginData.url         = url;
            _PluginData.userImage   = userImage;
            _PluginData.type        = type;

            if (Session["User"] != null)
            {
                if (!string.IsNullOrEmpty(url) && profileType != "pinterest")
                {
                    Domain.Socioboard.Helper.ThumbnailDetails plugindata = PluginHelper.CreateThumbnail(url);
                    _PluginData._ThumbnailDetails = plugindata;
                }

                ViewBag.plugin = _PluginData;
                //Dictionary<string, object> dict_TeamMember = new Dictionary<string, object>();
                List <Domain.Socioboard.Helper.PluginProfile> lstsb = new List <Domain.Socioboard.Helper.PluginProfile>();
                lstsb = SBUtils.GetProfilesForPlugin();
                return(View("RMain", lstsb));
            }
            return(View("Rlogin"));
        }
コード例 #2
0
        public async Task <IActionResult> SBApp(string profileType, string url, string content, string imageUrl, string name, string userImage, string screenName, string tweet, string tweetId, string type)
        {
            Domain.Socioboard.Helpers.PluginData _PluginData = new Domain.Socioboard.Helpers.PluginData();
            _PluginData.profileType = profileType;
            _PluginData.content     = content;
            _PluginData.imageUrl    = imageUrl;
            _PluginData.name        = name;
            _PluginData.screenName  = screenName;
            _PluginData.tweet       = tweet;
            _PluginData.tweetId     = tweetId;
            _PluginData.url         = url;
            _PluginData.userImage   = userImage;
            _PluginData.type        = type;
            Domain.Socioboard.Models.User user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (user != null)
            {
                if (!string.IsNullOrEmpty(url) && profileType != "pinterest")
                {
                    Domain.Socioboard.Helpers.ThumbnailDetails plugindata = PluginHelper.CreateThumbnail(url);
                    _PluginData._ThumbnailDetails = plugindata;
                }

                ViewBag.plugin = _PluginData;

                List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();
                parameters.Add(new KeyValuePair <string, string>("userId", user.Id.ToString()));
                HttpResponseMessage _response = await WebApiReq.GetReq("/api/GroupProfiles/GetPluginProfile?userId=" + user.Id.ToString(), "", "", _appSettings.ApiDomain);

                if (_response.IsSuccessStatusCode)
                {
                    try
                    {
                        List <Domain.Socioboard.Helpers.PluginProfile> lstsb = new List <Domain.Socioboard.Helpers.PluginProfile>();
                        lstsb = await _response.Content.ReadAsAsync <List <Domain.Socioboard.Helpers.PluginProfile> >();

                        return(View("RMain", lstsb));
                    }
                    catch { }
                }
            }
            return(View("Rlogin"));
        }
コード例 #3
0
        public async Task <IActionResult> SBApp(string profileType, string url, string content, string imageUrl, string name, string userImage, string screenName, string tweet, string tweetId, string type, string EmailId)
        {
            var password = "";

            var pluginData = new Domain.Socioboard.Helpers.PluginData
            {
                profileType = profileType,
                content     = content,
                imageUrl    = imageUrl,
                name        = name,
                screenName  = screenName,
                tweet       = tweet,
                tweetId     = tweetId,
                url         = url,
                userImage   = userImage,
                type        = type
            };

            if (!string.IsNullOrEmpty(imageUrl))
            {
                if (imageUrl.Equals(url))
                {
                    if (type == "timeline-image")
                    {
                        pluginData.url = string.Empty;
                    }

                    if (profileType == "image")
                    {
                        pluginData.url = string.Empty;
                    }
                }
            }

            if (profileType == "website")
            {
                if (url.Contains(".jpg") || url.Contains(".png"))
                {
                    pluginData.imageUrl = url;
                    pluginData.url      = string.Empty;
                }
            }

            var user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");

            if (user == null)
            {
                if (Request.Cookies["socioboardpluginemailId"] != null)
                {
                    EmailId = Request.Cookies["socioboardpluginemailId"];
                    EmailId = PluginHelper.Base64Decode(EmailId);
                }

                if (Request.Cookies["socioboardpluginToken"] != null)
                {
                    password = Request.Cookies["socioboardpluginToken"];
                    password = PluginHelper.Base64Decode(password);
                }

                if (!string.IsNullOrEmpty(EmailId) && !string.IsNullOrEmpty(password))
                {
                    var parameters = new List <KeyValuePair <string, string> >
                    {
                        new KeyValuePair <string, string>("UserName", EmailId),
                        new KeyValuePair <string, string>("Password", password)
                    };

                    var loginResponse = await WebApiReq.PostReq("/api/User/CheckUserLogin", parameters, "", "", _appSettings.ApiDomain);

                    if (loginResponse.IsSuccessStatusCode)
                    {
                        try
                        {
                            user = await loginResponse.Content.ReadAsAsync <Domain.Socioboard.Models.User>();

                            HttpContext.Session.SetObjectAsJson("User", user);
                        }
                        catch (Exception e) { _logger.LogError(e.Message); }
                    }
                    else
                    {
                        ViewBag.User = "******";
                        return(View("Rlogin"));
                    }
                }
            }

            if (user == null)
            {
                return(View("Rlogin"));
            }

            if (!string.IsNullOrEmpty(url) && profileType != "pinterest")
            {
                var plugindata = PluginHelper.CreateThumbnail(url);
                pluginData._ThumbnailDetails = plugindata;
            }

            ViewBag.plugin   = pluginData;
            ViewBag.emailId  = user.EmailId;
            ViewBag.password = user.Password;
            ViewBag.userId   = user.Id.ToString();

            var response = await WebApiReq.GetReq("/api/Groups/GetUserGroups?userId=" + user.Id, "", "", _appSettings.ApiDomain);

            if (!response.IsSuccessStatusCode)
            {
                return(View("Rlogin"));
            }

            try
            {
                var groups = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groups> >();

                var selectedGroupId = groups.FirstOrDefault(t => t.groupName == Domain.Socioboard.Consatants.SocioboardConsts.DefaultGroupName)?.id;

                if (selectedGroupId != null)
                {
                    var pluginProfileResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetPluginProfile?groupId=" + selectedGroupId, "", "", _appSettings.ApiDomain);

                    if (pluginProfileResponse.IsSuccessStatusCode)
                    {
                        try
                        {
                            var pluginProfiles = await pluginProfileResponse.Content.ReadAsAsync <List <Domain.Socioboard.Helpers.PluginProfile> >();

                            return(View("RMain", pluginProfiles));
                        }
                        catch (Exception e) { _logger.LogError(e.Message); }
                    }
                }
            }
            catch (Exception e) { _logger.LogError(e.Message); }

            return(View("Rlogin"));
        }
コード例 #4
0
        public async Task <IActionResult> SBApp(string profileType, string url, string content, string imageUrl, string name, string userImage, string screenName, string tweet, string tweetId, string type, string EmailId)
        {
            string password = "";

            Domain.Socioboard.Helpers.PluginData _PluginData = new Domain.Socioboard.Helpers.PluginData();
            _PluginData.profileType = profileType;
            _PluginData.content     = content;
            _PluginData.imageUrl    = imageUrl;
            _PluginData.name        = name;
            _PluginData.screenName  = screenName;
            _PluginData.tweet       = tweet;
            _PluginData.tweetId     = tweetId;
            _PluginData.url         = url;
            _PluginData.userImage   = userImage;
            _PluginData.type        = type;
            Domain.Socioboard.Models.User user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (user == null)
            {
                if (Request.Cookies["socioboardpluginemailId"] != null)
                {
                    EmailId = Request.Cookies["socioboardpluginemailId"].ToString();
                    EmailId = PluginHelper.Base64Decode(EmailId);
                }
                if (Request.Cookies["socioboardpluginToken"] != null)
                {
                    password = Request.Cookies["socioboardpluginToken"].ToString();
                    password = PluginHelper.Base64Decode(password);
                }
                if (!string.IsNullOrEmpty(EmailId) && !string.IsNullOrEmpty(password))
                {
                    List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >();
                    Parameters.Add(new KeyValuePair <string, string>("UserName", EmailId));
                    Parameters.Add(new KeyValuePair <string, string>("Password", password));
                    HttpResponseMessage _response = await WebApiReq.PostReq("/api/User/CheckUserLogin", Parameters, "", "", _appSettings.ApiDomain);

                    if (_response.IsSuccessStatusCode)
                    {
                        try
                        {
                            user = await _response.Content.ReadAsAsync <Domain.Socioboard.Models.User>();

                            HttpContext.Session.SetObjectAsJson("User", user);
                        }
                        catch { }
                    }
                    else
                    {
                        ViewBag.User = "******";
                        return(View("Rlogin"));
                    }
                }
            }
            if (user != null)
            {
                if (!string.IsNullOrEmpty(url) && profileType != "pinterest")
                {
                    Domain.Socioboard.Helpers.ThumbnailDetails plugindata = PluginHelper.CreateThumbnail(url);
                    _PluginData._ThumbnailDetails = plugindata;
                }

                ViewBag.plugin   = _PluginData;
                ViewBag.emailId  = user.EmailId;
                ViewBag.password = user.Password;
                HttpResponseMessage response = await WebApiReq.GetReq("/api/Groups/GetUserGroups?userId=" + user.Id, "", "", _appSettings.ApiDomain);

                if (response.IsSuccessStatusCode)
                {
                    try
                    {
                        List <Domain.Socioboard.Models.Groups> groups = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groups> >();

                        long selectedGroupId = groups.FirstOrDefault(t => t.groupName == Domain.Socioboard.Consatants.SocioboardConsts.DefaultGroupName).id;
                        List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();
                        parameters.Add(new KeyValuePair <string, string>("userId", user.Id.ToString()));
                        HttpResponseMessage _response = await WebApiReq.GetReq("/api/GroupProfiles/GetPluginProfile?groupId=" + selectedGroupId, "", "", _appSettings.ApiDomain);

                        if (_response.IsSuccessStatusCode)
                        {
                            try
                            {
                                List <Domain.Socioboard.Helpers.PluginProfile> lstsb = new List <Domain.Socioboard.Helpers.PluginProfile>();
                                lstsb = await _response.Content.ReadAsAsync <List <Domain.Socioboard.Helpers.PluginProfile> >();

                                return(View("RMain", lstsb));
                            }
                            catch { }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return(View("Rlogin"));
        }