Ejemplo n.º 1
0
        private void btn_submit_Click(object sender, EventArgs e)
        {
            Comment newComment = new Comment();

            newComment.lawId           = lawId;
            newComment.nodeId          = nodeId;
            newComment.comment_content = rtb_content.Text.Trim();
            newComment.comment_date    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            newComment.userId          = Global.user.Id;

            OpinionCommitRequest opinionRequest = new OpinionCommitRequest();

            opinionRequest.ConvertFromComment(newComment);
            //RemoteWorker
            CommonResponse response = TranslationWorker.ConvertStringToEntity <CommonResponse>(RemoteWorker.postOpinion(opinionRequest));

            if (response != null)
            {
                if (response.status.ToString() == "200")
                {
                    //如果提交成功,在法规正文界面刷新评论
                    RemoteWorker.getOpinionList(lawView.law.lawId);
                    if (Global.online)// && string.IsNullOrEmpty(law.isLocal))
                    {
                        ((LawView)lawView).loadComment(reload: true);
                    }
                    if (MessageBox.Show("提交评论成功") == DialogResult.OK)
                    {
                        this.Close();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 提交评论
        /// </summary>
        /// <param name="opinion"></param>
        /// <returns></returns>
        public static string postOpinion(OpinionCommitRequest opinion)
        {
            string result = string.Empty;

            try
            {
                //result= HttpWorker.PostJson(Global.OpinionCommitApi, opinion.ToJson());
                result = HttpWorker.PostStr(Global.OpinionCommitApi, opinion.ToJson());
            }
            catch (Exception ex)
            {
                MessageBox.Show("提交评论失败,请重试。原因:" + ex.Message);
            }
            return(result);
        }