コード例 #1
0
        public ActionResult ComposeMessageSend(string message, string allprofiles, string curdaatetimetime)
        {
            User objUser = (User)Session["User"];
            string groupid = Session["group"].ToString();
            Socioboard.Api.Groups.Groups ApiobjGroups = new Socioboard.Api.Groups.Groups();
            Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups)));
            string[] profileandidarr = Regex.Split(allprofiles, "<:>");
            var fi = Request.Files["file"];
            string file = string.Empty;


            //Get Dropbox Selected Images
            //string[] DropboxImg = null;
            //try
            //{
            //    DropboxImg = Request.Form["DropboxImg"].Split(',');
            //}
            //catch { };



            if (Request.Files.Count > 0)
            {
                if (fi != null)
                {
                    var path = Server.MapPath("~/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/upload");

                    // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                    file = path + "\\" + fi.FileName;
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    fi.SaveAs(file);
                    path = path + "\\" + fi.FileName;
                    logger.Error(path);
                }
            }
            foreach (var item in profileandidarr)
            {
                string[] profileandid = item.Split('~');
                string profiletype = profileandid[1];
                string profileid = profileandid[0];
                int DBXCount = 0;

            DbxNext:

                //if (!string.IsNullOrEmpty(DropboxImg[0]))
                //{
                //if (DropboxImg.Count() != 0 && DropboxImg.Count() >= DBXCount)
                //{
                //    file = DropboxImg[DBXCount];
                //    DBXCount++;
                //}
                //}
                try
                {

                    if (profiletype == "facebook")
                    {
                        Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook();
                        ApiobjFacebook.FacebookComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);

                    }
                    if (profiletype == "facebook_page")
                    {
                        Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook();
                        ApiobjFacebook.FacebookComposeMessageForPage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }

                    if (profiletype == "twitter")
                    {
                        Api.Twitter.Twitter ApiobjTwitter = new Api.Twitter.Twitter();
                        ApiobjTwitter.TwitterComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);

                    } if (profiletype == "linkedin")
                    {
                        Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin();
                        ApiobjLinkedin.LinkedinComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }
                    if (profiletype == "tumblr")
                    {
                        Api.Tumblr.Tumblr ApiobjTumblr = new Api.Tumblr.Tumblr();
                        ApiobjTumblr.TumblrComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }


                    Api.ScheduledMessage.ScheduledMessage objAddComposeSentMessage = new Api.ScheduledMessage.ScheduledMessage();
                    objAddComposeSentMessage.AddComposeMessage(objGroups.UserId.ToString(), profileid, profiletype, message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                //if (!string.IsNullOrEmpty(DropboxImg[0]))
                //{
                //    if (DBXCount < DropboxImg.Count())
                //    {
                //        goto DbxNext;
                //    }
                //}
            }
            return Content("");
        }
コード例 #2
0
        public async Task<ActionResult> ComposeMessageSend(string message, string allprofiles, string curdaatetimetime)
        {
            User objUser = (User)Session["User"];
            //curdaatetimetime = DateExtension.ToClientTime(DateTime.UtcNow);
            string groupid = Session["group"].ToString();
            Socioboard.Api.Groups.Groups ApiobjGroups = new Socioboard.Api.Groups.Groups();
            Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups)));
            string[] profileandidarr = Regex.Split(allprofiles, "<:>");
            var fi = Request.Files["file"];
            string file = string.Empty;


            //Get Dropbox Selected Images
            //string[] DropboxImg = null;
            //try
            //{
            //    DropboxImg = Request.Form["DropboxImg"].Split(',');
            //}
            //catch { };



            if (Request.Files.Count > 0)
            {
                if (fi != null)
                {
                    var path = Server.MapPath("~/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/upload");

                    // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                    file = path + "\\" + fi.FileName;
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    fi.SaveAs(file);
                    path = path + "\\" + fi.FileName;
                    logger.Error(path);
                }
            }
            foreach (var item in profileandidarr)
            {
                string[] profileandid = item.Split('~');
                string profiletype = profileandid[1];
                string profileid = profileandid[0];
                int DBXCount = 0;

            DbxNext:

                //if (!string.IsNullOrEmpty(DropboxImg[0]))
                //{
                //if (DropboxImg.Count() != 0 && DropboxImg.Count() >= DBXCount)
                //{
                //    file = DropboxImg[DBXCount];
                //    DBXCount++;
                //}
                //}
                try
                {

                    if (profiletype == "facebook")
                    {
                        Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook();
                        ApiobjFacebook.FacebookComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file,"");

                    }
                    if (profiletype == "facebook_page")
                    {
                        Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook();
                        ApiobjFacebook.FacebookComposeMessageForPage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file,"");
                    }

                    if (profiletype == "twitter")
                    {
                        Api.Twitter.Twitter ApiobjTwitter = new Api.Twitter.Twitter();
                        ApiobjTwitter.TwitterComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);

                    } if (profiletype == "linkedin")
                    {
                 string accesstoken = "";
                 string returndata = "";
                 List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>();
                 Parameters.Add(new KeyValuePair<string, string>("GroupId", Session["group"].ToString()));
                 Parameters.Add(new KeyValuePair<string, string>("comment", message));
                 Parameters.Add(new KeyValuePair<string, string>("UserId", objUser.Id.ToString()));
                 Parameters.Add(new KeyValuePair<string, string>("ImageUrl", file));
                 Parameters.Add(new KeyValuePair<string, string>("ProfileId", profileid));
                 if (Session["access_token"] != null)
                 {
                     accesstoken = Session["access_token"].ToString();
                 }
                 HttpResponseMessage response = await WebApiReq.PostReq("api/ApiLinkedIn/LinkedInProfileUpdate", Parameters, "Bearer", accesstoken);
                 if (response.IsSuccessStatusCode)
                 {
                     returndata = await response.Content.ReadAsAsync<string>();
                 }
                    }
                    if (profiletype == "tumblr")
                    {
                        Api.Tumblr.Tumblr ApiobjTumblr = new Api.Tumblr.Tumblr();
                        ApiobjTumblr.TumblrComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }


                    Api.ScheduledMessage.ScheduledMessage objAddComposeSentMessage = new Api.ScheduledMessage.ScheduledMessage();
                    objAddComposeSentMessage.AddComposeMessage(objGroups.UserId.ToString(), profileid, profiletype, message, file);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                //if (!string.IsNullOrEmpty(DropboxImg[0]))
                //{
                //    if (DBXCount < DropboxImg.Count())
                //    {
                //        goto DbxNext;
                //    }
                //}
            }
            return Content("");
        }
コード例 #3
0
        public ActionResult PluginComposeMessage()
        {
            Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook();

            string profile = Request.Form["profile"];
            string twitterText = Request.Form["twitterText"];
            string tweetId = Request.Form["tweetId"];
            string tweetUrl = Request.Form["tweetUrl"];
            string facebookText = Request.Form["facebookText"];
            string url = Request.Form["url"];
            string imgUrl = Request.Form["imgUrl"];
            string curdaatetimetime = DateTime.Now.ToString();
            User objUser = (User)Session["User"];
            string[] arrProfile = Regex.Split(profile, ",");

            foreach (string item in arrProfile)
            {
                string[] profile_id = item.Split('~');
                string profileType = profile_id[1];
                string profileId = profile_id[0];
                if (profileType == "facebook")
                {
                    ApiobjFacebook.FacebookComposeMessage(facebookText, profileId, objUser.Id.ToString(), curdaatetimetime, imgUrl, url);
                }
                else if (profileType == "facebook_page")
                {
                    ApiobjFacebook.FacebookComposeMessageForPage(facebookText, profileId, objUser.Id.ToString(), curdaatetimetime, imgUrl, url);
                }
                else if (profileType == "twitter")
                {
                    if (!string.IsNullOrEmpty(twitterText) || !string.IsNullOrEmpty(imgUrl))
                    {
                        twitterText = twitterText + " " + tweetUrl;
                        ApiobjTwitter.TwitterComposeMessage(twitterText, profileId, objUser.Id.ToString(), curdaatetimetime, imgUrl);
                    }
                    else
                    {
                        ApiobjTwitter.TwitterReteet_post(objUser.Id.ToString(), profileId, tweetId);
                    }
                }
            }
            return Content("success");
        }
コード例 #4
0
        public ActionResult ComposeMessageSend(string message, string allprofiles, string curdaatetimetime)
        {
            User   objUser = (User)Session["User"];
            string groupid = Session["group"].ToString();

            Socioboard.Api.Groups.Groups    ApiobjGroups = new Socioboard.Api.Groups.Groups();
            Domain.Socioboard.Domain.Groups objGroups    = (Domain.Socioboard.Domain.Groups)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups)));
            string[] profileandidarr = Regex.Split(allprofiles, "<:>");
            var      fi   = Request.Files["file"];
            string   file = string.Empty;


            //Get Dropbox Selected Images
            //string[] DropboxImg = null;
            //try
            //{
            //    DropboxImg = Request.Form["DropboxImg"].Split(',');
            //}
            //catch { };



            if (Request.Files.Count > 0)
            {
                if (fi != null)
                {
                    var path = Server.MapPath("~/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/upload");

                    // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                    file = path + "\\" + fi.FileName;
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    fi.SaveAs(file);
                    path = path + "\\" + fi.FileName;
                    logger.Error(path);
                }
            }
            foreach (var item in profileandidarr)
            {
                string[] profileandid = item.Split('~');
                string   profiletype  = profileandid[1];
                string   profileid    = profileandid[0];
                int      DBXCount     = 0;

DbxNext:

                //if (!string.IsNullOrEmpty(DropboxImg[0]))
                //{
                //if (DropboxImg.Count() != 0 && DropboxImg.Count() >= DBXCount)
                //{
                //    file = DropboxImg[DBXCount];
                //    DBXCount++;
                //}
                //}
                try
                {
                    if (profiletype == "facebook")
                    {
                        Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook();
                        ApiobjFacebook.FacebookComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }
                    if (profiletype == "facebook_page")
                    {
                        Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook();
                        ApiobjFacebook.FacebookComposeMessageForPage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }

                    if (profiletype == "twitter")
                    {
                        Api.Twitter.Twitter ApiobjTwitter = new Api.Twitter.Twitter();
                        ApiobjTwitter.TwitterComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }
                    if (profiletype == "linkedin")
                    {
                        Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin();
                        ApiobjLinkedin.LinkedinComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }
                    if (profiletype == "tumblr")
                    {
                        Api.Tumblr.Tumblr ApiobjTumblr = new Api.Tumblr.Tumblr();
                        ApiobjTumblr.TumblrComposeMessage(message, profileid, objGroups.UserId.ToString(), curdaatetimetime, file);
                    }


                    Api.ScheduledMessage.ScheduledMessage objAddComposeSentMessage = new Api.ScheduledMessage.ScheduledMessage();
                    objAddComposeSentMessage.AddComposeMessage(objGroups.UserId.ToString(), profileid, profiletype, message, file);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                //if (!string.IsNullOrEmpty(DropboxImg[0]))
                //{
                //    if (DBXCount < DropboxImg.Count())
                //    {
                //        goto DbxNext;
                //    }
                //}
            }
            return(Content(""));
        }