Exemplo n.º 1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            var current = (NewListDTP)newListDTPBindingSource1.Current;
            var newsid  = current.NewsId;

            if (e.ColumnIndex == colYC_Sitting.Index)
            {
                var form = new FormNewsJob(newsid);
                form.StartPosition = FormStartPosition.Manual;
                form.Location      = new Point(Cursor.Position.X, Cursor.Position.Y);
                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    current.Message = form.Job.Message();
                    current.Del     = "删除计划";
                    Tool.aideTimer.Enqueue(new AideJobs {
                        Job = form.Job, JobAction = SaveNews_YC
                    });
                }
            }
            else if (e.ColumnIndex == colYC_Del.Index)
            {
                if (MessageBox.Show("确定删除发布计划?", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    dal.DelJob(newsid);
                    Tool.aideTimer.Dequeue(newsid);
                    current.Message = "";
                    current.Del     = "";
                }
            }
            else if (e.ColumnIndex == colYC_Title.Index)
            {
                var form = new Form_YC(yiche, Convert.ToInt32(current.NewsId));
                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    LoadNews_YC();
                }
            }
            else if (e.ColumnIndex == colDelNews.Index)
            {
                if (MessageBox.Show("确定删除草稿?", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    dal.DelJob(newsid);
                    Tool.aideTimer.Dequeue(newsid);
                    dal.DelNews(Convert.ToInt32(newsid));
                    OperateIniFile.DelIniFile(newsid);
                    //((List<NewListDTP>)newListDTPBindingSource1.DataSource).Remove(current);
                    rowMergeView2.Rows.RemoveAt(e.RowIndex);
                }
            }
            rowMergeView2.Refresh();
        }
Exemplo n.º 2
0
        public string PostNews(NewListDTP data)
        {
            var news     = dal.GetNews(Convert.ToInt32(data.NewsId));
            var postdata = OperateIniFile.ReadIniData("PostData", news.ID.ToString());

            if (string.IsNullOrEmpty(app_CheYiTong_Cookie))
            {
                app_CheYiTong_Cookie = OsLogin(app_CheYiTong);
            }

            var result = Post_CheYiTong(news.SendContent, postdata);

            if (result.DocumentNode.OuterHtml.Contains("NewsSuccess.aspx"))
            {
                return(data.Title + " 发布成功");
            }
            else
            {
                Regex reg   = new Regex(@"(?is)(?<=\()[^\)]+(?=\))");
                var   match = reg.Match(result.DocumentNode.OuterHtml);
                return(data.Title + " " + match.Value);
            }
        }