Task<StacManResponse<Post>> IPostMethods.GetByIds(string site, IEnumerable<int> ids, string filter = null, int? page = null, int? pagesize = null, DateTime? fromdate = null, DateTime? todate = null, Posts.Sort? sort = null, DateTime? mindate = null, DateTime? maxdate = null, int? min = null, int? max = null, Order? order = null)
        {
            var filterObj = ValidateAndGetFilter(filter);

            ValidateString(site, "site");
            ValidateEnumerable(ids, "ids");
            ValidatePaging(page, pagesize);
            ValidateSortMinMax(sort, mindate: mindate, maxdate: maxdate, min: min, max: max);

            var ub = new ApiUrlBuilder(String.Format("/posts/{0}", String.Join(";", ids)), useHttps: false);

            ub.AddParameter("site", site);
            ub.AddParameter("filter", filter);
            ub.AddParameter("page", page);
            ub.AddParameter("pagesize", pagesize);
            ub.AddParameter("fromdate", fromdate);
            ub.AddParameter("todate", todate);
            ub.AddParameter("sort", sort);
            ub.AddParameter("min", mindate);
            ub.AddParameter("max", maxdate);
            ub.AddParameter("min", min);
            ub.AddParameter("max", max);
            ub.AddParameter("order", order);

            return CreateApiTask<Post>(ub, filterObj, "/posts/{ids}");
        }
    public void VkNews(string s)
    {
        //print("vknews " + s);
        posts.Clear();
        var strings = s.Replace("<br>", "").Split(new[] { "###" }, StringSplitOptions.RemoveEmptyEntries);
        foreach (var a in strings)
        {
            try
            {
                var ss = a.Split(new[] { ";;;" }, StringSplitOptions.None);
                DateTime time = new DateTime(1970,1,1,0,0,0,0);
                time=time.AddSeconds(Int64.Parse(ss[2]));

                var item = new Posts() { msg = ss[0].Trim(), comments = Int32.Parse(ss[1]), date = time,id=ss[3], imageUrl = ss[4] };
                StartCoroutine(item.Load());
                posts.Add(item);
            }
            catch (System.Exception e) { Debug.LogError(e); }
        }
        Debug.Log("vknews " + strings.Length + ":" + posts.Count);
    }
    private IEnumerator StartLoadNews()
    {
        if (Application.isWebPlayer)
            yield return new WaitForSeconds(1);
        
        var w = new WWW("https://graph.facebook.com/trackracingonline/posts?access_token=261172830687941|d5mN7DtR-LQoNlBW9JFBL7gM_h4&fields=id,name,description,picture,comments,id");
        yield return w;
        if (posts.Count >0 && !isDebug)
            yield break;
        posts.Clear();
        print(w.url);
        var data = JsonMapper.ToObject(w.text);
        IEnumerable d = data["data"];
        foreach (JsonData a in d)
        {
            //var type = a["type"].ToString();
            //if (a["from"]["name"].ToString() == "Trackracing Online")
            //if (type == "video" || type == "status" || type == "link")
            {
                JsonData jsonData = a["name"];
                if (jsonData != null)
                {
                    var post = new Posts();
                    posts.Add(post);
                    //post.title = (a["name"]) + "";
                    post.id = a["id"].ToString().Split('_')[1];
                    post.imageUrl = Uri.UnescapeDataString(a["picture"] + "");
                    //print(post.imageUrl);
                    post.date = DateTime.Parse(a["created_time"].ToString());
                    post.msg = jsonData + "";
                    if (a["comments"] != null)
                        post.comments = a["comments"]["data"].Count;
                    StartCoroutine(post.Load());
                }
            }

        }
        
    }
        public bool IsUnread(string userName)
        {
            var audit = Audits.LastOrDefault(x => x.UserName == userName);

            return(audit == null || Posts.Any(x => x.CreatedDate > audit.AuditDate));
        }
Exemple #5
0
 public void AddPostRepo(Posts newPost)
 {
     postlist.Add(newPost);
 }
Exemple #6
0
 public Post_category(Posts p, Categories c, Blogs b)
 {
     this.id_blog     = b.id_block;
     this.id_post     = p.id_post;
     this.id_category = c.id_category;
 }
 public void DeletePost(Posts post)
 {
     _context.Remove(post);
 }
Exemple #8
0
        public IActionResult Confirm_Sell(int id, int act, int size, int idPost = 0)
        {
            //Sell
            if (act == 0)
            {
                if (String.IsNullOrEmpty(HttpContext.Session.GetInt32("idUser").ToString()))
                {
                    return(RedirectToAction("Index", "Login"));
                }

                if (idPost == 0)
                {
                    idPost = JsonConvert.DeserializeObject <int>(_api.getAPI("api/SizesAPI/TakeIdPost_ForOrder/" + id + "/" + size + "/2").Result);
                }

                Orders orders = new Orders();

                orders.time        = DateTime.Now;
                orders.address     = HttpContext.Session.GetString("sell_address").ToString();
                orders.phone       = HttpContext.Session.GetString("sell_phone").ToString();
                orders.status      = 0;
                orders.id_user     = HttpContext.Session.GetInt32("idUser").Value;
                orders.id_post     = Convert.ToInt32(idPost);
                orders.service_fee = Convert.ToDouble(HttpContext.Session.GetString("sell_service_fee"));
                orders.payment_pro = Convert.ToDouble(HttpContext.Session.GetString("sell_payment_fee"));
                orders.price       = Convert.ToDouble(HttpContext.Session.GetString("sell_total_price"));
                orders.id_city     = Convert.ToInt32(HttpContext.Session.GetString("sell_id_city"));

                if (HttpContext.Session.GetString("sell_payment").ToString() == "Credit / Debit")
                {
                    orders.payment = 2;
                }
                else
                if (HttpContext.Session.GetString("sell_payment").ToString() == "Cash On Deliery (COD)")
                {
                    orders.payment = 1;
                }

                //Send Mail
                var    email_post = _api.getAPI("api/PostsAPI/SelectEmailUser/" + idPost).Result;
                Mailer ml         = new Mailer();
                ml.SendMail("Exaxxi Site", "*****@*****.**", "Sell Product", "Your selling has something new. Please check details in your account!");

                if (_api.postAPI(orders, "api/OrdersChange").Result)
                {
                    //update after sell
                    var post = JsonConvert.DeserializeObject <Posts>(_api.getAPI("api/PostsAPI/" + idPost).Result);
                    post.status = 1;
                    _api.putAPI(post, "api/PostsChange/" + idPost);
                    var id_size = JsonConvert.DeserializeObject <int>(_api.getAPI("api/SizesAPI/TakeIdSize_ForBid/" + id + "/" + size).Result);
                    UpdatePrice(id, id_size);

                    return(RedirectToAction("Index", "User"));
                }
            }

            //Ask
            if (act == 1)
            {
                if (String.IsNullOrEmpty(HttpContext.Session.GetInt32("idUser").ToString()))
                {
                    return(RedirectToAction("Index", "Login"));
                }
                double price  = Convert.ToDouble(HttpContext.Session.GetString("sell_enter_ask").ToString());
                var    idSize = JsonConvert.DeserializeObject(_api.getAPI("api/SizesAPI/TakeIdSize_ForBid/" + id + "/" + size).Result);

                if (_api.getAPI("api/PostsAPI/FindPostMatchForAsk/" + idSize + "/" + price).Result != null)
                {
                    var postmatch = JsonConvert.DeserializeObject <Posts>(_api.getAPI("api/PostsAPI/FindPostMatchForAsk/" + idSize + "/" + price).Result);
                    return(Confirm_Sell(id, 0, size, postmatch.id));
                }
                else
                {
                    Posts posts = new Posts();

                    posts.price      = price;
                    posts.date_start = DateTime.Now;

                    //Xử Lý End Date
                    int      day       = Convert.ToInt16(HttpContext.Session.GetString("sell_exp_day").ToString());
                    DateTime now       = DateTime.Now;
                    DateTime final_day = now.AddDays(day);

                    posts.date_end = final_day;

                    posts.kind        = 1;
                    posts.id_size     = Convert.ToInt32(idSize);
                    posts.id_user     = HttpContext.Session.GetInt32("idUser").Value;
                    posts.status      = 0;
                    posts.address     = HttpContext.Session.GetString("sell_address").ToString();
                    posts.phone       = HttpContext.Session.GetString("sell_phone").ToString();
                    posts.name_client = HttpContext.Session.GetString("sell_account").ToString();
                    posts.id_city     = Convert.ToInt32(HttpContext.Session.GetString("sell_id_city"));
                    if (_api.postAPI(posts, "api/PostsChange").Result)
                    {
                        UpdatePrice(id, Convert.ToInt32(idSize));
                        return(RedirectToAction("Index", "User"));
                    }
                }
            }

            return(View());
        }
Exemple #9
0
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            var pi = new PostpramsInfo();

            pi.Fid                    = this.forum.Fid;
            pi.Tid                    = this.topicid;
            pi.Jammer                 = this.forum.Jammer;
            pi.Pagesize               = this.ppp;
            pi.Pageindex              = this.pageid;
            pi.Getattachperm          = this.forum.Getattachperm;
            pi.Usergroupid            = this.usergroupid;
            pi.Attachimgpost          = this.config.Attachimgpost;
            pi.Showattachmentpath     = this.config.Showattachmentpath;
            pi.Price                  = price;
            pi.Usergroupreadaccess    = ((this.ismoder == 1) ? 0x7FFFFFFF : this.usergroupinfo.Readaccess);
            pi.CurrentUserid          = this.userid;
            pi.Showimages             = this.forum.Allowimgcode;
            pi.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            pi.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            pi.Smiliesmax             = this.config.Smiliesmax;
            pi.Bbcodemode             = this.config.Bbcodemode;
            pi.CurrentUserGroup       = this.usergroupinfo;
            //pi.Topicinfo = this.topic.Cast<TopicInfo>();
            pi.Hide          = ((this.topic.Hide >= 1) ? ((this.ismoder == 1 || Post.IsReplier(this.topicid, this.userid)) ? -1 : this.topic.Hide) : this.topic.Hide);
            pi.Hide          = ((this.topic.PosterID == this.userid) ? -2 : pi.Hide);
            this.hide        = pi.Hide;
            pi.Condition     = Posts.GetPostPramsInfoCondition(this.onlyauthor, this.topicid, this.posterid);
            pi.TemplateWidth = Template.GetWidth(this.templatepath);
            pi.Usercredits   = ((this.userInfo == null) ? 0 : this.userInfo.Credits);
            pi.Invisible     = this.invisible;
            switch (this.stand)
            {
            case 0:
                this.postlist = Posts.GetPostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;

            case 1:
                this.postlist = Debates.GetPositivePostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;

            case 2:
                this.postlist = Debates.GetNegativePostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;
            }
            if (this.topic.Special == 4)
            {
                string text = "";
                foreach (var item in this.postlist)
                {
                    text = text + item.ID + ",";
                }
                var postDiggs = Debates.GetPostDiggs(text.Trim(','));
                foreach (var item in this.postlist)
                {
                    if (postDiggs.ContainsKey(item.ID))
                    {
                        item.Diggs = postDiggs[item.ID];
                    }
                }
            }
            if (this.postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(this.topicid.ToString());
                this.topic = base.GetTopicInfo();
                this.BindPageCountAndId();
                pi.Pageindex  = this.pagecount;
                this.postlist = Posts.GetPostList(pi, out this.attachmentlist, this.ismoder == 1);
            }
            foreach (var current3 in this.attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(this.forum.Permuserlist, this.userid))
                {
                    current3.Getattachperm = 1;
                    current3.AllowRead     = true;
                }
            }
            base.BindDownloadAttachmentTip();
            return(pi);
        }
 public Task <int> DeletePostsAsync(Posts sPost)
 {
     return(_database.DeleteAsync(sPost));
 }
Exemple #11
0
        /// <summary>
        /// 获得板块列表
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ForumInfo[] GetForumArray(string type)
        {
            IDataReader reader = null;

            switch (type)
            {
            case "topics":
                reader = DatabaseProvider.GetInstance().GetForumsByTopicCount(20);
                break;

            case "posts":
                reader = DatabaseProvider.GetInstance().GetForumsByPostCount(20);
                break;

            case "thismonth":
                reader = DatabaseProvider.GetInstance().GetForumsByMonthPostCount(20, Posts.GetPostTableID());
                break;

            case "today":
                reader = DatabaseProvider.GetInstance().GetForumsByDayPostCount(20, Posts.GetPostTableID());
                break;
            }
            if (reader == null)
            {
                return(new ForumInfo[0]);
            }
#if NET1
            ArrayList list = new ArrayList();
#else
            List <ForumInfo> list = new List <ForumInfo>();
#endif
            while (reader.Read())
            {
                ForumInfo f = new ForumInfo();
                f.Fid  = Utils.StrToInt(reader["fid"], 0);
                f.Name = reader["name"].ToString();
                if (type == "topics")
                {
                    f.Topics = Utils.StrToInt(reader["topics"], 0);
                }
                else
                {
                    f.Posts = Utils.StrToInt(reader["posts"], 0);
                }

                list.Add(f);
            }
            reader.Close();
#if NET1
            return((ForumInfo[])list.ToArray(typeof(ForumInfo)));
#else
            return(list.ToArray());
#endif
        }
Exemple #12
0
        /// <summary>
        /// 获得用户列表
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ShortUserInfo[] GetUserArray(string type)
        {
            IDataReader reader = DatabaseProvider.GetInstance().GetUsersRank(20, Posts.GetPostTableID(), type);

            if (reader == null)
            {
                return(new ShortUserInfo[0]);
            }
#if NET1
            ArrayList list = new ArrayList();
#else
            List <ShortUserInfo> list = new List <ShortUserInfo>();
#endif
            while (reader.Read())
            {
                ShortUserInfo u = new ShortUserInfo();
                u.Username = reader["username"].ToString();
                u.Uid      = Utils.StrToInt(reader["uid"], 0);
                if (type == "digestposts")
                {
                    u.Digestposts = Utils.StrToInt(reader["digestposts"], 0);
                }
                else if (type == "credits")
                {
                    u.Credits = Utils.StrToInt(reader["credits"], 0);
                }
                else
                {
                    switch (type)
                    {
                    case "extcredits1":
                        u.Extcredits1 = Utils.StrToFloat(reader["extcredits1"], 0);
                        break;

                    case "extcredits2":
                        u.Extcredits2 = Utils.StrToFloat(reader["extcredits2"], 0);
                        break;

                    case "extcredits3":
                        u.Extcredits3 = Utils.StrToFloat(reader["extcredits3"], 0);
                        break;

                    case "extcredits4":
                        u.Extcredits4 = Utils.StrToFloat(reader["extcredits4"], 0);
                        break;

                    case "extcredits5":
                        u.Extcredits5 = Utils.StrToFloat(reader["extcredits5"], 0);
                        break;

                    case "extcredits6":
                        u.Extcredits6 = Utils.StrToFloat(reader["extcredits6"], 0);
                        break;

                    case "extcredits7":
                        u.Extcredits7 = Utils.StrToFloat(reader["extcredits7"], 0);
                        break;

                    case "extcredits8":
                        u.Extcredits8 = Utils.StrToFloat(reader["extcredits8"], 0);
                        break;

                    case "oltime":
                        u.Oltime = Utils.StrToInt(reader["oltime"], 0);
                        break;

                    default:
                        u.Posts = Utils.StrToInt(reader["posts"], 0);
                        break;
                    }
                }
                u.Password = string.Empty;
                u.Secques  = string.Empty;
                u.Nickname = string.Empty;

                list.Add(u);
            }
            reader.Close();
#if NET1
            return((ShortUserInfo[])list.ToArray(typeof(ShortUserInfo)));
#else
            return(list.ToArray());
#endif
        }
 public void RemovePost(PostViewModel postVm)
 {
     Posts.Remove(postVm);
 }
Exemple #14
0
 /// <summary>
 /// 获得今日发帖数
 /// </summary>
 /// <returns></returns>
 public static int GetTodayPostCount()
 {
     return(DatabaseProvider.GetInstance().GetTodayPostCount(Posts.GetPostTableID()));
 }
        /// <summary>
        /// 获取主题帖信息
        /// </summary>
        /// <param name="admininfo"></param>
        /// <returns></returns>
        public PostInfo GetPostAndTopic(AdminGroupInfo admininfo)
        {
            PostInfo postinfo = new PostInfo();

            //如果帖子id和主题id都没有指定
            if (postid == -1 && topicid == -1)
            {
                AddErrLine("无效的主题ID");
                return(postinfo);
            }

            //如果帖子id被指定
            if (postid != -1)
            {
                postinfo = Posts.GetPostInfo(topicid, postid);
                if (postinfo == null)
                {
                    AddErrLine("无效的帖子ID");
                    return(postinfo);
                }
                if (topicid != postinfo.Tid)
                {
                    AddErrLine("主题ID无效");
                    return(postinfo);
                }

                //如果帖子作者是禁止发言,禁止访问,禁止IP用户组或者帖子invisible属性小于0,则不允许引用及回复


                if (!string.IsNullOrEmpty(DNTRequest.GetString("quote")))
                {
                    if (postinfo.Invisible != 0)
                    {
                        postinfo.Message = "**** 作者被禁止或删除 内容自动屏蔽 ****";
                    }
                    else
                    {
                        string info = postinfo.Posterid > 0 ? Users.GetShortUserInfo(postinfo.Posterid).Groupid.ToString() : null;
                        if (Utils.InArray(info, "4.5.6"))
                        {
                            postinfo.Message = "**** 作者被禁止或删除 内容自动屏蔽 ****";
                        }
                    }
                    //if (Utils.InArray(Users.GetShortUserInfo(postinfo.Posterid).Groupid.ToString(), "4,5,6") || postinfo.Invisible != 0)
                    //    postinfo.Message = "**** 作者被禁止或删除 内容自动屏蔽 ****";

                    if ((postinfo.Message.IndexOf("[hide]") > -1) && (postinfo.Message.IndexOf("[/hide]") > -1))
                    {
                        message = string.Format("[quote] 原帖由 [b]{0}[/b] 于 {1} 发表\r\n ***隐藏帖*** [/quote]", postinfo.Poster, postinfo.Postdatetime);
                    }
                    //message = "[quote] 原帖由 [b]" + postinfo.Poster + "[/b] 于 " + postinfo.Postdatetime + " 发表\r\n ***隐藏帖*** [/quote]";
                    else
                    {
                        message = string.Format("[quote]{0}\r\n [color=#999999]{1} 发表于 {2} [/color][url={5}showtopic.aspx?topicid={3}&postid={4}#{4}][img]{5}images/common/back.gif[/img][/url][/size][/quote]"
                                                , UBB.ClearAttachUBB(Utils.GetSubString(postinfo.Message, 200, "......")), postinfo.Poster, postinfo.Postdatetime, topicid, postid, Utils.GetRootUrl(forumpath));
                    }
                }
            }

            // 获取该主题的信息
            topic = Topics.GetTopicInfo(topicid);
            // 如果该主题不存在
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return(postinfo);
            }

            topictitle = topic.Title.Trim();
            pagetitle  = topictitle;
            forumid    = topic.Fid;

            // 如果当前用户非管理员并且该主题已关闭,不允许用户发帖
            if ((admininfo == null || !Moderators.IsModer(admininfo.Admingid, userid, forumid)) && topic.Closed == 1)
            {
                AddErrLine("主题已关闭无法回复");
                return(postinfo);
            }

            if (topic.Readperm > usergroupinfo.Readaccess && topic.Posterid != userid && useradminid != 1)
            {
                if (forum.Moderators != null && !Utils.InArray(username, forum.Moderators.Split(',')))
                {
                    AddErrLine("本主题阅读权限为: " + topic.Readperm + ", 您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 阅读权限不够");
                }
            }

            return(postinfo);
        }
        /// <summary>
        /// 创建帖子信息
        /// </summary>
        /// <param name="postmessage"></param>
        /// <returns></returns>
        public PostInfo CreatePostInfo(string postmessage)
        {
            PostInfo postinfo = new PostInfo();

            postinfo.Fid      = forumid;
            postinfo.Tid      = topicid;
            postinfo.Parentid = postinfo.Parentid;
            postinfo.Layer    = postinfo.Layer + 1;
            postinfo.Poster   = username;
            postinfo.Posterid = userid;
            bool ishtmlon = (Utils.StrToInt(DNTRequest.GetString("htmlon"), 0) == 1);

            if (useradminid == 1)
            {
                postinfo.Title = Utils.HtmlEncode(posttitle);
                if (usergroupinfo.Allowhtml == 0)
                {
                    postinfo.Message = Utils.HtmlEncode(postmessage);
                }
                else
                {
                    postinfo.Message = ishtmlon ? postmessage : Utils.HtmlEncode(postmessage);
                }
            }
            else
            {
                postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString(config.Antispamposttitle)));
                if (usergroupinfo.Allowhtml == 0)
                {
                    postinfo.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
                }
                else
                {
                    postinfo.Message = ishtmlon ? ForumUtils.BanWordFilter(postmessage) :
                                       Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
                }
            }
            postinfo.Postdatetime = Utils.GetDateTime();

            if (Utils.StrIsNullOrEmpty(postinfo.Message.Replace(" ", "")))
            {
                AddErrLine("内容不能为空, 请返回修改!");
                return(postinfo);
            }

            if (useradminid != 1 && (ForumUtils.HasBannedWord(posttitle) || ForumUtils.HasBannedWord(postmessage)))
            {
                string bannedWord = ForumUtils.GetBannedWord(posttitle) == string.Empty ? ForumUtils.GetBannedWord(postmessage) : ForumUtils.GetBannedWord(posttitle);
                AddErrLine(string.Format("对不起, 您提交的内容包含不良信息  <font color=\"red\">{0}</font>, 请返回修改!", bannedWord));
                return(postinfo);
            }

            postinfo.Ip            = DNTRequest.GetIP();
            postinfo.Lastedit      = "";
            postinfo.Debateopinion = DNTRequest.GetInt("debateopinion", 0);
            postinfo.Invisible     = needaudit ? 1 : 0;

            // 如果当前用户非管理员并且论坛设定了发帖审核时间段,当前时间如果在其中的一个时间段内,则用户所发帖均为待审核状态
            if (useradminid != 1 && !Moderators.IsModer(useradminid, userid, forumid))
            {
                if (Scoresets.BetweenTime(config.Postmodperiods) || ForumUtils.HasAuditWord(postinfo.Title) || ForumUtils.HasAuditWord(postinfo.Message))
                {
                    postinfo.Invisible = 1;
                }
            }

            postinfo.Usesig      = TypeConverter.StrToInt(DNTRequest.GetString("usesig"));
            postinfo.Htmlon      = (usergroupinfo.Allowhtml == 1 && ishtmlon) ? 1 : postinfo.Htmlon;
            postinfo.Smileyoff   = (smileyoff != 0) ? smileyoff : TypeConverter.StrToInt(DNTRequest.GetString("smileyoff"));
            postinfo.Bbcodeoff   = (usergroupinfo.Allowcusbbcode == 1 && forum.Allowbbcode == 1) ? TypeConverter.StrToInt(DNTRequest.GetString("bbcodeoff")) : 1;
            postinfo.Parseurloff = TypeConverter.StrToInt(DNTRequest.GetString("parseurloff"));
            postinfo.Attachment  = 0;
            postinfo.Rate        = 0;
            postinfo.Ratetimes   = 0;
            postinfo.Topictitle  = topic.Title;

            if ((postinfo.Title != "" && Utils.GetCookie("lastposttitle") == Utils.MD5(postinfo.Title)) || Utils.GetCookie("lastpostmessage") == Utils.MD5(postinfo.Message))
            {
                AddErrLine("请勿重复发帖");
                return(postinfo);
            }
            postinfo.Pid = Posts.CreatePost(postinfo);
            Utils.WriteCookie("lastposttitle", Utils.MD5(postinfo.Title));
            Utils.WriteCookie("lastpostmessage", Utils.MD5(postinfo.Message));
            return(postinfo);
        }
        protected override void ShowPage()
        {
            #region 临时帐号发帖
            //int realuserid = -1;
            //bool tempaccountspost = false;
            //string tempusername = DNTRequest.GetString("tempusername");
            //if (!Utils.StrIsNullOrEmpty(tempusername) && tempusername != username)
            //{
            //    realuserid = Users.CheckTempUserInfo(tempusername, DNTRequest.GetString("temppassword"), DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer"));
            //    if (realuserid == -1)
            //    {
            //        AddErrLine("临时帐号登录失败,无法继续发帖。");
            //        return;
            //    }
            //    else
            //    {
            //        userid = realuserid;
            //        username = tempusername;
            //        tempaccountspost = true;
            //    }
            //}
            #endregion

            if (userid > 0)
            {
                userinfo = Users.GetShortUserInfo(userid);
            }

            #region 判断是否是灌水
            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            if (admininfo != null)
            {
                disablepost = admininfo.Disablepostctrl;
            }

            if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg))
            {
                if (continuereply != "")
                {
                    AddErrLine("<b>回帖成功</b><br />由于" + msg + "后刷新继续");
                }
                else
                {
                    AddErrLine(msg);
                }
                return;
            }
            #endregion

            //获取主题帖信息
            PostInfo postinfo = GetPostAndTopic(admininfo);
            if (IsErr())
            {
                return;
            }

            forum     = Forums.GetForumInfo(forumid);
            smileyoff = 1 - forum.Allowsmilies;
            bbcodeoff = (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1) ? 0 : 1;
            allowimg  = forum.Allowimgcode;
            needaudit = UserAuthority.NeedAudit(forum, useradminid, topic, userid, disablepost, usergroupinfo);
            #region  附件信息绑定
            //得到用户可以上传的文件类型
            string attachmentTypeSelect = Attachments.GetAllowAttachmentType(usergroupinfo, forum);
            attachextensions       = Attachments.GetAttachmentTypeArray(attachmentTypeSelect);
            attachextensionsnosize = Attachments.GetAttachmentTypeString(attachmentTypeSelect);
            //得到今天允许用户上传的附件总大小(字节)
            int MaxTodaySize = (userid > 0 ? MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid) : 0);
            attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小
            //是否有上传附件的权限
            canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg);

            if (canpostattach && (userinfo != null && userinfo.Uid > 0) && apb != null && config.Enablealbum == 1 &&
                (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0))
            {
                caninsertalbum = true;
                albumlist      = apb.GetSpaceAlbumByUserId(userid);
            }
            #endregion

            if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                SetBackLink(base.ShowForumAspxRewrite(forumid, 0));
                return;
            }

            #region 访问和发帖权限校验
            if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                needlogin = true;
                return;
            }
            if (!UserAuthority.PostReply(forum, userid, usergroupinfo, topic))
            {
                AddErrLine(topic.Closed == 1 ? "主题已关闭无法回复" : "您没有发表回复的权限");
                needlogin = (topic.Closed == 1 ? false : true);
                return;
            }

            if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg))
            {
                AddErrLine(msg);
                return;
            }
            #endregion

            // 如果是受灌水限制用户, 则判断是否是灌水
            if (admininfo != null)
            {
                disablepost = admininfo.Disablepostctrl;
            }

            if (forum.Templateid > 0)
            {
                templatepath = Templates.GetTemplateItem(forum.Templateid).Directory;
            }

            AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
            customeditbuttons = Caches.GetCustomEditButtonList();
            //如果是提交...
            if (ispost)
            {
                string backlink = (DNTRequest.GetInt("topicid", -1) > 0 ?
                                   string.Format("postreply.aspx?topicid={0}&restore=1&forumpage=" + forumpageid, topicid) :
                                   string.Format("postreply.aspx?postid={0}&restore=1&forumpage=" + forumpageid, postid));

                if (!DNTRequest.GetString("quote").Equals(""))
                {
                    backlink = string.Format("{0}&quote={1}", backlink, DNTRequest.GetString("quote"));
                }

                SetBackLink(backlink);

                #region 验证提交信息
                //常规项验证
                NormalValidate(admininfo, postmessage, userinfo);

                if (IsErr())
                {
                    return;
                }
                #endregion

                //是否有上传附件的权限
                canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg);

                // 产生新帖子
                if (!string.IsNullOrEmpty(DNTRequest.GetFormString("toreplay_user").Trim()))
                {
                    postmessage = DNTRequest.GetFormString("toreplay_user").Trim() + "\n\n" + postmessage;
                }

                postinfo = CreatePostInfo(postmessage);

                //获取被回复帖子的作者uid
                int replyUserid = postid > 0 ? Posts.GetPostInfo(topicid, postid).Posterid : postinfo.Posterid;
                postid = postinfo.Pid;
                if (IsErr())
                {
                    return;
                }

                #region 当回复成功后,发送通知
                if (postinfo.Pid > 0 && DNTRequest.GetString("postreplynotice") == "on")
                {
                    Notices.SendPostReplyNotice(postinfo, topic, replyUserid);
                }
                #endregion

                //向第三方应用同步数据
                Sync.Reply(postid.ToString(), topic.Tid.ToString(), topic.Title, postinfo.Poster, postinfo.Posterid.ToString(), topic.Fid.ToString(), "");

                //更新主题相关信息
                //UpdateTopicInfo(postmessage);

                #region 处理附件
                //处理附件
                StringBuilder    sb             = new StringBuilder();
                AttachmentInfo[] attachmentinfo = null;
                string           attachId       = DNTRequest.GetFormString("attachid");
                if (!string.IsNullOrEmpty(attachId))
                {
                    attachmentinfo = Attachments.GetNoUsedAttachmentArray(userid, attachId);
                    Attachments.UpdateAttachment(attachmentinfo, topic.Tid, postinfo.Pid, postinfo, ref sb, userid, config, usergroupinfo);
                }

                //加入相册
                if (config.Enablealbum == 1 && apb != null)
                {
                    sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username));
                }
                #endregion

                OnlineUsers.UpdateAction(olid, UserAction.PostReply.ActionID, forumid, forum.Name, topicid, topictitle);

                #region 设置提示信息和跳转链接
                //辩论地址
                if (topic.Special == 4)
                {
                    SetUrl(Urls.ShowDebateAspxRewrite(topicid));
                }
                else if (infloat == 0)//此处加是否弹窗提交判断是因为在IE6下弹窗提交会造成gettopicinfo, getpostlist(位于showtopic页面)被提交了两次
                {
                    SetUrl(string.Format("showtopic.aspx?forumpage={0}&topicid={1}&page=end&jump=pid#{2}", forumpageid, topicid, postid));
                }

                if (DNTRequest.GetFormString("continuereply") == "on")
                {
                    SetUrl("postreply.aspx?topicid=" + topicid + "&forumpage=" + forumpageid + "&continuereply=yes");
                }

                if (sb.Length > 0)
                {
                    UpdateUserCredits(Forums.GetValues(forum.Replycredits));
                    SetMetaRefresh(5);
                    SetShowBackLink(true);
                    if (infloat == 1)
                    {
                        AddErrLine(sb.ToString());
                        return;
                    }
                    else
                    {
                        AddMsgLine("<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表回复成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr></table>");
                    }
                }
                else
                {
                    SetMetaRefresh();
                    SetShowBackLink(false);
                    //上面已经进行用户组判断
                    if (postinfo.Invisible == 1)
                    {
                        AddMsgLine(string.Format("发表回复成功, 但需要经过审核才可以显示. {0}<br /><br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, 0) + "\">点击这里返回 {1}</a>)", (DNTRequest.GetFormString("continuereply") == "on" ? "继续回复" : "返回该主题"), forum.Name));
                    }
                    else
                    {
                        UpdateUserCredits(Forums.GetValues(forum.Replycredits));
                        MsgForward("postreply_succeed");
                        AddMsgLine(string.Format("发表回复成功, {0}<br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, 0) + "\">点击这里返回 {1}</a>)<br />", (DNTRequest.GetFormString("continuereply") == "on" ? "继续回复" : "返回该主题"), forum.Name));
                    }
                }
                #endregion

                // 删除主题游客缓存
                if (topic.Replies < (config.Ppp + 10))
                {
                    ForumUtils.DeleteTopicCacheFile(topicid);
                }

                //发送邮件通知
                if (DNTRequest.GetString("emailnotify") == "on" && topic.Posterid != -1 && topic.Posterid != userid)
                {
                    SendNotifyEmail(Users.GetShortUserInfo(topic.Posterid).Email.Trim(), postinfo, Utils.GetRootUrl(BaseConfigs.GetForumPath) + string.Format("showtopic.aspx?topicid={0}&page=end&jump=pid#{1}", topicid, postid));
                }
            }
        }
Exemple #18
0
 public PostModel GetePost(int postId)
 {
     return(Posts.FirstOrDefault(o => o.Id == postId));
 }
        //
        // GET: /Home/

        public ActionResult Index()
        {
            return(View(Posts.GetPostList()));
        }
 private void UpdateMyPost_Click(object sender, EventArgs e)
 {
     Posts.UpdateMyPost();
 }
Exemple #21
0
        protected override void ShowPage()
        {
            pagetitle = "搜索";

            GetSearchType();

            //判断当前操作是否是用户打开的页面
            if (searchsubmit == 0 && !ispost)
            {
                //用户权限校验
                if (!UserAuthority.Search(usergroupinfo, ref msg))
                {
                    AddErrLine(msg);
                    return;
                }

                //读取分表信息
                if (searchid <= 0)
                {
                    tablelist = Posts.GetAllPostTableName();
                }
                else
                {
                    if (searchType == SearchType.Error)
                    {
                        AddErrLine("非法的参数信息");
                        return;
                    }

                    switch (searchType)
                    {
                    case SearchType.SpacePostTitle:
                        spacepostlist = Searches.GetSearchCacheList(posttableid, searchid, 16, pageid, out topiccount, searchType);
                        break;

                    case SearchType.AlbumTitle:
                        albumlist = Searches.GetSearchCacheList(posttableid, searchid, 16, pageid, out topiccount, searchType);
                        break;

                    case SearchType.ByPoster:
                        topiclist   = Searches.GetSearchCacheList(posttableid, searchid, 16, topicpageid, out topiccount, SearchType.TopicTitle);
                        topicpageid = CalculateCurrentPage(topiccount, topicpageid, out topicpagecount);

                        topicpagenumbers = topicpagecount > 1 ? Utils.GetPageNumbers(topicpageid, topicpagecount, "search.aspx?type=" + type + "&searchid=" + searchid.ToString() + "&keyword=" + keyword + "&poster=" + poster, 8, "topicpage", "#1") : "";
                        return;

                    case SearchType.PostContent:
                    default:
                        topiclist = Searches.GetSearchCacheList(posttableid, searchid, 16, pageid, out topiccount, searchType);
                        break;
                    }

                    if (topiccount == 0)
                    {
                        AddErrLine("不存在的searchid");
                        return;
                    }
                    CalculateCurrentPage();
                    //得到页码链接
                    pagenumbers = pagecount > 1 ? Utils.GetPageNumbers(pageid, pagecount, "search.aspx?type=" + type + "&searchid=" + searchid.ToString() + "&keyword=" + keyword + "&poster=" + poster, 8) : "";
                }
            }
            else
            {
                //检查用户的搜索权限,包括搜索时间间隔的限制
                if (!UserAuthority.Search(userid, lastsearchtime, useradminid, usergroupinfo, ref msg))
                {
                    AddErrLine(msg);
                    return;
                }

                if (searchType == SearchType.Error)
                {
                    AddErrLine("非法的参数信息");
                    return;
                }

                searchpost = true;
                string searchforumid = DNTRequest.GetString("searchforumid").Trim();
                int    posterid      = CheckSearchInfo(searchforumid);
                if (IsErr())
                {
                    return;
                }

                //if (Utils.StrIsNullOrEmpty(keyword) && posterid > 0 && Utils.StrIsNullOrEmpty(type))
                //{
                //    type = "author";
                //    searchType = SearchType.ByPoster;
                //}

                searchid = Searches.Search(posttableid, userid, usergroupid, keyword, posterid, searchType, searchforumid, DNTRequest.GetInt("searchtime", 0), DNTRequest.GetInt("searchtimetype", 0), DNTRequest.GetInt("resultorder", 0), DNTRequest.GetInt("resultordertype", 0));
                if (searchid > 0)
                {
                    System.Web.HttpContext.Current.Response.Redirect(forumpath + "search.aspx?type=" + type + "&searchid=" + searchid + "&keyword=" + keyword + "&poster=" + poster + "&posttableid=" + posttableid, false);
                }
                else
                {
                    AddErrLine("抱歉, 没有搜索到符合要求的记录");
                    return;
                }
            }
        }
Exemple #22
0
 public void Clear()
 {
     Workers.Clear();
     Posts.Clear();
 }
Exemple #23
0
 private async void SortDesc()
 {
     Posts = new ObservableCollection <Post>(Posts.OrderByDescending(o => o.id).ToList());
 }
 public void AddPost(Posts post)
 {
     _context.Add(post);
 }
 public bool AllowFollowUp()
 {
     return(Posts.Count(p => p.CreatedBy == CreatedBy) == 0);
 }
Exemple #26
0
        public async Task <IActionResult> Confirm_CheckoutAsync(int id, int act, int?size)
        {
            //Buy
            if (act == 0)
            {
                if (String.IsNullOrEmpty(HttpContext.Session.GetInt32("idUser").ToString()))
                {
                    return(RedirectToAction("Index", "Login"));
                }
                //var i = HttpContext.Session.GetString("ck_discount");
                var idPost = JsonConvert.DeserializeObject(_api.getAPI("api/SizesAPI/TakeIdPost_ForOrder/" + id + "/" + size + "/1").Result);

                Orders orders = new Orders();

                orders.time        = DateTime.Now;
                orders.address     = HttpContext.Session.GetString("ck_address").ToString();
                orders.phone       = HttpContext.Session.GetString("ck_phone").ToString();
                orders.status      = 0;
                orders.id_user     = HttpContext.Session.GetInt32("idUser").Value;
                orders.id_post     = Convert.ToInt32(idPost);
                orders.service_fee = 0;
                orders.id_city     = HttpContext.Session.GetInt32("ck_city").Value;
                if (HttpContext.Session.GetString("ck_discount") != "")
                {
                    orders.discount = Convert.ToDouble(HttpContext.Session.GetString("ck_discount"));
                }


                if (HttpContext.Session.GetString("ck_payment").ToString() == "Cash On Deliery (COD)")
                {
                    orders.payment = 1;
                }
                else
                if (HttpContext.Session.GetString("ck_payment").ToString() == "Credit / Debit")
                {
                    orders.payment = 2;
                }

                orders.price    = Convert.ToDouble(HttpContext.Session.GetString("ck_total"));
                orders.ship_fee = Convert.ToDouble(HttpContext.Session.GetString("ck_shipping"));
                if (HttpContext.Session.GetInt32("ck_id_voucher") != null)
                {
                    orders.id_voucher = HttpContext.Session.GetInt32("ck_id_voucher").Value;
                    await _api.getAPI("api/VouchersAPI/UpdateCount/" + HttpContext.Session.GetInt32("ck_id_voucher").Value);
                }

                //Send Mail
                var    email_post = _api.getAPI("api/PostsAPI/SelectEmailUser/" + idPost).Result;
                Mailer ml         = new Mailer();
                ml.SendMail("Exaxxi Site", email_post, "Buy Product", "Your buying has something new. Please check details in your account!");

                if (_api.postAPI(orders, "api/OrdersChange").Result)
                {
                    //update after buy
                    var post = JsonConvert.DeserializeObject <Posts>(_api.getAPI("api/PostsAPI/" + idPost).Result);
                    post.status = 1;
                    await _api.putAPI(post, "api/PostsChange/" + idPost);

                    var id_size = JsonConvert.DeserializeObject <int>(_api.getAPI("api/SizesAPI/TakeIdSize_ForBid/" + id + "/" + size).Result);
                    UpdatePrice(id, id_size);
                    return(RedirectToAction("Index", "User"));
                }
            }

            //Bid
            if (act == 1)
            {
                if (String.IsNullOrEmpty(HttpContext.Session.GetInt32("idUser").ToString()))
                {
                    return(RedirectToAction("Index", "Login"));
                }

                var idSize = JsonConvert.DeserializeObject(_api.getAPI("api/SizesAPI/TakeIdSize_ForBid/" + id + "/" + size).Result);

                Posts posts = new Posts();

                posts.price      = Convert.ToDouble(HttpContext.Session.GetString("ck_enter_bid").ToString());
                posts.date_start = DateTime.Now;

                //Xử Lý End Date
                int      day       = Convert.ToInt16(HttpContext.Session.GetString("ck_exp_day").ToString());
                DateTime now       = DateTime.Now;
                DateTime final_day = now.AddDays(day);

                posts.date_end = final_day;

                posts.kind        = 2;
                posts.id_size     = Convert.ToInt32(idSize);
                posts.id_user     = HttpContext.Session.GetInt32("idUser").Value;
                posts.status      = 0;
                posts.address     = HttpContext.Session.GetString("ck_address").ToString();
                posts.phone       = HttpContext.Session.GetString("ck_phone").ToString();
                posts.name_client = HttpContext.Session.GetString("ck_account").ToString();
                posts.id_city     = HttpContext.Session.GetInt32("ck_city").Value;

                if (_api.postAPI(posts, "api/PostsChange").Result)
                {
                    UpdatePrice(id, Convert.ToInt32(idSize));
                    return(RedirectToAction("Index", "User"));
                }
            }

            return(View());
        }
 public static Posts CreatePosts(int ID, int blogId, global::System.DateTime createdDate, global::System.DateTime modifiedDate, string postContent, string title, bool @public, string aaaa)
 {
     Posts posts = new Posts();
     posts.Id = ID;
     posts.BlogId = blogId;
     posts.CreatedDate = createdDate;
     posts.ModifiedDate = modifiedDate;
     posts.PostContent = postContent;
     posts.Title = title;
     posts.Public = @public;
     posts.aaaa = aaaa;
     return posts;
 }
Exemple #28
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (this.StopProcessing)
        {
            // Do not process
        }
        else
        {
            // If paramater URL is empty, set URL of current document
            string url = Url;
            if (string.IsNullOrEmpty(url) && (CMSContext.CurrentDocument != null))
            {
                TreeNode node = CMSContext.CurrentDocument;
                url = CMSContext.GetUrl(node.NodeAliasPath, node.DocumentUrlPath, CMSContext.CurrentSiteName);
            }
            else
            {
                url = ResolveUrl(url);
            }

            // Get culture code
            string culture = CultureHelper.GetFacebookCulture(CMSContext.PreferredCultureCode);

            ltlComments.Text = "<div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/" + culture + "/all.js#xfbml=1\"></script><fb:comments href=" + URLHelper.GetAbsoluteUrl(url) + " num_posts=" + Posts.ToString() + " width=" + Width.ToString() + "></fb:comments>";
        }
    }
        Task<StacManResponse<Post>> IPostMethods.GetAll(string site, string filter, int? page, int? pagesize, DateTime? fromdate, DateTime? todate, Posts.Sort? sort, DateTime? mindate, DateTime? maxdate, int? min, int? max, Order? order)
        {
            ValidateString(site, "site");
            ValidatePaging(page, pagesize);
            ValidateSortMinMax(sort, mindate: mindate, maxdate: maxdate, min: min, max: max);

            var ub = new ApiUrlBuilder(Version, "/posts", useHttps: false);

            ub.AddParameter("site", site);
            ub.AddParameter("filter", filter);
            ub.AddParameter("page", page);
            ub.AddParameter("pagesize", pagesize);
            ub.AddParameter("fromdate", fromdate);
            ub.AddParameter("todate", todate);
            ub.AddParameter("sort", sort);
            ub.AddParameter("min", mindate);
            ub.AddParameter("max", maxdate);
            ub.AddParameter("min", min);
            ub.AddParameter("max", max);
            ub.AddParameter("order", order);

            return CreateApiTask<Post>(ub, HttpMethod.GET, "/posts");
        }
 private void Dismiss(RedditListItem value)
 {
     Posts.Remove(value);
 }
 public Posts CreatePost(Posts post)
 {
     return(_dataLayer.AddPost(post));
 }
 public void AddToPosts(Posts posts)
 {
     base.AddObject("Posts", posts);
 }
 private void DismissAll()
 {
     Posts.Clear();
 }
 public PostsController(ITokenHandler tokenStore)
     : base(tokenStore)
 {
     _table = new Posts();
     ViewBag.Table = _table;
 }
Exemple #35
0
        private void button_sendPost_Click_1(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(textbox_postText.Text))
            {
                AppNetDotNet.Model.Entities entities = null;
                string toBePostedText = textbox_postText.textBoxContent.Text;
                if (textbox_postText.MarkdownLinksInText.Count() > 0)
                {
                    entities          = new AppNetDotNet.Model.Entities();
                    entities.links    = new List <AppNetDotNet.Model.Entities.Link>();
                    entities.hashtags = null;
                    entities.mentions = null;
                    foreach (KeyValuePair <string, string> link in textbox_postText.MarkdownLinksInText)
                    {
                        AppNetDotNet.Model.Entities.Link linkEntity = new AppNetDotNet.Model.Entities.Link();
                        linkEntity.text = link.Value;
                        linkEntity.url  = link.Key;
                        int startPosition = toBePostedText.IndexOf(string.Format("[{0}]({1})", linkEntity.text, linkEntity.url));
                        linkEntity.pos = startPosition;
                        linkEntity.len = linkEntity.text.Length;
                        toBePostedText = toBePostedText.Replace(string.Format("[{0}]({1})", linkEntity.text, linkEntity.url), linkEntity.text);
                        entities.links.Add(linkEntity);
                    }
                }

                //List<IAnnotation> annotations = null;
                if (!string.IsNullOrEmpty(Properties.Settings.Default.language_posts))
                {
                    /* annotations = new List<IAnnotation>();
                     * AppNetDotNet.Model.Annotations.Language language_annotation = new AppNetDotNet.Model.Annotations.Language();
                     * language_annotation.language = Properties.Settings.Default.language_posts;
                     * annotations.Add(language_annotation); */
                }


                if (currentPostTarget.pmToUser == null && currentPostTarget.channelName == null)
                {
                    List <File> toBeAddedFiles = null;
                    if (!string.IsNullOrEmpty(currentPostTarget.filePathOfToBeAddedFile))
                    {
                        if (System.IO.File.Exists(currentPostTarget.filePathOfToBeAddedFile))
                        {
                            Tuple <File, ApiCallResponse> uploadedFile = AppNetDotNet.ApiCalls.Files.create(AppController.Current.account.accessToken, currentPostTarget.filePathOfToBeAddedFile, type: "com.nymphicusapp.chapper.image");
                            if (uploadedFile.Item2.success)
                            {
                                toBeAddedFiles = new List <File>();
                                toBeAddedFiles.Add(uploadedFile.Item1);
                            }
                        }
                    }


                    Tuple <Post, ApiCallResponse> response;
                    if (currentPostTarget.replyToItem != null)
                    {
                        if (currentPostTarget.replyToItem.apnPost == null)
                        {
                            currentPostTarget.replyToItem = null;
                        }
                    }
                    if (currentPostTarget.replyToItem == null)
                    {
                        response = Posts.create(AppController.Current.account.accessToken, toBePostedText, toBeEmbeddedFiles: toBeAddedFiles, entities: entities, parse_links: true);
                    }
                    else
                    {
                        response = Posts.create(AppController.Current.account.accessToken, toBePostedText, currentPostTarget.replyToItem.id, toBeEmbeddedFiles: toBeAddedFiles, entities: entities, parse_links: true);
                    }
                    if (response.Item2.success)
                    {
                        AppController.Current.account.updateItems();
                        clear_postbox();
                        if (string.IsNullOrEmpty(currentPostTarget.channelName))
                        {
                            textblock_composeOverlay.Text = "";
                        }
                    }
                    else
                    {
                        showErrorMessage(response.Item2);
                    }
                }
                else
                {
                    Tuple <Message, ApiCallResponse> response;
                    List <string> receiver = new List <string>();
                    if (currentPostTarget.pmToUser != null)
                    {
                        receiver.Add("@" + currentPostTarget.pmToUser.username);
                    }

                    if (receiver.Count == 0 && currentPostTarget.replyToItem != null)
                    {
                        receiver.Add("@" + currentPostTarget.replyToItem.user.username);
                    }

                    if (currentPostTarget.replyToItem != null)
                    {
                        if (currentPostTarget.replyToItem.apnMessage == null)
                        {
                            currentPostTarget.replyToItem = null;
                        }
                    }

                    if (currentPostTarget.replyToItem != null)
                    {
                        if (currentPostTarget.replyToItem.isPrivateMessage)
                        {
                            response = Messages.createPrivateMessage(AppController.Current.account.accessToken, toBePostedText, receiver, currentPostTarget.replyToItem.id, machineOnly: 0, entities: entities, parse_links: true);
                        }
                        else if (currentPostTarget.replyToItem.apnMessage != null)
                        {
                            {
                                response = Messages.create(AppController.Current.account.accessToken, toBePostedText, currentPostTarget.replyToItem.apnMessage.channel_id, receiver, machineOnly: 0, reply_to: currentPostTarget.replyToItem.id, entities: entities, parse_links: true);
                            }
                        }
                        else
                        {
                            response = Messages.createPrivateMessage(AppController.Current.account.accessToken, toBePostedText, receiver, currentPostTarget.replyToItem.id, machineOnly: 0, entities: entities, parse_links: true);
                        }
                    }
                    else
                    {
                        if (currentPostTarget.channelId != null)
                        {
                            string channelId = currentPostTarget.channelId;
                            response = Messages.create(AppController.Current.account.accessToken, textbox_postText.Text, channelId, receiver, machineOnly: 0, parse_links: true);
                        }
                        else
                        {
                            response = Messages.createPrivateMessage(AppController.Current.account.accessToken, textbox_postText.Text, receiver, machineOnly: 0, parse_links: true);
                        }
                    }
                    if (response.Item2.success)
                    {
                        clear_postbox();
                    }
                    else
                    {
                        showErrorMessage(response.Item2);
                    }
                }
            }
        }
 public Task <bool> Update(Posts post, int Post_id)
 {
     throw new NotImplementedException();
 }
        public void MarkAsAnswer(int id, string userName)
        {
            var post = Posts.First(x => x.Id == id);

            post.MarkAsAccepted(userName);
        }