public void DataExport() { this.sfdDataView.Filter = "Export file(*.dat)|*.dat"; if (this.sfdDataView.ShowDialog() == DialogResult.OK) { List<int> list = new List<int>(); this.drProgress = new DeleteRestore(11); this.drProgress.Show(); try { this.drProgress.pgbRestore.Minimum = 0; this.drProgress.pgbRestore.Maximum = this.dgvDataView.SelectedRows.Count; this.drProgress.pgbRestore.Value = 0; string directoryName = Path.GetDirectoryName(this.sfdDataView.FileName); string fileName = Path.GetFileName(this.sfdDataView.FileName); DataCompress compress = new DataCompress(directoryName, fileName); compress.Clear(); IData data = null; for (int i = 0; i < this.dgvDataView.RowCount; i++) { if (this.dgvDataView.Rows[i].Selected) { this.drProgress.pgbRestore.Value++; this.drProgress.Refresh(); data = this.GetData(int.Parse(this.dgvDataView.Rows[i].Cells["clmID"].Value.ToString())); if (data == null) { list.Add(int.Parse(this.dgvDataView.Rows[i].Cells["clmID"].Value.ToString())); } else { compress.AddData(this.GetExportData(data)); } } } } catch (Exception exception) { using (MessageDialogSimpleForm form = new MessageDialogSimpleForm()) { form.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, MessageDialog.CreateExceptionMessage(exception)); } } finally { list.Sort(); for (int j = list.Count - 1; j > -1; j--) { this.RecordDelete(list[j]); } this.dtsDataView.AcceptChanges(); this.dgvDataView.Refresh(); this.stpCount(); this.drProgress.Close(); this.drProgress.Dispose(); } } }
public void DataImport() { this.ofdDataView.Filter = "Import file(*.dat)|*.dat"; if (this.ofdDataView.ShowDialog() == DialogResult.OK) { string directoryName = Path.GetDirectoryName(this.ofdDataView.FileName); string fileName = Path.GetFileName(this.ofdDataView.FileName); this.drProgress = new DeleteRestore(4); this.drProgress.Show(); try { DataCompress compress = new DataCompress(directoryName, fileName); int count = compress.IndexList.Count; IData data = null; this.drProgress.pgbRestore.Minimum = 0; this.drProgress.pgbRestore.Maximum = count; for (int i = 0; i < count; i++) { bool flag; this.drProgress.pgbRestore.Value = i + 1; this.drProgress.Refresh(); string s = compress.GetData(i); data = this.SetExportData(s, out flag, true); if (data != null) { data.UserFolder = this.FolderAddSet(data.UserFolder); this.AppendJobData(data, (int) data.Status, false, false, flag); } } } catch (Exception exception) { using (MessageDialog dialog = new MessageDialog()) { dialog.ShowMessage("E406", null, null, exception); } } finally { this.drProgress.Close(); this.drProgress.Dispose(); this.SaveFolder(); this.dtsDataView.AcceptChanges(); this.dgvDataView.Refresh(); this.stpCount(); if (this.FOpenViewFlag) { this.ViewCountCheck(true); } } } }
public void ViewRestore() { DialogResult result; using (MessageDialog dialog = new MessageDialog()) { result = dialog.ShowMessage("C408", null, null); } if (result == DialogResult.Yes) { string str = ""; string[] strArray = new string[0]; if (Directory.Exists(this.pi.BackupPath)) { strArray = Directory.GetFiles(this.pi.BackupPath, "*.dat", SearchOption.TopDirectoryOnly); } if (strArray.Length <= 0) { DialogResult result2; using (MessageDialog dialog2 = new MessageDialog()) { result2 = dialog2.ShowMessage("C409", null, null); } if (result2 != DialogResult.Yes) { return; } } if (Directory.Exists(this.pi.DataViewPath)) { Directory.Delete(this.pi.DataViewPath, true); } if (Directory.Exists(this.pi.AttachPath)) { string[] directories = Directory.GetDirectories(this.pi.AttachPath); for (int i = 0; i < directories.Length; i++) { this.AttachDelete(directories[i]); } } this.dtsDataView.Clear(); this.drProgress = new DeleteRestore(10); this.drProgress.Show(); try { this.drProgress.pgbRestore.Minimum = 0; this.drProgress.pgbRestore.Maximum = strArray.Length; for (int j = 0; j < strArray.Length; j++) { this.drProgress.pgbRestore.Value = j + 1; this.drProgress.Refresh(); str = strArray[j].ToString(); DataCompress compress = new DataCompress(Path.GetDirectoryName(strArray[j].ToString()), Path.GetFileName(strArray[j].ToString())); int count = compress.IndexList.Count; IData data = null; for (int k = 0; k < count; k++) { bool flag; string s = compress.GetData(k); data = this.SetExportData(s, out flag, false); if (data != null) { data.UserFolder = this.FolderAddSet(data.UserFolder); this.AppendJobData(data, (int) data.Status, false, false, flag); } } } } catch (Exception exception) { string message = Resources.ResourceManager.GetString("CORE65") + Environment.NewLine + Resources.ResourceManager.GetString("CORE66") + str + Environment.NewLine + Resources.ResourceManager.GetString("CORE67") + Environment.NewLine + MessageDialog.CreateExceptionMessage(exception); using (MessageDialogSimpleForm form = new MessageDialogSimpleForm()) { form.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, message); } return; } finally { this.MaxID = this.GetID(); this.SaveFolder(); this.dtsDataView.AcceptChanges(); this.dgvDataView.Refresh(); this.stpCount(); if (this.FOpenViewFlag) { this.ViewCountCheck(true); } this.drProgress.Close(); this.drProgress.Dispose(); } using (MessageDialog dialog3 = new MessageDialog()) { dialog3.ShowMessage("I502", null); } } }