protected DataSyncController(IDomainDataContext db, ILogger logger, IMailDispatchService mailer, IHtmlTemplateManager htmlTemplateManager, DataSyncAgent syncAgent) { this.db = db; this.logger = logger; this.mailer = mailer; this.htmlTemplateManager = htmlTemplateManager; this.syncAgent = syncAgent; }
private void CheckOutForm_Load(object sender, EventArgs e) { if (this.CheckMode == CheckOutMode.Custom) { cbxArea.Enabled = false; } else { cbxArea.DataSource = DataSyncAgent.GetAllCheckOutArea(); cbxArea.Enabled = true; } }
private void button2_Click(object sender, EventArgs e) { this.button2.Enabled = false; this.lstCheckInMsgs.DataSource = null; this.lstCheckInMsgs.Items.Clear(); string versionName = cbxTask.Text; if (versionName == string.Empty) { return; } DataSyncAgent agent = new DataSyncAgent(); List <string> msgs = agent.CheckDataSchema(Properties.Settings.Default.DataTemplate, tbxFile.Text); this.lstCheckInMsgs.DataSource = msgs.ToArray(); if (agent.ExistVersion(Util.ServerWorkspace, versionName)) { DialogResult dlgret = MessageBox.Show("数据版本已经存在,是否覆盖?", "", MessageBoxButtons.YesNo); if (dlgret == DialogResult.No) { return; } else { agent.DeleteVersion(Util.ServerWorkspace, versionName); } } bool isSuccess = agent.CheckIn(Util.ServerWorkspace, versionName, tbxFile.Text, Properties.Settings.Default.Grid, Properties.Settings.Default.GridCodeField); if (isSuccess) { TaskManager tm = TaskManager.GetInstance(); tm.ChangeTasksStatus(versionName, TaskManager.CHECKIN_STATUS); MessageBox.Show("导入成功"); this.Close(); } else { MessageBox.Show("导入失败"); this.button2.Enabled = true; } }
private void button1_Click(object sender, EventArgs e) { TaskManager tm = TaskManager.GetInstance(); if (tm.ExistTask(tbxTaskName.Text)) { MessageBox.Show("该任务名称已存在,请用其他名称!"); return; } this.button1.Enabled = false; DataSyncAgent agent = new DataSyncAgent(); string template = Properties.Settings.Default.DataTemplate; string dir = System.IO.Path.GetDirectoryName(tbxExportpath.Text); string dbname = System.IO.Path.GetFileNameWithoutExtension(tbxExportpath.Text); IPolygon area = null; if (CheckMode == CheckOutMode.Custom) { area = CheckOutArea; } else { area = agent.GetCheckOutArea(this.cbxArea.Text); } bool isSuccess = agent.CheckOut(Util.ServerWorkspace, dir, dbname, template, area, tbxTaskName.Text, tbxDept.Text); this.button1.Enabled = true; if (isSuccess) { MessageBox.Show("下发成功"); } else { MessageBox.Show("下发失败"); } this.Close(); }