Example #1
0
        private void rowMergeView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            var newsid = ((NewListDTP)newListDTPBindingSource.Current).NewsId;

            if (e.ColumnIndex == colSitting.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)
                {
                    ((NewListDTP)newListDTPBindingSource.Current).Message = "将于:" + form.Job.JobDate + " " + form.Job.Time + "执行";
                    ((NewListDTP)newListDTPBindingSource.Current).Del     = "删除计划";
                    Tool.aideTimer.Enqueue(new AideJobs {
                        Job = form.Job, JobAction = SaveNews_QC
                    });
                }
            }
            else if (e.ColumnIndex == colDel.Index)
            {
                if (MessageBox.Show("确定删除发布计划?", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    dal.DelJob(newsid);
                    Tool.aideTimer.Dequeue(newsid);
                    ((NewListDTP)newListDTPBindingSource.Current).Message = "";
                    ((NewListDTP)newListDTPBindingSource.Current).Del     = "";
                }
            }
            rowMergeView1.Refresh();
        }
Example #2
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();
        }