//注册临时存储任务的事件,系统自动执行,无需用户干预 private void TaskTempSaveInit(cPublishTask pTask) { if (pTask.PublishManage.Equals(this)) { pTask.PublishTempDataCompleted += this.onPublishTempDataCompleted; } }
public void AddSaveTempDataTask(cPublishTask pt) { ListPublish.Add(pt); TaskTempSaveInit(pt); //启动此任务 pt.startSaveTempData(); }
public void AddPublishTask(cPublishTask pt) { //添加到对列中 ListPublish.Add(pt); TaskInit(pt); //启动此任务 pt.startPublic(); }
private void onPublishCompleted(object sender, PublishCompletedEventArgs e) { //从当前列表中删除此记录 cPublishTask pt = (cPublishTask)sender; m_ListPublish.Remove(pt); pt = null; if (e_PublishCompleted != null && !e.Cancel) { e_PublishCompleted(sender, e); } }
//注册发布任务的事件 private void TaskInit(cPublishTask pTask) { if (pTask.PublishManage.Equals(this)) { pTask.PublishCompleted += this.onPublishCompleted; pTask.PublishFailed += this.onPublishFailed; pTask.PublishStarted += this.onPublishStarted; pTask.PublishError += this.onPublishError; pTask.PublishTempDataCompleted += this.onPublishTempDataCompleted; pTask.PublishLog += this.onPublishLog; pTask.RunTask += this.onRunSoukeyTask; } }
private void onPublishTempDataCompleted(object sender, PublishTempDataCompletedEventArgs e) { //从当前列表中删除此记录,临时数据的保存也是作为一个发布任务来执行的 //所以,保存完毕后,需要删除此任务 cPublishTask pt = (cPublishTask)sender; m_ListPublish.Remove(pt); pt = null; if (e_PublishTempDataCompleted != null && !e.Cancel) { e_PublishTempDataCompleted(sender, e); } }
//增加发布任务,用于发布临时采集的数据,同时启动此任务 public void startSaveTempData(cPublishTask pT) { m_PublishManage.AddSaveTempDataTask(pT); }
//增加发布任务,用于发布数据,同时启动此任务 public void startPublish(cPublishTask pT) { m_PublishManage.AddPublishTask(pT); }
//��������ɼ���ɵĹ�����ע�����������Ƿ���Ҫִ�� //�˷�������Ϊ���������Ƿ�����Ҫ������ʱ���ݱ��� //������������������ݷ������������� public void UpdateTaskPublish(Int64 TaskID,bool IsDelRepRow) { //����������ӵ����������� string conName = "sCon" + TaskID; string pageName = "page" + TaskID; if (this.tabControl1.TabPages[pageName]== null) { //��ʾ�ɼ�������û�ж���ɼ�����ģ� //���ԣ��ᵼ������ֱ����ɣ���δ���� //���������tabҳ UpdateTaskComplete(TaskID); } else { //��ʾ�ɼ������� DataTable d; if (IsDelRepRow == true) { //ȥ���ظ��� DataTable d1 = (DataTable)((DataGridView)this.tabControl1.TabPages[pageName].Controls[conName].Controls[0].Controls[0]).DataSource; string[] strComuns = new string[d1.Columns.Count]; for (int m = 0; m < d1.Columns.Count; m++) { strComuns[m] = d1.Columns[m].ColumnName; } DataView dv = new DataView(d1); d = dv.ToTable(true, strComuns); } else { d = (DataTable)((DataGridView)this.tabControl1.TabPages[pageName].Controls[conName].Controls[0].Controls[0]).DataSource; } cPublishTask pt = new cPublishTask(m_PublishControl.PublishManage, TaskID, d); m_PublishControl.startSaveTempData(pt); if (pt.PublishType == cGlobalParas.PublishType.NoPublish) { //����Dz��������ݣ�����Ҫͨ���˷����������ɼ���Ĵ������ //ɾ��taskrun�е����ݵȵȣ��˲��������ʵ�����������ݷ������� //�������������¼���ɣ����ڴ���Ҫ�ֹ���� UpdateTaskComplete(TaskID); } else { m_PublishControl.startPublish(pt); } } #region ���½�����ʾ if (this.treeMenu.SelectedNode.Name == "nodRunning") { for (int i = 0; i < this.dataTask.Rows.Count; i++) { if (this.dataTask.Rows[i].Cells[1].Value.ToString() == TaskID.ToString()) { this.dataTask.Rows.Remove(this.dataTask.Rows[i]); break; } } } else if (this.treeMenu.SelectedNode.Name == "nodPublish") { //���¼���������������Ϣ LoadPublishTask(); } else if (this.treeMenu.SelectedNode.Name == "nodComplete") { //���¼���������������Ϣ LoadCompleteTask(); } #endregion }
//����ɼ��������ʱ���� public void SaveGatherTempData(Int64 TaskID) { //����������ӵ����������� string conName = "sCon" + TaskID; string pageName = "page" + TaskID; if (this.tabControl1.TabPages[pageName] == null) { return; } DataTable d = (DataTable)((DataGridView)this.tabControl1.TabPages[pageName].Controls[conName].Controls[0].Controls[0]).DataSource; cPublishTask pt = new cPublishTask(m_PublishControl.PublishManage, TaskID, d); m_PublishControl.startSaveTempData (pt); }
//���ӷ�������,���ڷ�����ʱ�ɼ������ݣ�ͬʱ��������� public void startSaveTempData(cPublishTask pT) { m_PublishManage.AddSaveTempDataTask(pT); }
//���ӷ�������,���ڷ������ݣ�ͬʱ��������� public void startPublish(cPublishTask pT) { m_PublishManage.AddPublishTask(pT ); }
//ע����ʱ�洢������¼���ϵͳ�Զ�ִ�У������û���Ԥ private void TaskTempSaveInit(cPublishTask pTask) { if (pTask.PublishManage.Equals(this)) { pTask.PublishTempDataCompleted += this.onPublishTempDataCompleted; } }
//ע�ᷢ��������¼� private void TaskInit(cPublishTask pTask) { if (pTask.PublishManage.Equals(this)) { pTask.PublishCompleted += this.onPublishCompleted; pTask.PublishFailed += this.onPublishFailed; pTask.PublishStarted += this.onPublishStarted; pTask.PublishError += this.onPublishError; pTask.PublishTempDataCompleted += this.onPublishTempDataCompleted; pTask.PublishLog += this.onPublishLog; pTask.RunTask += this.onRunSoukeyTask; } }
public void AddSaveTempDataTask(cPublishTask pt) { ListPublish.Add(pt); TaskTempSaveInit(pt); //��������� pt.startSaveTempData(); }
public void AddPublishTask(cPublishTask pt) { //��ӵ������� ListPublish.Add(pt); TaskInit(pt); //��������� pt.startPublic(); }