예제 #1
0
        public ItemController()
        {
            UnitOfWorkManager unitOfWorkManager = new UnitOfWorkManager();

            this.itemManager        = new ItemManager(unitOfWorkManager);
            this.socialMediaManager = new SocialMediaManager(unitOfWorkManager);
        }
예제 #2
0
        public JsonResult DeleteLink(int id)
        {
            bool isdelete = SocialMediaManager.Delete(id);

            //if (isdelete)
            return(Json(isdelete));
            //  else return false;
        }
예제 #3
0
        public JsonResult SortRecords(string list)
        {
            JsonList psl = (new JavaScriptSerializer()).Deserialize <JsonList>(list);

            string[] idsList  = psl.list;
            bool     issorted = SocialMediaManager.SortRecords(idsList);

            return(Json(issorted));
        }
예제 #4
0
        protected BasicController()
        {
            UnitOfWorkManager unitOfWorkManager = new UnitOfWorkManager();

            SocialMediaManager = new SocialMediaManager(unitOfWorkManager);
            AlertManager       = new AlertManager(unitOfWorkManager);
            UserManager        = new ApplicationUserManager(unitOfWorkManager);
            UserManager.SetSocialMediaManager(SocialMediaManager);
            ChartManager = new ChartManager(unitOfWorkManager);
        }
        public PageController()
        {
            UnitOfWorkManager unitOfWorkManager = new UnitOfWorkManager();

            this.im                 = new ItemManager(unitOfWorkManager);
            this.userManager        = new ApplicationUserManager(unitOfWorkManager);
            this.am                 = new AlertManager(unitOfWorkManager);
            this.socialMediaManager = new SocialMediaManager(unitOfWorkManager);
            this.chartManager       = new ChartManager(unitOfWorkManager);
        }
예제 #6
0
        public ActionResult Redirect()
        {
            if (Request.QueryString["code"] != null)
            {
                SocialMediaManager.getAccessToken();
            }
            string url = Session["SPUrl"].ToString();

            Response.Redirect(url);
            return(View("Publish"));
        }
예제 #7
0
        public IActionResult SocialMediaHub(PostViewModel model)
        {
            SocialMediaManager s = new SocialMediaManager();

            if (model.TwitterActive)
            {
                s.setSocialMedia(new TwitterConnector());
                if (CharacterLimitCheck(model.Message.Length))
                {
                    s.createPost(model.Message, null);
                }
            }

            return(RedirectToAction("SocialMediaHub"));
        }
예제 #8
0
 public ActionResult Add(SocialMedia model, HttpPostedFileBase uploadfile)
 {
     //if (ModelState.IsValid)
     //{
     if (uploadfile != null && uploadfile.ContentLength > 0)
     {
         Random random = new Random();
         int    rand   = random.Next(1000, 99999999);
         uploadfile.SaveAs(Server.MapPath("/Content/images/documents/" + Utility.SetPagePlug(model.Name) + "_" + rand + Path.GetExtension(uploadfile.FileName)));
         model.Logo = "/Content/images/socialmedia/" + Utility.SetPagePlug(model.Name) + "_" + rand + Path.GetExtension(uploadfile.FileName);
     }
     else
     {
         model.Logo = "Dosya Yok";
     }
     ModelState.Clear();
     ViewBag.ProcessMessage = SocialMediaManager.AddSocialMedia(model);
     //}
     return(View());
 }
예제 #9
0
 public ActionResult Edit()
 {
     if (RouteData.Values["id"] != null)
     {
         int  nid      = 0;
         bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
         if (isnumber)
         {
             SocialMedia media = SocialMediaManager.GetSocialMediaById(nid);
             return(View(media));
         }
         else
         {
             return(View());
         }
     }
     else
     {
         return(View());
     }
 }
        public IActionResult SocialMediaHub(PostViewModel model)
        {
            SocialMediaManager s = new SocialMediaManager();

            //string path = Path.Combine(_dir, "file.png");
            //model.MediaBinary = System.IO.File.ReadAllBytes(path);

            if (model.TwitterActive)
            {
                s.setSocialMedia(new TwitterConnector());

                if (model.Message == null)
                {
                    ViewBag.msg = "The message cannot be blank";
                }
                else if (CharacterLimitCheck(model.Message.Length))
                {
                    s.createPost(model.Message, model.MediaBinary);
                    ViewBag.msg = "Posted!";
                }
                else
                {
                    ViewBag.msg = "The message is over the character limit";
                }
            }

            if (model.FacebookActive)
            {
                s.setSocialMedia(new FacebookConnector());
                s.createPost(model.Message, null);
            }

            if (model.InstagramActive)
            {
                s.setSocialMedia(new InstagramConnector());
                s.createPost(model.Message, null);
            }

            return(View("SocialMediaHub"));
        }
예제 #11
0
        public ActionResult Publish()
        {
            if (Request.QueryString["SPHostUrl"] != null && Session["SPUrl"] == null)
            {
                Session["SPUrl"] = Request.Url.ToString();
            }

            if (Request.QueryString["publish"] == "1")
            {
                SocialMediaManager.loginToFacebook();
            }
            if (Request.QueryString["publish"] == "2")
            {
                Session["PostLinkedin"] = 1;
                string url = Session["SPUrl"].ToString();
                Response.Redirect(url);
            }

            if (Session["AccessToken"] != null)
            {
                SPManager.CurrentHttpContext = HttpContext;
                SPManager.ToSocialMedia("Facebook");
                Session["Facebook"]    = "√";
                Session["AccessToken"] = null;
            }

            if (Session["PostLinkedin"] != null)
            {
                SPManager.CurrentHttpContext = HttpContext;
                SPManager.ToSocialMedia("Linkedin");
                Session["LinkedIn"] = "√";
            }
            ViewBag.Facebook = Session["Facebook"];
            ViewBag.LinkedIn = Session["LinkedIn"];

            return(View());
        }
예제 #12
0
        public ActionResult Edit(SocialMedia media, HttpPostedFileBase uploadfile)
        {
            //if (ModelState.IsValid)
            //{
            if (uploadfile != null && uploadfile.ContentLength > 0)
            {
                Random random = new Random();
                int    rand   = random.Next(1000, 99999999);
                new ImageHelper(280, 240).SaveThumbnail(uploadfile, "/Content/images/mediainfo/", Utility.SetPagePlug(media.Name) + "_" + rand + Path.GetExtension(uploadfile.FileName));
                media.Logo = "/Content/images/socialmedia/" + Utility.SetPagePlug(media.Name) + "_" + rand + Path.GetExtension(uploadfile.FileName);
            }

            if (RouteData.Values["id"] != null)
            {
                int  nid      = 0;
                bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                if (isnumber)
                {
                    media.Id = nid;
                    ViewBag.ProcessMessage = SocialMediaManager.EditMedia(media);
                    return(View(media));
                }
                else
                {
                    ViewBag.ProcessMessage = false;
                    return(View(media));
                }
            }
            else
            {
                return(View());
            }
            //}
            //else
            //    return View();
        }
        private void ActivateApi()
        {
            var SocialMediaManager = new SocialMediaManager(unitOfWorkManager);

            SocialMediaManager.ActivateAPI();
        }
예제 #14
0
        //
        // GET: /Admin/SocialMedia/

        public ActionResult Index()
        {
            var list = SocialMediaManager.GetList();

            return(View(list));
        }
예제 #15
0
 public ItemController()
 {
     SocialMediaManager = new SocialMediaManager();
     UserManager        = new UserManager();
 }
예제 #16
0
 protected BasicController()
 {
     SocialMediaManager = new SocialMediaManager();
     UserManager        = HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>();
     UserManager.setSocialMediaManager(SocialMediaManager);
 }