Пример #1
0
 public void ResourceCopy()
 {
     PathInfo info = PathInfo.CreateInstance();
     string path = Path.Combine(info.ProtocolEnvironmentPath, "copy.cfg");
     if (File.Exists(path))
     {
         using (DeleteRestore restore = new DeleteRestore(5))
         {
             restore.Show();
             restore.Refresh();
             try
             {
                 string serverPath = "";
                 using (StreamReader reader = new StreamReader(path, Encoding.GetEncoding("UTF-8")))
                 {
                     serverPath = reader.ReadLine();
                 }
                 if (serverPath.Length != 0)
                 {
                     string directoryName = Path.GetDirectoryName(info.TemplateRoot.TrimEnd(new char[] { '\\' }));
                     this.RestoreDelete(directoryName, serverPath);
                     this.CopyDirectory(serverPath, directoryName);
                 }
             }
             catch (Exception exception)
             {
                 string message = Resources.ResourceManager.GetString("CORE17") + Environment.NewLine + Resources.ResourceManager.GetString("CORE18") + Environment.NewLine + Resources.ResourceManager.GetString("CORE19") + Environment.NewLine + Environment.NewLine + MessageDialog.CreateExceptionMessage(exception);
                 using (MessageDialogSimpleForm form = new MessageDialogSimpleForm())
                 {
                     form.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Warning, message);
                 }
             }
         }
     }
 }
Пример #2
0
 private void mnFileDataViewAppend_Click(object sender, EventArgs e)
 {
     this.ofdMain.Multiselect = true;
     this.ofdMain.InitialDirectory = this.GetInitialDirectory();
     if (this.ofdMain.ShowDialog() == DialogResult.OK)
     {
         DeleteRestore restore = new DeleteRestore(3);
         restore.Show();
         restore.pgbRestore.Minimum = 0;
         restore.pgbRestore.Maximum = this.ofdMain.FileNames.Length;
         try
         {
             int num = 0;
             foreach (string str in this.ofdMain.FileNames)
             {
                 IData data;
                 num++;
                 restore.pgbRestore.Value = num;
                 restore.Refresh();
                 try
                 {
                     data = DataFactory.LoadFromEdiFile(str);
                 }
                 catch (Exception exception)
                 {
                     MessageDialog dialog = new MessageDialog();
                     dialog.ShowMessage("E302", str, null, exception);
                     dialog.Dispose();
                     return;
                 }
                 if (data.Header.OutCode.Trim() != "")
                 {
                     this.idv.AppendJobData(data, 2, false, false, false);
                 }
                 else
                 {
                     using (MessageDialog dialog2 = new MessageDialog())
                     {
                         dialog2.ShowMessage("W406", null, null);
                     }
                 }
             }
         }
         finally
         {
             restore.Close();
             restore.Dispose();
             this.idv.DataViewSaveRepaint();
         }
     }
 }
Пример #3
0
 private void FileSend(object sender)
 {
     this.cancelflag = false;
     if (base.ComStatus == 0)
     {
         MessageDialog dialog = new MessageDialog();
         if (dialog.ShowMessage("C102", "") != DialogResult.Yes)
         {
             dialog.Dispose();
             return;
         }
         dialog.Dispose();
     }
     base.ofdMain.Multiselect = true;
     base.ofdMain.InitialDirectory = base.GetInitialDirectory();
     if (base.ofdMain.ShowDialog() == DialogResult.OK)
     {
         base.SendReportDlg.Dispose();
         base.SendReportDlg = new USendReportDlg();
         base.BatchSendFlag = true;
         DeleteRestore restore = new DeleteRestore(1) {
             pgbRestore = { Minimum = 0, Maximum = base.ofdMain.FileNames.Length }
         };
         restore.Show();
         base.Enabled = false;
         base.SendReportDlg.Clear();
         for (int i = 0; i < base.ofdMain.FileNames.Length; i++)
         {
             restore.pgbRestore.Value = i + 1;
             restore.Refresh();
             base.SendReportDlg.Add(base.ofdMain.FileNames[i]);
             Application.DoEvents();
             IData data = null;
             try
             {
                 data = DataFactory.LoadFromEdiFile(base.ofdMain.FileNames[i]);
             }
             catch (Exception exception)
             {
                 base.SendReportDlg.SetStatus(i, USendReportDlg.ReportStatus.Error, null, "Failure in Registering.");
                 MessageDialog dialog2 = new MessageDialog();
                 dialog2.ShowMessage("E302", base.ofdMain.FileNames[i], null, exception);
                 dialog2.Dispose();
                 continue;
             }
             if ((sender == null) && (data.JobCode.Trim() == ""))
             {
                 base.SendReportDlg.SetStatus(i, USendReportDlg.ReportStatus.Error, null, "Failure in Registering.");
                 base.JobError(-1);
             }
             else if (data != null)
             {
                 object obj2;
                 if (sender == null)
                 {
                     if (!base.SearchDispCode(data))
                     {
                         UJobInputDlg dlg = new UJobInputDlg();
                         dlg.SetCodeSelect(data.JobCode.Trim());
                         if (dlg.ShowDialog() == DialogResult.OK)
                         {
                             data.Header.DispCode = dlg.DispCode;
                             dlg.Close();
                             dlg.Dispose();
                         }
                         else
                         {
                             dlg.Close();
                             dlg.Dispose();
                             base.SendReportDlg.SetStatus(i, USendReportDlg.ReportStatus.Error, null, "Failure in Registering.");
                             continue;
                         }
                     }
                     obj2 = base.JobFormOpen(data, false);
                 }
                 else
                 {
                     try
                     {
                         ((CommonJobForm) sender).SetSendData(data);
                         obj2 = sender;
                     }
                     catch
                     {
                         base.JobError(-11);
                         continue;
                     }
                 }
                 if (obj2 == null)
                 {
                     base.SendReportDlg.SetStatus(i, USendReportDlg.ReportStatus.Error, null, "Failure in Registering.");
                 }
                 else
                 {
                     string str;
                     try
                     {
                         str = ((CommonJobForm) obj2).AppendJobData();
                     }
                     catch
                     {
                         str = "";
                     }
                     if (str == "")
                     {
                         base.SendReportDlg.SetStatus(i, USendReportDlg.ReportStatus.Error, null, "Failure in Registering.");
                     }
                     else
                     {
                         if (sender == null)
                         {
                             ((CommonJobForm) obj2).Close();
                             ((CommonJobForm) obj2).Dispose();
                         }
                         base.SendReportDlg.SetStatus(i, USendReportDlg.ReportStatus.Wait, str, "");
                     }
                 }
             }
             else
             {
                 base.SendReportDlg.SetStatus(i, USendReportDlg.ReportStatus.Error, null, "Failure in Registering.");
             }
         }
         base.Enabled = true;
         this.SendRecvDlgHide();
         restore.Close();
         restore.Dispose();
         if (base.ComStatus == 1)
         {
             base.StatusChange(1);
             this.bSendFlag = true;
             bool flg = true;
             if (base.idv.sExistenceCheck())
             {
                 MessageDialog dialog3 = new MessageDialog();
                 if (dialog3.ShowMessage("I105", "") == DialogResult.Yes)
                 {
                     this.SendAllCount = base.idv.GetCount(1);
                     flg = true;
                 }
                 else
                 {
                     this.SendAllCount = base.idv.GetCount(5);
                     flg = false;
                 }
             }
             else
             {
                 this.SendAllCount = base.idv.GetCount(1);
             }
             this.SendCount = 0;
             this.BatchSend(flg);
         }
         else
         {
             base.BatchSendFlag = false;
             MessageDialog dialog4 = new MessageDialog();
             if (dialog4.ShowMessage("I002", base.SendReportDlg.StatusCount(USendReportDlg.ReportStatus.Wait).ToString(), "") == DialogResult.Yes)
             {
                 base.SendReportDlg.Show();
             }
             dialog4.Dispose();
         }
     }
 }
Пример #4
0
 public virtual void DataUndo()
 {
     if ((this.tvSendRecvFolder.SelectedNode.Index == 3) && (this.dgvDataView.SelectedRows != null))
     {
         this.drProgress = new DeleteRestore(8);
         this.drProgress.Show();
         StringList sl = new StringList();
         try
         {
             this.drProgress.pgbRestore.Minimum = 0;
             this.drProgress.pgbRestore.Maximum = this.dgvDataView.SelectedRows.Count;
             IData data = null;
             for (int i = this.dgvDataView.SelectedRows.Count - 1; i > -1; i--)
             {
                 this.drProgress.pgbRestore.Value++;
                 this.drProgress.Refresh();
                 DataRow[] rowArray = this.dtsDataView.Tables["NACCS"].Select("clID = " + this.dgvDataView.SelectedRows[i].Cells["clmID"].Value);
                 rowArray[0]["clDelete"] = 0;
                 rowArray[0]["clFolder"] = this.FolderAddSet(rowArray[0]["clFolder"].ToString());
                 if (((rowArray[0]["clStatus"].ToString() == "r") && (rowArray[0]["clFolder"].ToString() != "")) && !this.ExistCheck(sl, rowArray[0]["clFolder"].ToString()))
                 {
                     sl.Add(rowArray[0]["clFolder"].ToString());
                 }
                 data = this.GetData(int.Parse(rowArray[0]["clID"].ToString()));
                 if (data == null)
                 {
                     rowArray[0].Delete();
                 }
                 else
                 {
                     data.IsDeleted = false;
                     data.UserFolder = rowArray[0]["clFolder"].ToString();
                     this.DataViewDataSave(data, rowArray[0]["clFileName"].ToString());
                 }
             }
         }
         catch (Exception exception)
         {
             string message = Resources.ResourceManager.GetString("CORE60") + Environment.NewLine + MessageDialog.CreateExceptionMessage(exception);
             using (MessageDialogSimpleForm form = new MessageDialogSimpleForm())
             {
                 form.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, message);
             }
         }
         finally
         {
             this.SaveFolder();
             this.dtsDataView.AcceptChanges();
             this.dgvDataView.Refresh();
             this.stpCount();
             if (this.FOpenViewFlag)
             {
                 for (int j = 0; j < sl.Count; j++)
                 {
                     this.ViewCountChange(sl[j]);
                 }
             }
             this.drProgress.Close();
             this.drProgress.Dispose();
         }
     }
 }
Пример #5
0
 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();
         }
     }
 }
Пример #6
0
 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);
             }
         }
     }
 }
Пример #7
0
 public void ClearDelete()
 {
     this.drProgress = new DeleteRestore(0);
     this.drProgress.Show();
     try
     {
         DataRow[] rowArray = this.dtsDataView.Tables["NACCS"].Select("clDelete = 1");
         this.drProgress.pgbRestore.Minimum = 0;
         this.drProgress.pgbRestore.Maximum = rowArray.Length;
         for (int i = 0; i < rowArray.Length; i++)
         {
             this.drProgress.pgbRestore.Value = i + 1;
             this.drProgress.Refresh();
             try
             {
                 if (File.Exists(this.pi.DataViewPath + rowArray[i]["clFileName"].ToString()))
                 {
                     File.Delete(this.pi.DataViewPath + rowArray[i]["clFileName"].ToString());
                 }
                 if ((rowArray[i]["clSign"].ToString() != "0") && File.Exists(rowArray[i]["clSignPath"].ToString()))
                 {
                     File.Delete(rowArray[i]["clSignPath"].ToString());
                 }
             }
             catch (Exception exception)
             {
                 string message = Resources.ResourceManager.GetString("CORE61") + Environment.NewLine + MessageDialog.CreateExceptionMessage(exception);
                 using (MessageDialogSimpleForm form = new MessageDialogSimpleForm())
                 {
                     form.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, message);
                 }
             }
             this.AttachDelete(rowArray[i]["clAttach"].ToString());
             rowArray[i].Delete();
         }
         this.dtsDataView.AcceptChanges();
         this.dgvDataView.Refresh();
         this.stpCount();
     }
     finally
     {
         this.drProgress.Close();
         this.drProgress.Dispose();
     }
 }
Пример #8
0
 public virtual void DataDelete(int DNInt)
 {
     if (DNInt == -1)
     {
         int index = this.tvSendRecvFolder.SelectedNode.Index;
     }
     if ((this.tvSendRecvFolder.SelectedNode.Level != 0) && ((this.tvSendRecvFolder.SelectedNode.Level > 0) && (this.dgvDataView.SelectedRows != null)))
     {
         this.drProgress = new DeleteRestore(7);
         this.drProgress.Show();
         try
         {
             this.drProgress.pgbRestore.Minimum = 0;
             this.drProgress.pgbRestore.Maximum = this.dgvDataView.SelectedRows.Count;
             IData data = null;
             for (int i = this.dgvDataView.SelectedRows.Count - 1; i > -1; i--)
             {
                 this.drProgress.pgbRestore.Value++;
                 this.drProgress.Refresh();
                 DataRow[] rowArray = this.dtsDataView.Tables["NACCS"].Select("clID = " + this.dgvDataView.SelectedRows[i].Cells["clmID"].Value);
                 rowArray[0]["clDelete"] = 1;
                 data = this.GetData(int.Parse(rowArray[0]["clID"].ToString()));
                 if (data == null)
                 {
                     rowArray[0].Delete();
                 }
                 else
                 {
                     data.IsDeleted = true;
                     this.DataViewDataSave(data, rowArray[0]["clFileName"].ToString());
                 }
             }
         }
         catch (Exception exception)
         {
             string message = Resources.ResourceManager.GetString("CORE58") + Environment.NewLine + MessageDialog.CreateExceptionMessage(exception);
             using (MessageDialogSimpleForm form = new MessageDialogSimpleForm())
             {
                 form.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, message);
             }
         }
         finally
         {
             this.dtsDataView.AcceptChanges();
             this.dgvDataView.Refresh();
             this.stpCount();
             if (this.FOpenViewFlag)
             {
                 this.ViewCountChange(this.GetFullPath(this.tvSendRecvFolder.SelectedNode.FullPath));
             }
             this.drProgress.Close();
             this.drProgress.Dispose();
         }
     }
 }
Пример #9
0
 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);
         }
     }
 }
Пример #10
0
 public void ViewRepair(bool StartFlag)
 {
     if (!StartFlag)
     {
         DialogResult result;
         using (MessageDialog dialog = new MessageDialog())
         {
             result = dialog.ShowMessage("C407", null, null);
         }
         if (result != DialogResult.Yes)
         {
             return;
         }
         this.DataViewNoRepaint(true);
     }
     ULogClass.LogWrite(string.Format("ViewRepair Start", new object[0]));
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     this.drProgress = new DeleteRestore(6);
     if (StartFlag)
     {
         this.drProgress.TopMost = true;
     }
     this.drProgress.Show();
     int num = 0;
     string path = Path.Combine(this.pi.LogPath, "Repair" + DateTime.Now.ToString("yyyyMMddHHmmssff"));
     try
     {
         try
         {
             this.dtsDataView.Clear();
             string[] strArray = new string[0];
             if (Directory.Exists(this.pi.DataViewPath))
             {
                 strArray = Directory.GetFiles(this.pi.DataViewPath, "*.txt", SearchOption.TopDirectoryOnly);
             }
             ULogClass.LogWrite(string.Format("ViewRepair GetFiles Count={0} [timer {1}]", strArray.Length, stopwatch.ElapsedMilliseconds));
             IData data = null;
             this.drProgress.pgbRestore.Minimum = 0;
             this.drProgress.pgbRestore.Maximum = strArray.Length;
             for (int i = 0; i < strArray.Length; i++)
             {
                 this.drProgress.pgbRestore.Value = i + 1;
                 this.drProgress.Refresh();
                 try
                 {
                     data = DataFactory.LoadFromDataView(i.ToString(), strArray[i]);
                 }
                 catch
                 {
                     if ((num == 0) && !Directory.Exists(path))
                     {
                         Directory.CreateDirectory(path);
                     }
                     string destFileName = Path.Combine(path, Path.GetFileName(strArray[i].ToString()));
                     try
                     {
                         File.Copy(strArray[i], destFileName, true);
                         File.Delete(strArray[i]);
                     }
                     catch
                     {
                     }
                     num++;
                     continue;
                 }
                 if ((!data.IsDeleted && (data.Status == DataStatus.Recept)) && !string.IsNullOrEmpty(data.UserFolder))
                 {
                     data.UserFolder = this.FolderAddSet(data.UserFolder);
                 }
                 data.ID = i.ToString();
                 string fileName = Path.GetFileName(strArray[i].ToString());
                 this.DataViewDataAdd(data, fileName, false);
                 this.DataViewDataSave(data, fileName.ToString());
             }
         }
         catch (Exception exception)
         {
             this.dgvDataView.Refresh();
             if (!StartFlag)
             {
                 this.stpCount();
                 if (this.FOpenViewFlag)
                 {
                     this.ViewCountCheck(true);
                 }
             }
             MessageDialog dialog2 = new MessageDialog();
             dialog2.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, Resources.ResourceManager.GetString("CORE107") + Environment.NewLine + MessageDialog.CreateExceptionMessage(exception));
             dialog2.Dispose();
             return;
         }
         this.dgvDataView.Refresh();
         if (!StartFlag)
         {
             this.stpCount();
             if (this.FOpenViewFlag)
             {
                 this.ViewCountCheck(true);
             }
         }
     }
     finally
     {
         stopwatch.Stop();
         ULogClass.LogWrite(string.Format("ViewRepair Ended [Timer {0}]", stopwatch.ElapsedMilliseconds));
         this.MaxID = this.GetID();
         if (!StartFlag)
         {
             this.DataViewNoRepaint(false);
         }
         this.drProgress.Close();
         this.drProgress.Dispose();
         if (num > 0)
         {
             using (MessageDialog dialog3 = new MessageDialog())
             {
                 dialog3.ShowMessage("W402", num.ToString(), "");
             }
         }
     }
 }
Пример #11
0
 protected virtual void tvSendRecvFolder_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(typeof(DataGridViewSelectedRowCollection)))
     {
         try
         {
             TreeView view = (TreeView) sender;
             TreeNode nodeAt = view.GetNodeAt(view.PointToClient(new Point(e.X, e.Y)));
             if ((nodeAt != null) && this.IsMoveDataCheck(nodeAt))
             {
                 if ((nodeAt.Level == 1) && (nodeAt.Index == 3))
                 {
                     this.DataDelete(this.dtn.Index);
                 }
                 else
                 {
                     this.drProgress = new DeleteRestore(9);
                     this.drProgress.Show();
                     try
                     {
                         this.drProgress.pgbRestore.Minimum = 0;
                         this.drProgress.pgbRestore.Maximum = this.dgvDataView.SelectedRows.Count;
                         IData data = null;
                         for (int i = this.dgvDataView.SelectedRows.Count - 1; i > -1; i--)
                         {
                             this.drProgress.pgbRestore.Value++;
                             this.drProgress.Refresh();
                             DataRow[] rowArray = this.dtsDataView.Tables["NACCS"].Select("clID = " + this.dgvDataView.SelectedRows[this.dgvDataView.SelectedRows.Count - 1].Cells["clmID"].Value);
                             data = this.GetData(int.Parse(rowArray[0]["clID"].ToString()));
                             if (data == null)
                             {
                                 rowArray[0].Delete();
                             }
                             else
                             {
                                 if (nodeAt.Level == 1)
                                 {
                                     rowArray[0]["clFolder"] = "";
                                     data.UserFolder = "";
                                 }
                                 else
                                 {
                                     rowArray[0]["clFolder"] = this.GetFullPath(nodeAt.FullPath);
                                     data.UserFolder = this.GetFullPath(nodeAt.FullPath);
                                 }
                                 this.DataViewDataSave(data, rowArray[0]["clFileName"].ToString());
                             }
                         }
                     }
                     catch (Exception exception)
                     {
                         string message = Resources.ResourceManager.GetString("CORE53") + Environment.NewLine + MessageDialog.CreateExceptionMessage(exception);
                         using (MessageDialogSimpleForm form = new MessageDialogSimpleForm())
                         {
                             form.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, message);
                         }
                     }
                     finally
                     {
                         this.dtsDataView.AcceptChanges();
                         this.dgvDataView.Refresh();
                         this.drProgress.Close();
                         this.drProgress.Dispose();
                     }
                 }
                 this.tvSendRecvFolder.SelectedNode = this.dtn;
                 if (this.FOpenViewFlag)
                 {
                     if (((nodeAt.Level == 1) && (nodeAt.Index == 0)) || (nodeAt.Level > 1))
                     {
                         this.ViewCountChange(this.GetFullPath(nodeAt.FullPath));
                     }
                     if (((this.dtn.Level == 1) && (this.dtn.Index == 0)) || (this.dtn.Level > 1))
                     {
                         this.ViewCountChange(this.GetFullPath(this.dtn.FullPath));
                     }
                 }
             }
             else
             {
                 e.Effect = DragDropEffects.None;
             }
         }
         finally
         {
             this.DragFlag = false;
             this.stpCount();
         }
     }
 }
Пример #12
0
 private void MultSave()
 {
     USaveFolderDlg dlg = new USaveFolderDlg {
         SelectPath = this.GetSaveFolder(this.GetData(this.GetKeyID()))
     };
     if (dlg.ShowDialog() != DialogResult.OK)
     {
         dlg.Close();
         dlg.Dispose();
     }
     else
     {
         string selectPath = dlg.SelectPath;
         string fName = dlg.FName;
         dlg.Close();
         dlg.Dispose();
         this.drProgress = new DeleteRestore(2);
         this.drProgress.Show();
         string path = "";
         try
         {
             this.drProgress.Refresh();
             if (!Directory.Exists(selectPath))
             {
                 Directory.CreateDirectory(selectPath);
             }
             int length = this.dgvDataView.SelectedRows.Count.ToString().Length;
             int num2 = 1;
             IData data = null;
             List<string[]> list = new List<string[]>();
             for (int i = 0; i < this.dgvDataView.Rows.Count; i++)
             {
                 if (this.dgvDataView.Rows[i].Selected)
                 {
                     string[] item = new string[] { this.dgvDataView.Rows[i].Cells["clmID"].Value.ToString(), Path.Combine(this.pi.DataViewPath, this.dgvDataView.Rows[i].Cells["clmFileName"].Value.ToString()) };
                     list.Add(item);
                 }
             }
             this.drProgress.pgbRestore.Minimum = 0;
             this.drProgress.pgbRestore.Maximum = list.Count;
             for (int j = 0; j < list.Count; j++)
             {
                 this.drProgress.pgbRestore.Value = num2;
                 this.drProgress.Refresh();
                 data = DataFactory.LoadFromDataView(list[j][0], list[j][1]);
                 path = Path.Combine(selectPath, fName + num2.ToString().PadLeft(length, '0') + ".txt");
                 if (File.Exists(path))
                 {
                     MessageDialog dialog = new MessageDialog();
                     if (dialog.ShowMessage("C301", path, "") != DialogResult.Yes)
                     {
                         dialog.Dispose();
                         num2++;
                         continue;
                     }
                 }
                 DataFactory.SaveToEdiFile(data, path);
                 this.SaveStatusChange(data.ID, false);
                 num2++;
             }
         }
         catch (Exception exception)
         {
             MessageDialog dialog2 = new MessageDialog();
             dialog2.ShowMessage("E303", path, null, exception);
             dialog2.Dispose();
         }
         finally
         {
             this.dtsDataView.AcceptChanges();
             this.dgvDataView.Refresh();
             this.stpCount();
             this.drProgress.Close();
             this.drProgress.Dispose();
         }
     }
 }
Пример #13
0
 public void Distribute(bool SelFlag, IData data)
 {
     if ((!SelFlag || (this.dgvDataView.SelectedRows.Count > 0)) || (data != null))
     {
         StringList sl = new StringList();
         IData data2 = null;
         List<string> lst = new List<string>();
         if (SelFlag)
         {
             for (int i = 0; this.dgvDataView.SelectedRows.Count > i; i++)
             {
                 lst.Add(this.dgvDataView.SelectedRows[i].Cells["clmID"].Value.ToString());
             }
         }
         bool flag = data == null;
         if (flag)
         {
             this.drProgress = new DeleteRestore(12);
             this.drProgress.Show();
             this.drProgress.Refresh();
         }
         try
         {
             string str;
             DataRow[] rowArray;
             IData data3 = null;
             if (data == null)
             {
                 DBFix dBFixStr = new DBFix {
                     JobCode = "",
                     OutCode = "",
                     UserCode = "",
                     Open = "1"
                 };
                 str = this.FixListString(dBFixStr, SelFlag, data, lst);
                 rowArray = this.dtsDataView.Tables["NACCS"].Select(str);
                 if (rowArray.Length == 0)
                 {
                     return;
                 }
                 this.drProgress.pgbRestore.Minimum = 0;
                 this.drProgress.pgbRestore.Maximum = rowArray.Length;
                 for (int k = 0; k < rowArray.Length; k++)
                 {
                     this.drProgress.pgbRestore.Value = k + 1;
                     this.drProgress.Refresh();
                     if (rowArray[k]["clFolder"].ToString() != "")
                     {
                         if (!this.ExistCheck(sl, rowArray[k]["clFolder"].ToString()))
                         {
                             sl.Add(rowArray[k]["clFolder"].ToString());
                         }
                         rowArray[k]["clFolder"] = "";
                         data3 = this.GetData(int.Parse(rowArray[k]["clID"].ToString()));
                         if (data3 == null)
                         {
                             rowArray[k].Delete();
                         }
                         else
                         {
                             data3.UserFolder = "";
                             this.DataViewDataSave(data3, rowArray[k]["clFileName"].ToString());
                         }
                     }
                 }
                 this.dtsDataView.AcceptChanges();
             }
             for (int j = this.DBFixList.Count - 1; j > -1; j--)
             {
                 for (int m = 0; m < this.DBFixList.Count; m++)
                 {
                     if (this.DBFixList[m].Priority == (j + 1))
                     {
                         str = this.FixListString(this.DBFixList[m], SelFlag, data, lst);
                         rowArray = this.dtsDataView.Tables["NACCS"].Select(str);
                         if (rowArray.Length != 0)
                         {
                             if (flag)
                             {
                                 this.drProgress.pgbRestore.Minimum = 0;
                                 this.drProgress.pgbRestore.Maximum = rowArray.Length;
                             }
                             for (int n = 0; n < rowArray.Length; n++)
                             {
                                 if (flag)
                                 {
                                     this.drProgress.pgbRestore.Value = n + 1;
                                     this.drProgress.Refresh();
                                 }
                                 if ((this.FOpenViewFlag && (rowArray[n]["clOpen"].ToString() == "0")) && (rowArray[n]["clFolder"].ToString() != this.DBFixList[m].Folder))
                                 {
                                     if ((rowArray[n]["clFolder"].ToString() != "") && !this.ExistCheck(sl, rowArray[n]["clFolder"].ToString()))
                                     {
                                         sl.Add(rowArray[n]["clFolder"].ToString());
                                     }
                                     if (!this.ExistCheck(sl, this.DBFixList[m].Folder))
                                     {
                                         sl.Add(this.DBFixList[m].Folder);
                                     }
                                 }
                                 rowArray[n]["clFolder"] = this.DBFixList[m].Folder;
                                 data2 = this.GetData(int.Parse(rowArray[n]["clID"].ToString()));
                                 if (data2 == null)
                                 {
                                     rowArray[n].Delete();
                                 }
                                 else
                                 {
                                     data2.UserFolder = this.DBFixList[m].Folder;
                                     this.DataViewDataSave(data2, rowArray[n]["clFileName"].ToString());
                                 }
                             }
                             this.dtsDataView.AcceptChanges();
                         }
                     }
                 }
             }
         }
         finally
         {
             this.dgvDataView.Refresh();
             this.stpCount();
             if (this.FOpenViewFlag)
             {
                 this.ViewCountCheck(true);
             }
             if (flag)
             {
                 this.drProgress.Close();
                 this.drProgress.Dispose();
             }
         }
     }
 }