Esempio 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();
                    }
                }
            }
        }
Esempio n. 2
0
 private void LawView_Load(object sender, EventArgs e)
 {
     //mh = new Utity.MouseHook();
     //mh.SetHook();
     //mh.MouseMoveEvent += Mh_MouseMoveEvent;
     //this.Text += "-"+law.title + " " + law.version;
     lbl_title.Text    = law.title + " " + law.version;
     lbl_welcome.Text += Global.user.Xm;
     if (law != null)
     {
         //如果在线,且未下载到本地,则从远程获取章节信息,并入库
         if (Global.online && "0" == law.isLocal)
         {
             List <Node> nodes = RemoteWorker.getBookContent(law.lawId);   //获取法规整体章节结构
             RemoteWorker.getNodeDetail(nodes.Select(n => n.Id).ToList()); //再获取每个章节的内容
         }
         nodes = db.getNodeByLawId(law.lawId);
         //绑定关系
         tags = NodeWorker.buildRelationFromNode(nodes);
         bindTagsToDGW();
         //绑定树结构
         string content = NodeWorker.buildFromNodeContext(NodeTree, nodes);
         //绑定法规内容
         wb.DocumentText = content;
         SetAutoWrap(true);
         if (Global.online)// && string.IsNullOrEmpty(law.isLocal))
         {
             //远程获取评论
             RemoteWorker.getOpinionList(law.lawId);
             //加载评论
             loadComment();
         }
         //加载文档信息
         lawInfo1.law        = law;
         lawInfo1.parentForm = this.parentForm;
         lawInfo1.fillLawVersion(laws);
         lawInfo1.fillLawInfo();
         lawInfo1.bindState = true;
         //写入阅读历史
         ViewHistory history = new ViewHistory()
         {
             Id       = law.lawId,
             LawID    = law.lawId,
             UserID   = Global.user.Id,
             ViewDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
         };
         if (db.saveHistory(history))
         {
             ((LibraryList)parentForm).addHistory(history);
         }
     }
 }