Example #1
0
        public async Task <IActionResult> ManageUserFilter(int plan, int paymentstatus, int nullplan, int nullpaymentstatus)
        {
            Domain.Socioboard.Models.User _user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (_user == null)
            {
                return(RedirectToAction("Index", "Index"));
            }
            else
            {
                Domain.Socioboard.Models.UserDetails user = new Domain.Socioboard.Models.UserDetails();
                try
                {
                    HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdminFilter?plan=" + plan + "&paymentstatus=" + paymentstatus + "&nullplan=" + nullplan + "&nullpaymentstatus=" + nullpaymentstatus, "", "", _appSettings.ApiDomain);

                    if (response.IsSuccessStatusCode)
                    {
                        user = await response.Content.ReadAsAsync <Domain.Socioboard.Models.UserDetails>();
                    }

                    ViewBag.details   = user._user;
                    ViewBag.ApiDomain = _appSettings.ApiDomain;
                    ViewBag.Domain    = _appSettings.Domain;
                    return(View("ManageUser"));
                }
                catch (Exception ex)
                {
                    return(View("ManageUser"));
                }
            }
        }
        public async Task <IActionResult> PayUMoneySuccessful(FormCollection form)
        {
            string status = Request.Form["status"].ToString();

            string output = "false";

            if (status == "success")
            {
                string payuMoneyId = Request.Form["payuMoneyId"].ToString();
                string PG_TYPE     = Request.Form["PG_TYPE"].ToString();
                string txnid       = Request.Form["txnid"].ToString();
                string amount      = Request.Form["amount"].ToString();
                string productinfo = Request.Form["productinfo"].ToString();
                Domain.Socioboard.Models.User         user       = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
                Domain.Socioboard.Models.Package      _Package   = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.Package>("Package");
                List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >();
                Parameters.Add(new KeyValuePair <string, string>("userId", user.Id.ToString()));
                Parameters.Add(new KeyValuePair <string, string>("UserName", user.FirstName + " " + user.LastName));
                Parameters.Add(new KeyValuePair <string, string>("email", user.EmailId));
                Parameters.Add(new KeyValuePair <string, string>("amount", amount));
                Parameters.Add(new KeyValuePair <string, string>("PaymentType", user.PaymentType.ToString()));
                Parameters.Add(new KeyValuePair <string, string>("trasactionId", txnid));
                Parameters.Add(new KeyValuePair <string, string>("paymentId", payuMoneyId));
                HttpResponseMessage response = await WebApiReq.PostReq("/api/PaymentTransaction/UpgradeAccount", Parameters, "", "", _appSettings.ApiDomain);

                if (response.IsSuccessStatusCode)
                {
                    try
                    {
                        string data = await response.Content.ReadAsStringAsync();

                        if (data == "payment done")
                        {
                            List <KeyValuePair <string, string> > _Parameters = new List <KeyValuePair <string, string> >();
                            // _Parameters.Add(new KeyValuePair<string, string>("Id", user.Id.ToString()));
                            HttpResponseMessage _response = await WebApiReq.GetReq("/api/User/GetUser?Id=" + user.Id.ToString(), "", "", _appSettings.ApiDomain);

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

                                    HttpContext.Session.SetObjectAsJson("User", _user);
                                    //SendInvoiceMerchant(_user.PhoneNumber, _user.EmailId, _user.FirstName, amount, productinfo, txnid, _appSettings.PayUMoneyURL);
                                    // output = "true";
                                    return(RedirectToAction("Index", "Home"));
                                }
                                catch { }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        return(RedirectToAction("Index", "Index"));
                    }
                }
            }
            return(RedirectToAction("Index", "Index"));
        }
        // GET: /<controller>/
        public async Task <IActionResult> ManageUser()
        {
            Domain.Socioboard.Models.User _user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (_user == null)
            {
                return(RedirectToAction("Index", "Index"));
            }
            else
            {
                List <Domain.Socioboard.Models.User> user = new List <Domain.Socioboard.Models.User>();
                HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdmin", "", "", _appSettings.ApiDomain);

                if (response.IsSuccessStatusCode)
                {
                    user = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.User> >();
                }
                ViewBag.details   = user;
                ViewBag.ApiDomain = _appSettings.ApiDomain;
                ViewBag.Domain    = _appSettings.Domain;
                return(View("ManageUser"));
            }


            //return Json(user);
        }
        public async Task <IActionResult> board(string boardName)
        {
            HttpResponseMessage response = await WebApiReq.GetReq("/api/BoardMe/getBoardByName?boardName=" + boardName, "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    ViewBag.board = await response.Content.ReadAsAsync <Domain.Socioboard.Models.Mongo.MongoBoards>();

                    return(View());
                }
                catch (Exception e)
                {
                    string output = string.Empty;
                    try
                    {
                        output = await response.Content.ReadAsStringAsync();
                    }
                    catch (Exception ex)
                    {
                        _logger.LogError(ex.StackTrace);
                    }
                    return(Content(output));
                }
            }



            return(View());
        }
Example #5
0
        public async Task <ActionResult> GroupIndex()
        {
            User   objUser     = (User)Session["User"];
            string accesstoken = string.Empty;
            string UserId      = objUser.Id.ToString();

            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }
            List <KeyValuePair <string, string> > param = new List <KeyValuePair <string, string> >();

            IEnumerable <ShareathonGroupViewModel> sharethons = new List <ShareathonGroupViewModel>();

            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetGroupShareathons?UserId=" + UserId, "Bearer", accesstoken);

            if (response.IsSuccessStatusCode)
            {
                sharethons = await response.Content.ReadAsAsync <IEnumerable <Domain.Socioboard.Domain.ShareathonGroupViewModel> >();
            }



            return(View(sharethons));
        }
Example #6
0
        public async Task <IActionResult> UndoUser(long Id)
        {
            Domain.Socioboard.Models.User _user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (_user == null)
            {
                return(RedirectToAction("Index", "Index"));
            }
            else
            {
                bool result      = false;
                int  undomessage = 0;

                List <Domain.Socioboard.Models.User> user = new List <Domain.Socioboard.Models.User>();

                HttpResponseMessage response = await WebApiReq.GetReq("/api/User/UndoUserAdmin?Id=" + Id, "", "", _appSettings.ApiDomain);

                if (response.IsSuccessStatusCode)
                {
                    user = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.User> >();
                }
                if (result == true)
                {
                    undomessage = 1;
                }

                return(View("DeletedUser"));
            }
        }
Example #7
0
        public async Task <ActionResult> Index(string emailId)
        {
            var userResponse = await WebApiReq.GetReq("/api/User/GetUserData?emailId=" + emailId, "", "",
                                                      _appSettings.ApiDomain);

            if (userResponse.IsSuccessStatusCode)
            {
                var user = await userResponse.Content.ReadAsAsync <User>();

                HttpContext.Session.SetObjectAsJson("User", user);
                var package = user.AccountType.ToString();

                var parameter = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("packagename", package)
                };

                var paymentResponse = await WebApiReq.PostReq("/api/PaymentTransaction/GetPackage", parameter, "", "",
                                                              _appSettings.ApiDomain);

                if (!paymentResponse.IsSuccessStatusCode)
                {
                    return(Content(""));
                }

                try
                {
                    var sessionPackage = await paymentResponse.Content.ReadAsAsync <Package>();

                    HttpContext.Session.SetObjectAsJson("Package", sessionPackage);
                    HttpContext.Session.SetObjectAsJson("paymentsession", true);

                    if (user.PaymentType == PaymentType.paypal)
                    {
                        return(Content(Payment.PaypalRecurringPayment(sessionPackage.amount,
                                                                      sessionPackage.packagename, user.FirstName + " " + user.LastName, user.PhoneNumber,
                                                                      user.EmailId, "USD", _appSettings.paypalemail, _appSettings.callBackUrl,
                                                                      _appSettings.failUrl, _appSettings.callBackUrl, _appSettings.cancelurl,
                                                                      _appSettings.notifyUrl, "", _appSettings.PaypalURL, user.Id)));
                    }

                    if (user.PaymentType == PaymentType.bluesnap)
                    {
                        return(RedirectToAction("paymentWithPayUMoney", "Index", new { contesnt = false }));
                    }

                    return(RedirectToAction("paymentWithPayUMoney", "Index", new { contesnt = false }));
                }
                catch (Exception ex)
                {
                    //_logger.LogError(ex.StackTrace);
                }
            }

            return(Content(""));
        }
Example #8
0
        public async Task <ActionResult> Edit(string Id)
        {
            User   objuser     = (User)Session["User"];
            string accesstoken = string.Empty;

            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }
            List <KeyValuePair <string, string> > param = new List <KeyValuePair <string, string> >();
            List <FacebookAccount> lst = new List <FacebookAccount>();

            Shareathon sharethons = null;
            string     nameId     = "";

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetShareaton?Id=" + Id, "Bearer", accesstoken);

            if (response.IsSuccessStatusCode)
            {
                sharethons = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.Shareathon>();

                nameId = sharethons.Facebookpageid;
                //foreach (var item in nameId)
                //{

                //    List<FacebookAccount> facebookaccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetFacebookAccountDetailsById(item), typeof(List<FacebookAccount>)));
                //    lst.Add(facebookaccount[0]);
                //}
            }
            List <FacebookAccount> lstFacebookAccount = new List <FacebookAccount>();
            List <FacebookAccount> facebookaccounts   = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getAllFacebookAccountsOfUser(objuser.Id.ToString()), typeof(List <FacebookAccount>)));
            List <FacebookAccount> lstpage            = facebookaccounts.Where(t => t.Type == "Page").ToList();
            List <FacebookAccount> lstaccount         = facebookaccounts.Where(t => t.Type == "account").ToList();

            ViewBag.UserId     = objuser.Id;
            ViewBag.FbAccounts = lstaccount.Where(t => t.FbUserId != "").ToList();
            foreach (FacebookAccount item in lstpage)
            {
                if (item != null)
                {
                    lstFacebookAccount.Add(item);
                }
            }
            if (lstFacebookAccount.Count > 0)
            {
                ViewBag.FbPages    = lstFacebookAccount;
                Session["FbPages"] = ViewBag.FbPages;
            }
            else
            {
                ViewBag.FbPages = null;
            }
            ViewBag.pageid = nameId;
            return(View(sharethons));
        }
Example #9
0
        public async Task <ActionResult> GroupShareathonEdit(string Id)
        {
            User   objuser     = (User)Session["User"];
            string accesstoken = string.Empty;

            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }
            List <KeyValuePair <string, string> > param = new List <KeyValuePair <string, string> >();
            List <KeyValuePair <string, string> > lst   = new List <KeyValuePair <string, string> >();

            ShareathonGroup sharethons = null;

            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetGroupShareaton?Id=" + Id, "Bearer", accesstoken);

            if (response.IsSuccessStatusCode)
            {
                sharethons = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.ShareathonGroup>();

                //FacebookClient fb = new FacebookClient();
                //fb.AccessToken = sharethons.AccessToken;
                //System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
                //dynamic profile = fb.Get("v2.0/" + sharethons.Facebookgroupid + "?fields=id,name");
                //ViewBag.GroupId = (Convert.ToString(profile["id"]));
                //ViewBag.Groupname = (Convert.ToString(profile["name"]));
                string [] nameId = sharethons.Facebooknameid.Split(',');
                string    id     = "";
                for (int i = 0; i < nameId.Length; i++)
                {
                    string [] name = Regex.Split(nameId[i], "###");
                    id = name[0] + "," + id;
                    //lst.Add(new KeyValuePair<string,string>(nameId[i], name[1]));
                }
                ViewBag.GroupId = id;
                Api.Facebook.Facebook   ApiFacebook      = new Api.Facebook.Facebook();
                List <AddFacebookGroup> lstFacebookGroup = new List <AddFacebookGroup>();
                string fcebookgrp = ApiFacebook.GetAllFacebookGroups(sharethons.AccessToken);
                lstFacebookGroup = (List <AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(fcebookgrp, typeof(List <AddFacebookGroup>)));
                if (lstFacebookGroup.Count > 0)
                {
                    ViewBag.facebbokgroup = lstFacebookGroup;
                }
                else
                {
                    ViewBag.facebbokgroup = null;
                }
            }
            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List <FacebookAccount> facebookaccounts = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), Session["group"].ToString()), typeof(List <FacebookAccount>)));

            ViewBag.FbAccounts = facebookaccounts;
            ViewBag.UserId     = objuser.Id;
            ViewBag.Group      = lst;
            return(View(sharethons));
        }
        public async Task <IActionResult> plans()
        {
            HttpResponseMessage _response = await WebApiReq.GetReq("/api/User/GetPlans", "", "", _appSettings.ApiDomain);

            List <Domain.Socioboard.Models.Package> lstsb = new List <Domain.Socioboard.Models.Package>();

            lstsb = await _response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Package> >();

            ViewBag.plugin = lstsb;

            return(View("Plans"));
        }
Example #11
0
        public async Task <IActionResult> GetUnsubscribedMailReport(int count)
        {
            List <Domain.Socioboard.Models.Mongo.ElasticmailReport> lstelasticmails = new List <Domain.Socioboard.Models.Mongo.ElasticmailReport>();
            HttpResponseMessage response = await WebApiReq.GetReq("/api/ElasticMailReport/getElasticMailUnsubscribedReportData?daysCount=" + count, "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                lstelasticmails = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Mongo.ElasticmailReport> >();
            }
            ViewBag.Unsubscribed = lstelasticmails.Count();
            ViewBag.ApiDomain    = _appSettings.ApiDomain;
            ViewBag.Domain       = _appSettings.Domain;
            return(PartialView("_GetUnsubscribedMailReportPartial"));
        }
Example #12
0
        public async Task <IActionResult> GetCustomAbuseReportedMailReport(DateTime sdate, DateTime edate)
        {
            List <Domain.Socioboard.Models.Mongo.ElasticmailReport> lstelasticmails = new List <Domain.Socioboard.Models.Mongo.ElasticmailReport>();
            HttpResponseMessage response = await WebApiReq.GetReq("/api/ElasticMailReport/getCustomElasticMailAbuseReportReportData?sdate=" + sdate + "&edate=" + edate, "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                lstelasticmails = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Mongo.ElasticmailReport> >();
            }
            ViewBag.AbuseReportedMail = lstelasticmails.Count();
            ViewBag.ApiDomain         = _appSettings.ApiDomain;
            ViewBag.Domain            = _appSettings.Domain;
            return(PartialView("_GetAbuseReportedMailReportPartial"));
        }
        public async Task <ActionResult> UpdateUser()
        {
            Domain.Socioboard.Models.User user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");

            HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUser?Id=" + user.Id, "", "", _appSettings.ApiDomain);

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

                HttpContext.Session.SetObjectAsJson("User", user);
            }
            return(Json(user));
        }
Example #14
0
        public async Task <ActionResult> SmartSearch()
        {
            User   objUser         = (User)Session["User"];
            string selectedgroupid = Session["group"].ToString();
            IEnumerable <Domain.Socioboard.Domain.Groupmembers> lstGroupMembers = new List <Domain.Socioboard.Domain.Groupmembers>();
            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGroupMembers/GetAcceptedGroupMembers?GroupId=" + selectedgroupid, "Bearer", Session["access_token"].ToString());

            if (response.IsSuccessStatusCode)
            {
                lstGroupMembers = await response.Content.ReadAsAsync <IEnumerable <Domain.Socioboard.Domain.Groupmembers> >();
            }

            return(View(lstGroupMembers.ToList()));
        }
        public async Task <ActionResult> PendingUser(string Groupid)
        {
            User   objUser         = (User)Session["User"];
            string selectedgroupid = Session["selectedgroupid"].ToString();
            IEnumerable <Domain.Socioboard.Domain.Groupmembers> lstGroupMembers = new List <Domain.Socioboard.Domain.Groupmembers>();
            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGroupMembers/GetPendingGroupMembers?GroupId=" + selectedgroupid, "Bearer", Session["access_token"].ToString());

            if (response.IsSuccessStatusCode)
            {
                lstGroupMembers = await response.Content.ReadAsAsync <IEnumerable <Domain.Socioboard.Domain.Groupmembers> >();
            }


            //Api.Team.Team ApiobjTeam = new Api.Team.Team();
            //List<Domain.Socioboard.Domain.Team> lstteam = (List<Domain.Socioboard.Domain.Team>)(new JavaScriptSerializer().Deserialize(ApiobjTeam.GetTeamByStatus(selectedgroupid, objUser.Id.ToString(), "0"), typeof(List<Domain.Socioboard.Domain.Team>)));
            return(PartialView("_PendingUserPartial", lstGroupMembers));
        }
        public async Task <ActionResult> LoadPersonalSetting()
        {
            User objUser = (User)Session["User"];
            NewsLetterSetting _NewsLetterSetting = new NewsLetterSetting();

            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiNewsLetter/Get?userId=" + objUser.Id.ToString(), "Bearer", Session["access_token"].ToString());

            if (response.IsSuccessStatusCode)
            {
                _NewsLetterSetting = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.NewsLetterSetting>();
            }
            else
            {
                _NewsLetterSetting = null;
            }
            ViewBag.NewsLetterSetting = _NewsLetterSetting;
            return(PartialView("_PersonalSettingPartial", objUser));
        }
Example #17
0
        public async Task <ActionResult> DeleteGroupShareathon(string Id)
        {
            User   objUser     = (User)Session["User"];
            string accesstoken = string.Empty;
            string UserId      = objUser.Id.ToString();

            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }
            List <KeyValuePair <string, string> > param = new List <KeyValuePair <string, string> >();

            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/DeleteGroupShareathon?Id=" + Id, "Bearer", accesstoken);

            if (response.IsSuccessStatusCode)
            {
            }
            return(RedirectToAction("GroupIndex", "Shareathon"));
        }
        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"));
        }
        public async Task <IActionResult> getInstagramFeeds(string boardId, int skip, int count)
        {
            HttpResponseMessage response = await WebApiReq.GetReq("/api/BoardMe/getInstagramFeeds?boardId=" + boardId + "&skip=" + skip + "&count=" + count, "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    var boardInstagramFeeds = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Mongo.MongoBoardInstagramFeeds> >();

                    return(View(boardInstagramFeeds));
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex.StackTrace);
                }
            }

            return(View());
        }
        // GET: /<controller>/
        public async Task <IActionResult> ManagePaidUser()
        {
            List <Domain.Socioboard.Models.User> user = new List <Domain.Socioboard.Models.User>();


            HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetPaidUserAdmin", "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                user = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.User> >();
            }
            List <Domain.Socioboard.Models.PiadUser> paidUser = new List <PiadUser>();
            string   month = string.Empty;
            DateTime date  = DateTime.UtcNow.AddDays(-(DateTime.UtcNow.Day - 1)).AddMonths(-11);

            do
            {
                try
                {
                    Domain.Socioboard.Models.PiadUser _paidUser = new PiadUser();
                    List <User> results = user.Where(t => t.CreateDate.Date > date.Date && t.CreateDate.Date < date.AddMonths(1).Date&& t.PaymentStatus == Domain.Socioboard.Enum.SBPaymentStatus.Paid).ToList();
                    _paidUser.month    = date.ToString("MMM yy");
                    _paidUser.paiduser = results.Count();
                    paidUser.Add(_paidUser);
                }
                catch (Exception ex)
                {
                }


                date = date.AddMonths(1);
            }while (DateTime.Now.AddMonths(1).Month != date.Month);

            string abc = JsonConvert.SerializeObject(paidUser);

            return(Json(abc));

            //return Json(user);
        }
        //public ActionResult AddTeamMember(string email)
        //{
        //    string response = string.Empty;

        //    User objUser = (User)Session["User"];
        //    string selectedgroupid = Session["selectedgroupid"].ToString();
        //    Api.Team.Team ApiobjTeam = new Api.Team.Team();
        //    Api.User.User ApiobjUser = new Api.User.User();
        //    User objuserinfo = (User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(email), typeof(User)));
        //    if (objuserinfo != null)
        //    {
        //        string[] name = objuserinfo.UserName.Split(' ');
        //        string fname = name[0];
        //        string lname = string.Empty;
        //        for (int i = 1; i < name.Length; i++)
        //        {
        //            lname += name[i];
        //        }
        //       response = ApiobjTeam.AddTeam(objuserinfo.Id.ToString(), "0", fname, lname, email, "", selectedgroupid, objUser.EmailId, objUser.UserName);
        //    }
        //    else
        //    {
        //        response = ApiobjTeam.AddTeam(Guid.NewGuid().ToString(), "0", "", "", email, "", selectedgroupid, objUser.EmailId, objUser.UserName);
        //    }
        //    //return Content("_AcceptedUserPartial");
        //    return Content(response);
        //}

        // Edited by Antima[6/11/2014]

        public async Task <ActionResult> AddTeamMember(string email)
        {
            string selectedgroupid = string.Empty;
            string SentMails       = string.Empty;
            User   objUser         = (User)Session["user"];

            if (Session["selectedgroupid"] == null || Session["selectedgroupid"] == "")
            {
                selectedgroupid = Request.QueryString["groupid"];
            }
            else
            {
                selectedgroupid = Session["selectedgroupid"].ToString();
            }

            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGroupMembers/AddGroupMembers?Emails=" + email + "&GroupId=" + selectedgroupid + "&UserId=" + objUser.Id, "Bearer", Session["access_token"].ToString());

            if (response.IsSuccessStatusCode)
            {
                SentMails = await response.Content.ReadAsAsync <string>();
            }

            return(Content(SentMails));
        }
        // GET: /<controller>/
        public async Task <IActionResult> GetSchedulemessage()
        {
            Domain.Socioboard.Models.User user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (user == null)
            {
                return(RedirectToAction("Index", "Index"));
            }
            else
            {
                List <Domain.Socioboard.Models.ScheduledMessageAdmin> schemsg = new List <Domain.Socioboard.Models.ScheduledMessageAdmin>();
                HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetSchedulemsgAdmin", "", "", _appSettings.ApiDomain);

                if (response.IsSuccessStatusCode)
                {
                    schemsg = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.ScheduledMessageAdmin> >();
                }
                ViewBag.details   = schemsg;
                ViewBag.ApiDomain = _appSettings.ApiDomain;
                ViewBag.Domain    = _appSettings.Domain;
                return(View("AdminSehduledMesssage"));
            }

            //return Json(user);
        }
        public async Task <ActionResult> AddGoogleAccount(string Op)
        {
            int    count        = 0;
            string profileCount = "";
            List <Domain.Socioboard.Models.Groups> groups = new List <Domain.Socioboard.Models.Groups>();

            Domain.Socioboard.Models.User user     = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            HttpResponseMessage           response = await WebApiReq.GetReq("/api/Groups/GetUserGroups?userId=" + user.Id, "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    groups = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groups> >();
                }
                catch { }
            }
            string sessionSelectedGroupId = HttpContext.Session.GetObjectFromJson <string>("selectedGroupId");

            if (!string.IsNullOrEmpty(sessionSelectedGroupId))
            {
                HttpResponseMessage groupProfilesResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetGroupProfiles?groupId=" + sessionSelectedGroupId, "", "", _appSettings.ApiDomain);

                if (groupProfilesResponse.IsSuccessStatusCode)
                {
                    List <Domain.Socioboard.Models.Groupprofiles> groupProfiles = await groupProfilesResponse.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groupprofiles> >();

                    profileCount = groupProfiles.Count.ToString();
                }
            }
            else
            {
                long selectedGroupId = groups.FirstOrDefault(t => t.groupName == Domain.Socioboard.Consatants.SocioboardConsts.DefaultGroupName).id;
                HttpContext.Session.SetObjectAsJson("selectedGroupId", selectedGroupId);
                ViewBag.selectedGroupId = selectedGroupId;
                HttpResponseMessage groupProfilesResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetGroupProfiles?groupId=" + selectedGroupId, "", "", _appSettings.ApiDomain);

                if (groupProfilesResponse.IsSuccessStatusCode)
                {
                    List <Domain.Socioboard.Models.Groupprofiles> groupProfiles = await groupProfilesResponse.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groupprofiles> >();

                    profileCount = groupProfiles.Count.ToString();
                }
            }
            //string profileCount = await ProfilesHelper.GetUserProfileCount(user.Id, _appSettings, _logger);
            try
            {
                count = Convert.ToInt32(profileCount);
            }
            catch (Exception ex)
            {
                TempData["Error"] = "Error while getting profile count.";
                return(RedirectToAction("Index", "Home"));
            }

            int MaxCount = Domain.Socioboard.Helpers.SBHelper.GetMaxProfileCount(user.AccountType);

            if (count >= MaxCount)
            {
                TempData["Error"] = "Max profile Count reached.";
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if (string.IsNullOrEmpty(Op))
                {
                    HttpContext.Session.SetObjectAsJson("Google", "Gplus_Account");
                    string googleurl = "https://accounts.google.com/o/oauth2/auth?client_id=" + _appSettings.GoogleConsumerKey + "&redirect_uri=" + _appSettings.GoogleRedirectUri + "&scope=https://www.googleapis.com/auth/youtube+https://www.googleapis.com/auth/youtube.readonly+https://www.googleapis.com/auth/youtubepartner+https://www.googleapis.com/auth/youtubepartner-channel-audit+https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+https://www.googleapis.com/auth/plus.me&response_type=code&access_type=offline&approval_prompt=force";
                    return(Redirect(googleurl));
                }
                else if (Op == "page")
                {
                    HttpContext.Session.SetObjectAsJson("Google", "Ganalytics_Account");
                    string googleurl = "https://accounts.google.com/o/oauth2/auth?approval_prompt=force&access_type=offline&client_id=" + _appSettings.GoogleConsumerKey + "&redirect_uri=" + _appSettings.GoogleRedirectUri + "&scope=https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+https://www.googleapis.com/auth/analytics+https://www.googleapis.com/auth/analytics.edit+https://www.googleapis.com/auth/analytics.readonly&response_type=code";
                    return(Redirect(googleurl));
                }
                else
                {
                    HttpContext.Session.SetObjectAsJson("Google", "Youtube_Account");
                    string googleurl = "https://accounts.google.com/o/oauth2/auth?client_id=" + "575089347457-74q0u81gj88ve5bfdmbklcf2dnc0353q.apps.googleusercontent.com" + "&redirect_uri=" + "http://localhost:9821/GoogleManager/Google" + "&scope=https://www.googleapis.com/auth/youtube+https://www.googleapis.com/auth/youtube.readonly+https://www.googleapis.com/auth/youtubepartner+https://www.googleapis.com/auth/youtubepartner-channel-audit+https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+https://www.googleapis.com/auth/plus.me&response_type=code&access_type=offline&approval_prompt=force";
                    return(Redirect(googleurl));
                }
            }
        }
        public async Task <ActionResult> AuthenticateLinkedin(string Op)
        {
            int    count = 0;
            Random ran   = new Random();
            int    x     = ran.Next(8976557);

            Domain.Socioboard.Models.User user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            string profileCount = "";
            List <Domain.Socioboard.Models.Groups> groups = new List <Domain.Socioboard.Models.Groups>();
            HttpResponseMessage response = await WebApiReq.GetReq("/api/Groups/GetUserGroups?userId=" + user.Id, "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    groups = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groups> >();
                }
                catch { }
            }
            string sessionSelectedGroupId = HttpContext.Session.GetObjectFromJson <string>("selectedGroupId");

            if (!string.IsNullOrEmpty(sessionSelectedGroupId))
            {
                HttpResponseMessage groupProfilesResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetGroupProfiles?groupId=" + sessionSelectedGroupId, "", "", _appSettings.ApiDomain);

                if (groupProfilesResponse.IsSuccessStatusCode)
                {
                    List <Domain.Socioboard.Models.Groupprofiles> groupProfiles = await groupProfilesResponse.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groupprofiles> >();

                    profileCount = groupProfiles.Count.ToString();
                }
            }
            else
            {
                long selectedGroupId = groups.FirstOrDefault(t => t.groupName == Domain.Socioboard.Consatants.SocioboardConsts.DefaultGroupName).id;
                HttpContext.Session.SetObjectAsJson("selectedGroupId", selectedGroupId);
                ViewBag.selectedGroupId = selectedGroupId;
                HttpResponseMessage groupProfilesResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetGroupProfiles?groupId=" + selectedGroupId, "", "", _appSettings.ApiDomain);

                if (groupProfilesResponse.IsSuccessStatusCode)
                {
                    List <Domain.Socioboard.Models.Groupprofiles> groupProfiles = await groupProfilesResponse.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groupprofiles> >();

                    profileCount = groupProfiles.Count.ToString();
                }
            }
            // string profileCount = await ProfilesHelper.GetUserProfileCount(user.Id, _appSettings, _logger);
            try
            {
                count = Convert.ToInt32(profileCount);
            }
            catch (Exception ex)
            {
                TempData["Error"] = "Error while getting profile count.";
                return(RedirectToAction("Index", "Home"));
            }

            int MaxCount = Domain.Socioboard.Helpers.SBHelper.GetMaxProfileCount(user.AccountType);

            if (count >= MaxCount)
            {
                TempData["Error"] = "Max profile Count reached.";
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if (string.IsNullOrEmpty(Op))
                {
                    HttpContext.Session.SetObjectAsJson("linSocial", "lin_Account");
                    return(Redirect("https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=" + _appSettings.LinkedinApiKey + "&redirect_uri=" + _appSettings.LinkedinCallBackURL + "&state=" + x.ToString() + "&?scope=r_basicprofile+w_share"));
                }
                else
                {
                    HttpContext.Session.SetObjectAsJson("linSocial", "lin_Page");
                    return(Redirect("https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=" + _appSettings.LinkedinApiKey + "&redirect_uri=" + _appSettings.LinkedinCallBackURL + "&state=" + x.ToString() + "&?scope=r_basicprofile+w_share+rw_company_admin"));
                }
            }
        }
Example #25
0
        // GET: /<controller>/
        public async Task <IActionResult> ManageUser(string param)
        {
            Domain.Socioboard.Models.User _user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (_user == null)
            {
                return(RedirectToAction("Index", "Index"));
            }
            else
            {
                Domain.Socioboard.Models.UserDetails user = new Domain.Socioboard.Models.UserDetails();
                if (param == null)
                {
                    if (j == 0)
                    {
                        try
                        {
                            HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdmin?value=" + 0, "", "", _appSettings.ApiDomain);

                            if (response.IsSuccessStatusCode)
                            {
                                user = await response.Content.ReadAsAsync <Domain.Socioboard.Models.UserDetails>();
                            }
                            //count = 100;
                            //j = j + 500;
                            // ViewBag.Count = user.Count();
                            ViewBag.TotalCount = user.count;
                            ViewBag.Count      = user._user.Count();
                            ViewBag.details    = user._user;
                            ViewBag.ApiDomain  = _appSettings.ApiDomain;
                            ViewBag.Domain     = _appSettings.Domain;
                            return(View("ManageUser"));
                        }
                        catch (Exception ex)
                        {
                            return(View("ManageUser"));
                        }
                    }
                    else
                    {
                        HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdmin?value=" + j, "", "", _appSettings.ApiDomain);

                        if (response.IsSuccessStatusCode)
                        {
                            user = await response.Content.ReadAsAsync <Domain.Socioboard.Models.UserDetails>();
                        }
                        // j = j + 500;
                        ViewBag.details    = user._user;
                        ViewBag.Count      = user._user.Count() + j;
                        ViewBag.TotalCount = user.count;
                        ViewBag.ApiDomain  = _appSettings.ApiDomain;
                        ViewBag.Domain     = _appSettings.Domain;
                        return(View("ManageUser"));
                    }
                }
                else if (param == "Next")
                {
                    j = j + 500;
                    return(RedirectToAction("ManageUser"));
                }
                else
                {
                    j = j - 500;
                    return(RedirectToAction("ManageUser"));
                }



                //HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdmin", "", "", _appSettings.ApiDomain);
                //if (response.IsSuccessStatusCode)
                //{
                //    user = await response.Content.ReadAsAsync<List<Domain.Socioboard.Models.User>>();

                //}
                //ViewBag.details = user;
                //ViewBag.ApiDomain = _appSettings.ApiDomain;
                //ViewBag.Domain = _appSettings.Domain;
                //return View("ManageUser");
            }


            //return Json(user);
        }
        public async Task <IActionResult> PaymentSuccessful()
        {
            var authToken = _appSettings.PaypalPdtToken;
            var txToken   = Utils.GetBetween(Request.QueryString + "<:>$", "&tx=", "<:>$");

            //Post back to either sandbox or live
            var paypalUrl = $"{_appSettings.PaypalURL}/cgi-bin/webscr";

            var successResult = VerifyPdt(authToken, "99X63908G1498834B", paypalUrl);

            // var successResult = VerifyPdt(authToken, txToken, paypalUrl);

            if (successResult.Count > 0)
            {
                var user    = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
                var package = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.Package>("Package");

                #region Fetching the details from Paypal

                #endregion

                var plan = package.packagename;

                var paidAmount = successResult["payment_gross"];

                var paidDate      = successResult["payment_date"];
                var paymentDate   = DateTime.Parse(paidDate.Replace(" PDT", "").Replace(" PST", ""));
                var payerEmail    = successResult["payer_email"];
                var payerName     = $"{successResult["first_name"]} {successResult["last_name"]}";
                var paymentStatus = successResult["payment_status"];
                var itemName      = successResult["item_name"];
                var charset       = successResult["charset"];

                var subscriptionId = string.Empty;

                if (successResult.ContainsKey("subscr_id"))
                {
                    subscriptionId = successResult["subscr_id"];
                }


                var parameters = new List <KeyValuePair <string, string> > {
                    new KeyValuePair <string, string>("userId", user.Id.ToString()),
                    new KeyValuePair <string, string>("UserName", user.FirstName + " " + user.LastName),
                    new KeyValuePair <string, string>("email", user.EmailId),
                    new KeyValuePair <string, string>("amount", paidAmount),
                    new KeyValuePair <string, string>("PaymentType", user.PaymentType.ToString()),
                    new KeyValuePair <string, string>("trasactionId", txToken),
                    new KeyValuePair <string, string>("paymentId", subscriptionId),
                    new KeyValuePair <string, string>("accType", plan),
                    new KeyValuePair <string, string>("subscr_date", paymentDate.ToString(CultureInfo.InvariantCulture)),
                    new KeyValuePair <string, string>("payer_email", payerEmail),
                    new KeyValuePair <string, string>("Payername", payerName),
                    new KeyValuePair <string, string>("payment_status", paymentStatus),
                    new KeyValuePair <string, string>("item_name", itemName),
                    new KeyValuePair <string, string>("media", charset)
                };

                var response = await WebApiReq.PostReq("/api/PaymentTransaction/UpgradeAccount", parameters, "", "", _appSettings.ApiDomain);

                if (response.IsSuccessStatusCode)
                {
                    try
                    {
                        var data = await response.Content.ReadAsStringAsync();

                        if (data == "payment done")
                        {
                            var responseMessage = await WebApiReq.GetReq("/api/User/GetUser?Id=" + user.Id, "", "", _appSettings.ApiDomain);

                            if (response.IsSuccessStatusCode)
                            {
                                try
                                {
                                    var userCurrentDetails = await responseMessage.Content.ReadAsAsync <Domain.Socioboard.Models.User>();

                                    if (user.ReferralStatus == "InActive" && user.ReferdBy != null)
                                    {
                                        await WebApiReq.PostReq("/api/User/UpdateRefrralStatus", parameters, "", "", _appSettings.ApiDomain);
                                    }

                                    HttpContext.Session.SetObjectAsJson("User", userCurrentDetails);

                                    return(RedirectToAction("Index", "Index"));
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        return(RedirectToAction("Index", "Index"));
                    }
                }
            }

            var output = "false";

            return(Content(output));
        }
        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"));
        }
        public async Task <IActionResult> PaymentSuccessful()
        {
            string output = "false";
            string plan   = "";

            Domain.Socioboard.Models.User    user     = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            Domain.Socioboard.Models.Package _Package = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.Package>("Package");
            string trasactionId = Generatetxnid();
            string paymentId    = Request.Form["subscr_id"];

            if (_Package.packagename == "Free")
            {
                plan = "Free";
            }
            else if (_Package.packagename == "Deluxe")
            {
                plan = "Deluxe";
            }
            else if (_Package.packagename == "Premium")
            {
                plan = "Premium";
            }
            else if (_Package.packagename == "Topaz")
            {
                plan = "Topaz";
            }
            else if (_Package.packagename == "Platinum")
            {
                plan = "Platinum";
            }
            else if (_Package.packagename == "Gold")
            {
                plan = "Gold";
            }
            else if (_Package.packagename == "Ruby")
            {
                plan = "Ruby";
            }
            else if (_Package.packagename == "Standard")
            {
                plan = "Standard";
            }
            List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >();

            Parameters.Add(new KeyValuePair <string, string>("userId", user.Id.ToString()));
            Parameters.Add(new KeyValuePair <string, string>("UserName", user.FirstName + " " + user.LastName));
            Parameters.Add(new KeyValuePair <string, string>("email", user.EmailId));
            Parameters.Add(new KeyValuePair <string, string>("amount", _Package.amount));
            Parameters.Add(new KeyValuePair <string, string>("PaymentType", user.PaymentType.ToString()));
            Parameters.Add(new KeyValuePair <string, string>("trasactionId", trasactionId));
            Parameters.Add(new KeyValuePair <string, string>("paymentId", paymentId));
            Parameters.Add(new KeyValuePair <string, string>("accType", plan));
            HttpResponseMessage response = await WebApiReq.PostReq("/api/PaymentTransaction/UpgradeAccount", Parameters, "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    string data = await response.Content.ReadAsStringAsync();

                    if (data == "payment done")
                    {
                        List <KeyValuePair <string, string> > _Parameters = new List <KeyValuePair <string, string> >();
                        //_Parameters.Add(new KeyValuePair<string, string>("Id", user.Id.ToString()));
                        HttpResponseMessage _response = await WebApiReq.GetReq("/api/User/GetUser?Id=" + user.Id.ToString(), "", "", _appSettings.ApiDomain);

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

                                HttpContext.Session.SetObjectAsJson("User", _user);
                                return(RedirectToAction("Index", "Index"));
                            }
                            catch { }
                        }
                    }
                }
                catch (Exception e)
                {
                    return(RedirectToAction("Index", "Index"));
                }
            }
            return(Content(output));
        }
        public async Task <IActionResult> AddTwitterAccount(bool follow)
        {
            try
            {
                var count        = 0;
                var profileCount = string.Empty;
                var groups       = new List <Domain.Socioboard.Models.Groups>();
                var user         = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
                var response     = await WebApiReq.GetReq("/api/Groups/GetUserGroups?userId=" + user.Id, "", "", _appSettings.ApiDomain);

                if (response.IsSuccessStatusCode)
                {
                    try
                    {
                        groups = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groups> >();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                var sessionSelectedGroupId = HttpContext.Session.GetObjectFromJson <string>("selectedGroupId");

                if (!string.IsNullOrEmpty(sessionSelectedGroupId))
                {
                    var groupProfilesResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetAllGroupProfiles?groupId=" + sessionSelectedGroupId, "", "", _appSettings.ApiDomain);

                    if (groupProfilesResponse.IsSuccessStatusCode)
                    {
                        var groupProfiles = await groupProfilesResponse.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groupprofiles> >();

                        profileCount = groupProfiles.Count.ToString();
                    }
                }
                else
                {
                    var selectedGroupId = groups.FirstOrDefault(t => t.groupName == Domain.Socioboard.Consatants.SocioboardConsts.DefaultGroupName).id;
                    HttpContext.Session.SetObjectAsJson("selectedGroupId", selectedGroupId);
                    ViewBag.selectedGroupId = selectedGroupId;
                    var groupProfilesResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetAllGroupProfiles?groupId=" + selectedGroupId, "", "", _appSettings.ApiDomain);

                    if (groupProfilesResponse.IsSuccessStatusCode)
                    {
                        var groupProfiles = await groupProfilesResponse.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groupprofiles> >();

                        profileCount = groupProfiles.Count.ToString();
                    }
                }

                // string profileCount = await ProfilesHelper.GetUserProfileCount(user.Id, _appSettings, _logger);
                try
                {
                    count = Convert.ToInt32(profileCount);
                }
                catch (Exception)
                {
                    TempData["Error"] = "Error while getting profile count.";
                    return(RedirectToAction("Index", "Home"));
                }

                var MaxCount = Domain.Socioboard.Helpers.SBHelper.GetMaxProfileCount(user.AccountType);

                if (count >= MaxCount)
                {
                    TempData["Error"] = "Max profile Count reached.";
                    return(RedirectToAction("Index", "Home"));
                }

                HttpContext.Session.SetObjectAsJson("Twitter", follow ? "Twitter_Account_Follow" : "Twitter_Account");

                var credentials = new OAuthCredentials
                {
                    Type              = OAuthType.RequestToken,
                    SignatureMethod   = OAuthSignatureMethod.HmacSha1,
                    ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
                    ConsumerKey       = _appSettings.twitterConsumerKey,
                    ConsumerSecret    = _appSettings.twitterConsumerScreatKey,
                    CallbackUrl       = _appSettings.twitterRedirectionUrl
                };

                // Use Hammock to create a rest client
                var client = new RestClient
                {
                    Authority   = "https://api.twitter.com/oauth",
                    Credentials = credentials,
                };

                // Use Hammock to create a request
                var request = new RestRequest
                {
                    Path = "request_token"
                };

                // Get the response from the request
                var _response  = client.Request(request);
                var collection = HttpUtility.ParseQueryString(_response.Content);

                string rest = "https://api.twitter.com/oauth/authorize?oauth_token=" + collection[0];
                HttpContext.Session.SetObjectAsJson("requestSecret", collection[1]);

                return(Redirect(rest));
            }

            catch (Exception e)
            {
                _logger.LogError(e.Message);
                return(Ok(e.Message));
            }
        }
Example #30
0
        public async Task <ActionResult> AddFacebookAcc(string Op)
        {
            int    count        = 0;
            string profileCount = "";
            List <Domain.Socioboard.Models.Groups> groups = new List <Domain.Socioboard.Models.Groups>();

            Domain.Socioboard.Models.User user     = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            HttpResponseMessage           response = await WebApiReq.GetReq("/api/Groups/GetUserGroups?userId=" + user.Id, "", "", _appSettings.ApiDomain);

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    groups = await response.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groups> >();
                }
                catch { }
            }
            string sessionSelectedGroupId = HttpContext.Session.GetObjectFromJson <string>("selectedGroupId");

            if (!string.IsNullOrEmpty(sessionSelectedGroupId))
            {
                HttpResponseMessage groupProfilesResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetGroupProfiles?groupId=" + sessionSelectedGroupId, "", "", _appSettings.ApiDomain);

                if (groupProfilesResponse.IsSuccessStatusCode)
                {
                    List <Domain.Socioboard.Models.Groupprofiles> groupProfiles = await groupProfilesResponse.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groupprofiles> >();

                    profileCount = groupProfiles.Count.ToString();
                }
            }
            else
            {
                long selectedGroupId = groups.FirstOrDefault(t => t.groupName == Domain.Socioboard.Consatants.SocioboardConsts.DefaultGroupName).id;
                HttpContext.Session.SetObjectAsJson("selectedGroupId", selectedGroupId);
                ViewBag.selectedGroupId = selectedGroupId;
                HttpResponseMessage groupProfilesResponse = await WebApiReq.GetReq("/api/GroupProfiles/GetGroupProfiles?groupId=" + selectedGroupId, "", "", _appSettings.ApiDomain);

                if (groupProfilesResponse.IsSuccessStatusCode)
                {
                    List <Domain.Socioboard.Models.Groupprofiles> groupProfiles = await groupProfilesResponse.Content.ReadAsAsync <List <Domain.Socioboard.Models.Groupprofiles> >();

                    profileCount = groupProfiles.Count.ToString();
                }
            }
            //  string profileCount = await ProfilesHelper.GetUserProfileCount(user.Id, _appSettings, _logger);
            try
            {
                count = Convert.ToInt32(profileCount);
            }
            catch (Exception ex)
            {
                TempData["Error"] = "Error while getting profile count.";
                return(RedirectToAction("Index", "Home"));
            }

            int MaxCount = Domain.Socioboard.Helpers.SBHelper.GetMaxProfileCount(user.AccountType);

            if (count >= MaxCount)
            {
                TempData["Error"] = "Max profile Count reached.";
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if (string.IsNullOrEmpty(Op))
                {
                    HttpContext.Session.SetObjectAsJson("fbSocial", "Fb_Account");
                }
                else
                {
                    HttpContext.Session.SetObjectAsJson("fbSocial", "Fb_Page");
                }
                return(Redirect(Socioboard.Facebook.Auth.Authentication.GetFacebookRedirectLink(_appSettings.FacebookAuthUrl, _appSettings.FacebookClientId, _appSettings.FacebookRedirectUrl)));
            }
        }