예제 #1
0
        private void OpenFile_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string ids = ToolHelper.GetFullStringBySplit(GetValue(trcId), ';', ",", "'");

            if (string.IsNullOrEmpty(ids))
            {
                XtraMessageBox.Show("尚未导入文件。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Frm_DiskList diskList = new Frm_DiskList(ids);

            if (diskList.ShowDialog() == DialogResult.OK)
            {
                string querySQL = "SELECT bfi_id FROM backup_files_info A " +
                                  "LEFT JOIN transfer_registraion_cd B ON A.bfi_trcid = B.trc_id " +
                                  $"WHERE bfi_trcid IN({diskList.objectCode}) AND bfi_type = -1 " +
                                  "ORDER BY trc_code";
                object[] rootId = SqlHelper.ExecuteSingleColumnQuery(querySQL);
                if (rootId.Length == 0)
                {
                    XtraMessageBox.Show("生成文件树失败,请确认当前编号已导入对应电子文件。", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                Frm_FileSelect frm = new Frm_FileSelect(rootId);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    string[] fullPath = frm.SelectedFileName;
                    for (int i = 0; i < fullPath.Length; i++)
                    {
                        if (File.Exists(fullPath[i]))
                        {
                            if (NotExist(fullPath[i]))
                            {
                                AddFileToList(fullPath[i], frm.SelectedFileId[i]);
                            }
                            else
                            {
                                XtraMessageBox.Show($"{Path.GetFileName(fullPath[i])}文件已存在,不可重复添加。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            }
                        }
                        else
                        {
                            XtraMessageBox.Show($"无法访问指定文件[{Path.GetFileName(fullPath[i])}]", "打开失败", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                    }
                }
            }
        }
예제 #2
0
 private void dgv_SWDJ_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1 && e.ColumnIndex != -1)
     {
         string name = dgv_SWDJ.Columns[e.ColumnIndex].Name;
         //批次名称-点击事件
         if ("trp_name".Equals(name))
         {
             object    currentRowId = dgv_SWDJ.Rows[e.RowIndex].Cells["trp_id"].Value;
             Frm_AddPC frm          = new Frm_AddPC(false, currentRowId.ToString());
             if (frm.ShowDialog() == DialogResult.OK)
             {
                 LoadPCDataScoure(null);
             }
         }
         //光盘编号点击>>移动文件
         else if ("trc_code".Equals(name))
         {
             object trcId    = dgv_SWDJ.Rows[e.RowIndex].Cells["trc_id"].Value;
             string querySQL = "SELECT bfi_id FROM backup_files_info A LEFT JOIN transfer_registraion_cd B ON A.bfi_trcid = B.trc_id " +
                               $"WHERE bfi_trcid='{trcId}' AND bfi_type = -1 ORDER BY trc_code";
             object[] rootId = SqlHelper.ExecuteSingleColumnQuery(querySQL);
             if (rootId.Length > 0)
             {
                 object         trcCode    = dgv_SWDJ.Rows[e.RowIndex].Cells["trc_code"].Value;
                 Frm_FileSelect fileSelect = new Frm_FileSelect(rootId);
                 fileSelect.IsMoveMode = true;
                 fileSelect.BatchID    = BatchID;
                 fileSelect.DiskCode   = trcCode;
                 fileSelect.ShowDialog();
             }
             else
             {
                 XtraMessageBox.Show("当前光盘下尚无文件", "编辑失败");
             }
         }
     }
 }