/// <summary>
        /// 生成树节点
        /// </summary>
        /// <param name="parentId">父级节点ID</param>
        /// <param name="parentNode">父级节点</param>
        /// <param name="isShowAll">是否显示已加工节点</param>
        private void InitialTree(object parentId, TreeNode parentNode, bool isShowAll)
        {
            List <object[]> list = SqlHelper.ExecuteColumnsQuery($"SELECT bfi_id, bfi_name, bfi_path, bfi_state, bfi_type FROM backup_files_info WHERE bfi_pid='{parentId}' ORDER BY bfi_type, bfi_name", 5);

            for (int i = 0; i < list.Count; i++)
            {
                int state = ToolHelper.GetIntValue(list[i][3], 0);
                if (state != 1 || isShowAll)
                {
                    int      imageIndex = GetFileIconIndex(state, ToolHelper.GetValue(list[i][1]), list[i][4]);
                    TreeNode treeNode   = new TreeNode()
                    {
                        Name               = ToolHelper.GetValue(list[i][0]),
                        Text               = ToolHelper.GetValue(list[i][1]),
                        Tag                = ToolHelper.GetValue(list[i][2]),
                        ImageIndex         = imageIndex,
                        SelectedImageIndex = imageIndex,
                        ToolTipText        = ToolHelper.GetValue(list[i][4]),
                        StateImageKey      = state.ToString(),
                    };
                    parentNode.Nodes.Add(treeNode);
                    InitialTree(treeNode.Name, treeNode, isShowAll);
                }
            }
        }
        /// <param name="boxId">盒主键</param>
        public Frm_BorrowEditBox(object boxId, object borrowId, bool isLog)
        {
            string queryCon = string.Empty;

            if (isLog)
            {
                queryCon = $"AND bl.bl_id='{borrowId}'";
            }
            BOX_ID = boxId;
            InitializeComponent();
            cbo_FileType.Items.AddRange(new object[] { "原件", "复印件", "电子" });
            DataRow row = SqlHelper.ExecuteSingleRowQuery("SELECT * FROM processing_box " +
                                                          "LEFT JOIN(" +
                                                          "  SELECT pi_id, pi_code, pi_name FROM project_info UNION ALL " +
                                                          "  SELECT ti_id, ti_code, ti_name FROM topic_info UNION ALL " +
                                                          "  SELECT imp_id, imp_code, imp_name FROM imp_info UNION ALL " +
                                                          "  SELECT imp_id, imp_code, imp_name FROM imp_dev_info UNION ALL " +
                                                          "  SELECT si_id, si_code, si_name FROM subject_info)A ON A.pi_id = pb_obj_id " +
                                                          $"LEFT JOIN borrow_log bl ON bl.bl_file_id = pb_id {queryCon} WHERE pb_id = '{boxId}'");

            if (row != null)
            {
                lbl_Code.Tag    = string.IsNullOrEmpty(ToolHelper.GetValue(row["bl_id"])) ? null : row["bl_id"];
                lbl_pCode.Text  = ToolHelper.GetValue(row["pi_code"]);
                lbl_pName.Text  = ToolHelper.GetValue(row["pi_name"]);
                lbl_pGC.Text    = ToolHelper.GetValue(row["pb_gc_id"]);
                lbl_pBoxId.Text = ToolHelper.GetValue(row["pb_box_number"]);
                if (isLog)
                {
                    txt_Unit.Text               = ToolHelper.GetValue(row["bl_user_unit"]);
                    txt_User.Text               = ToolHelper.GetValue(row["bl_user"]);
                    txt_Phone.Text              = ToolHelper.GetValue(row["bl_user_phone"]);
                    txt_Borrow_Date.Text        = ToolHelper.GetDateValue(row["bl_date"], "yyyy-MM-dd HH:mm");
                    txt_Borrow_Term.Text        = ToolHelper.GetValue(row["bl_term"]);
                    cbo_FileType.SelectedIndex  = ToolHelper.GetIntValue(row["bl_form"], -1);
                    txt_Should_Return_Date.Text = ToolHelper.GetValue(row["bl_should_return_term"]);
                    txt_Real_Return_Date.Text   = ToolHelper.GetValue(row["bl_real_return_term"]);
                    lbl_Code.Text               = ToolHelper.GetValue(row["bl_code"]);
                    lbl_LogUser.Text            = ToolHelper.GetValue(row["bl_log_user"]);
                    txt_Remark.Text             = ToolHelper.GetValue(row["bl_remark"]);
                    string value = ToolHelper.GetValue(row["bl_id"]);
                    if (!string.IsNullOrEmpty(value))
                    {
                        lbl_Code.Tag = value;
                        int bstate = ToolHelper.GetIntValue(row["bl_return_state"], 0);
                        if (bstate != 0)
                        {
                            btn_Sure.Enabled = false;
                        }
                        else
                        {
                            btn_Sure.Text = "确认归还";
                        }
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 获取文件数/页数
        /// </summary>
        /// <param name="boxId">盒ID</param>
        /// <param name="type">获取类型
        /// <para>1:文件数</para>
        /// <para>2:页数</para>
        /// </param>
        private int GetFilePageCount(object boxId, int type)
        {
            int fileAmount = 0, filePages = 0;

            object[] pages = SqlHelper.ExecuteSingleColumnQuery($"SELECT pfl_pages FROM processing_file_list WHERE pfl_box_id='{boxId}'");
            for (int i = 0; i < pages.Length; i++)
            {
                fileAmount++;
                if (type == 2)
                {
                    filePages += ToolHelper.GetIntValue(pages[i], 0);
                }
            }
            return(type == 1 ? fileAmount : filePages);
        }
Exemple #4
0
 /// <summary>
 /// 重置控件
 /// </summary>
 private void ResetControl()
 {
     foreach (Control item in Controls)
     {
         if (item is TextBox || item is DateTimePicker)
         {
             if (!"txt_Unit".Equals(item.Name))
             {
                 item.ResetText();
             }
         }
         else if (item is NumericUpDown)
         {
             (item as NumericUpDown).Value = ToolHelper.GetIntValue(item.Tag, 0);
         }
         else if (item is System.Windows.Forms.ComboBox)
         {
             if ("txt_fileName".Equals(item.Name))
             {
                 System.Windows.Forms.ComboBox comboBox = item as System.Windows.Forms.ComboBox;
                 comboBox.Items.Clear();
                 comboBox.Text = null;
             }
             else if ("cbo_categor".Equals(item.Name))
             {
                 (item as System.Windows.Forms.ComboBox).SelectedIndex = 0;
             }
         }
         else if (item is Panel)
         {
             foreach (Control _item in item.Controls)
             {
                 if (_item is RadioButton)
                 {
                     (_item as RadioButton).Checked = false;
                 }
                 else if (_item is CheckBox)
                 {
                     (_item as CheckBox).Checked = false;
                 }
             }
         }
         else if (item is ListView)
         {
             (item as ListView).Items.Clear();
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// 卷内目录
        /// </summary>
        private string GetFileList(object boxId, object docCode, object GCNumber)
        {
            string jnmlString = Resources.jnml;

            jnmlString = jnmlString.Replace("id=\"ajbh\">", $"id=\"ajbh\">{docCode}");
            jnmlString = jnmlString.Replace("id=\"gch\">", $"id=\"gch\">{GCNumber}");

            DataTable dataTable = new DataTable();

            dataTable.Columns.AddRange(new DataColumn[]
            {
                new DataColumn("pfl_code"),
                new DataColumn("pfl_user"),
                new DataColumn("pfl_name"),
                new DataColumn("pfl_pages"),
                new DataColumn("pfl_date"),
                new DataColumn("pfl_remark"),
            });
            DataTable table = SqlHelper.ExecuteQuery($"SELECT pfl_code, pfl_user, pfl_name, pfl_pages, pfl_date, pfl_remark FROM processing_file_list WHERE pfl_box_id='{boxId}' ORDER BY pfl_box_sort");

            foreach (DataRow row in table.Rows)
            {
                dataTable.ImportRow(row);
            }
            int fileCount = dataTable.Rows.Count, pageCount = 0;
            int i = 0;

            foreach (DataRow dataRow in dataTable.Rows)
            {
                int    _page = ToolHelper.GetIntValue(dataRow["pfl_pages"], 0);
                string newRr = "<tr>" +
                               $"<td>{++i}</td>" +
                               $"<td>{dataRow["pfl_code"]}&nbsp;</td>" +
                               $"<td style=\"\">{dataRow["pfl_user"]}&nbsp;</td>" +
                               $"<td style='text-align: left;'>{dataRow["pfl_name"]}&nbsp;</td>" +
                               $"<td>{ToolHelper.GetDateValue(dataRow["pfl_date"], "yyyy-MM-dd")}&nbsp;</td>" +
                               $"<td>{(_page == 0 ? string.Empty : _page.ToString())}&nbsp;</td>" +
                               $"<td>&nbsp;</td>" +
                               $"</tr>";
                jnmlString = jnmlString.Replace("</tbody>", $"{newRr}</tbody>");
                pageCount += ToolHelper.GetIntValue(dataRow["pfl_pages"]);
            }
            jnmlString = jnmlString.Replace("id=\"fileCount\">", $"id=\"fileCount\">{fileCount}");
            jnmlString = jnmlString.Replace("id=\"pageCount\">", $"id=\"pageCount\">{pageCount}");
            return(jnmlString);
        }
Exemple #6
0
        private void 打印预览PToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataGridViewCell cell        = view.CurrentCell;
            object           ptId        = cell.OwningRow.Tag;
            object           boxId       = cell.OwningRow.Cells["print"].Tag;
            object           GCNumber    = cell.OwningRow.Cells["id"].Tag;
            string           HTML_STRING = string.Empty;

            if ("fm".Equals(cell.OwningColumn.Name))
            {
                HTML_STRING = Resources.fm;
                object fontObject = cell.OwningRow.Cells["font"].Tag;
                if (fontObject != null)
                {
                    Font font = (Font)fontObject;
                    HTML_STRING = HTML_STRING.Replace("id=\"ajmc\"", $"style=\"font-family:{font.FontFamily.Name}; \" id=\"ajmc\"");
                    HTML_STRING = HTML_STRING.Replace($"style=\"font-family:{font.FontFamily.Name}; \" id=\"ajmc\"", $"style=\"font-family:{font.FontFamily.Name}; font-size:{font.Size}pt; \" id=\"ajmc\"");
                }
                object fontObject2 = cell.OwningRow.Cells["fmbj"].Tag;
                if (fontObject2 != null)
                {
                    Font font = (Font)fontObject2;
                    HTML_STRING = HTML_STRING.Replace("id=\"ktmc\"", $"style=\"font-family:{font.FontFamily.Name}; \" id=\"ktmc\"");
                    HTML_STRING = HTML_STRING.Replace($"style=\"font-family:{font.FontFamily.Name}; \" id=\"ktmc\"", $"style=\"font-family:{font.FontFamily.Name}; font-size:{font.Size}pt; \" id=\"ktmc\"");
                }
                object bj      = cell.OwningRow.Cells["fmbj"].Value;
                object docName = SqlHelper.ExecuteOnlyOneQuery($"SELECT pt_name FROM processing_tag WHERE pt_id='{ptId}'");
                HTML_STRING = GetCoverHtmlString(docName, HTML_STRING, bj, GCNumber);
            }
            else if ("bkb".Equals(cell.OwningColumn.Name))
            {
                object docCode   = SqlHelper.ExecuteOnlyOneQuery($"SELECT pt_code FROM processing_tag WHERE pt_id='{ptId}'");
                object boxNumber = cell.OwningRow.Cells["id"].Value;
                HTML_STRING = GetBackupTable(boxId, docCode, ToolHelper.GetIntValue(boxNumber, 1));
            }
            else if ("jnml".Equals(cell.OwningColumn.Name))
            {
                object docCode = SqlHelper.ExecuteOnlyOneQuery($"SELECT pt_code FROM processing_tag WHERE pt_id='{ptId}'");
                HTML_STRING = GetFileList(boxId, docCode, GCNumber);
            }
            new WebBrowser()
            {
                DocumentText = HTML_STRING, Size = new Size(500, 500)
            }.DocumentCompleted += Preview_DocumentCompleted;
        }
Exemple #7
0
        /// <summary>
        /// 删除选中数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Delete_Click(object sender, EventArgs e)
        {
            int amount = dgv_SWDJ.SelectedRows.Count;

            if (amount > 0)
            {
                int    index     = ToolHelper.GetIntValue(btn_Delete.Tag, -1);
                string tipString = $"此操作会删除选中{(index == 1 ? "批次" : "光盘")}下所有已存在数据,是否确认继续?";
                if (XtraMessageBox.Show(tipString, "删除确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    int type = tc_ToR.SelectedTabPageIndex;
                    if (type == 0)
                    {
                        if (index == 1)
                        {
                            foreach (DataGridViewRow row in dgv_SWDJ.SelectedRows)
                            {
                                string tipMsg = $"即将删除{row.Cells["trp_code"].Value}批次下所有数据,请确认是否继续?";
                                if (XtraMessageBox.Show(tipMsg, "确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
                                {
                                    object pid = row.Cells["trp_id"].Value;
                                    DeleteBatchById(pid);
                                }
                            }
                            LoadPCDataScoure(null);
                        }
                        else if (index == 2)
                        {
                            foreach (DataGridViewRow row in dgv_SWDJ.SelectedRows)
                            {
                                object cid = row.Cells["trc_id"].Value;
                                DeleteCDById(cid);
                            }
                            RefreshCDAmountByPid(BatchID);
                            LoadCDDataScoure(BatchID, BatchName);
                        }
                    }
                    XtraMessageBox.Show("删除成功。", "提示");
                }
            }
            else
            {
                XtraMessageBox.Show("请先至少选择一条要删除的数据!", "尚未选择数据", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Exemple #8
0
        private void LoadFileInfo(object fileId)
        {
            DataRow row = SqlHelper.ExecuteSingleRowQuery($"SELECT * FROM processing_file_list WHERE pfl_id='{fileId}'");

            if (row != null)
            {
                cbo_stage.SelectedValue   = row["pfl_stage"];
                cbo_categor.SelectedValue = row["pfl_categor"];
                txt_fileCode.Text         = GetValue(row["pfl_code"]);
                txt_User.Text             = GetValue(row["pfl_user"]);
                txt_fileName.Text         = GetValue(row["pfl_name"]);
                txt_date.Text             = ToolHelper.GetDateValue(row["pfl_date"], "yyyy-MM-dd");
                num_Pages.Value           = ToolHelper.GetIntValue(row["pfl_pages"], 0);
                num_Count.Value           = ToolHelper.GetIntValue(row["pfl_count"], 0);
                num_Amount.Value          = ToolHelper.GetIntValue(row["pfl_amount"], 0);
                SetRadioValue(row["pfl_type"], pal_type);
                txt_Unit.Text = GetValue(row["pfl_unit"]);
                LoadFileLinkList(GetValue(row["pfl_file_id"]));
                txt_Remark.Text = GetValue(row["pfl_remark"]);
                LoadFileLinkList(fileId);
            }
        }
Exemple #9
0
        /// <summary>
        /// 获取统计数(若结果为null或非数字,则默认返回0)
        /// </summary>
        public static int ExecuteCountQuery(string querySql)
        {
            object value = ExecuteOnlyOneQuery(querySql);

            return(ToolHelper.GetIntValue(value, 0));
        }
Exemple #10
0
        /// <summary>
        /// 加载光盘列表
        /// </summary>
        private void LoadGPDJ(string _querySql)
        {
            dgv_GPDJ.Rows.Clear();
            dgv_GPDJ.Columns.Clear();

            dgv_GPDJ.Columns.AddRange(new DataGridViewColumn[]
            {
                new DataGridViewTextBoxColumn()
                {
                    Name = "trc_id"
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "dd_name", HeaderText = "来源单位", FillWeight = 15, SortMode = DataGridViewColumnSortMode.NotSortable
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "trc_code", HeaderText = "光盘编号", FillWeight = 15, SortMode = DataGridViewColumnSortMode.NotSortable
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "trc_name", HeaderText = "光盘名称", FillWeight = 15, SortMode = DataGridViewColumnSortMode.NotSortable
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "trc_project_amount", HeaderText = "项目数", FillWeight = 6, SortMode = DataGridViewColumnSortMode.NotSortable
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "trc_subject_amount", HeaderText = "课题数", FillWeight = 6, SortMode = DataGridViewColumnSortMode.NotSortable
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "trc_file_amount", HeaderText = "文件数", FillWeight = 6, SortMode = DataGridViewColumnSortMode.NotSortable
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "trc_status", HeaderText = "读写状态", FillWeight = 10, SortMode = DataGridViewColumnSortMode.NotSortable
                },
                new DataGridViewButtonColumn()
                {
                    Name = "control", HeaderText = "操作", FillWeight = 7, Text = "读写", UseColumnTextForButtonValue = true, SortMode = DataGridViewColumnSortMode.NotSortable
                },
            });

            DataTable table = null;

            if (_querySql == null)
            {
                StringBuilder querySql = new StringBuilder("SELECT trc_id, trp_submit_status, dd_name, trc_code, trc_name, trc_status, trp_name " +
                                                           "FROM transfer_registraion_cd trc LEFT JOIN(" +
                                                           "SELECT trp.trp_id, trp.trp_submit_status, dd_name, dd_sort, trp_name FROM transfer_registration_pc trp, data_dictionary dd WHERE trp.com_id = dd.dd_id ) tb " +
                                                           "ON trc.trp_id = tb.trp_id WHERE 1=1 AND trp_submit_status=1 ORDER BY CASE WHEN dd_name IS NULL THEN 1 ELSE 0 END, trc_status ASC, dd_sort, trc_sort, trc_code");
                table = SqlHelper.ExecuteQuery(querySql.ToString());
            }
            else
            {
                table = SqlHelper.ExecuteQuery(_querySql);
            }
            foreach (DataRow row in table.Rows)
            {
                int _index = dgv_GPDJ.Rows.Add();
                dgv_GPDJ.Rows[_index].Tag = row["trp_name"];
                dgv_GPDJ.Rows[_index].Cells["trc_id"].Value             = row["trc_id"];
                dgv_GPDJ.Rows[_index].Cells["dd_name"].Value            = row["dd_name"];
                dgv_GPDJ.Rows[_index].Cells["trc_code"].Value           = row["trc_code"];
                dgv_GPDJ.Rows[_index].Cells["trc_name"].Value           = row["trc_name"];
                dgv_GPDJ.Rows[_index].Cells["trc_project_amount"].Value = GetProjectAmount(row["trc_id"]);
                dgv_GPDJ.Rows[_index].Cells["trc_subject_amount"].Value = GetSubjectAmount(row["trc_id"]);
                dgv_GPDJ.Rows[_index].Cells["trc_file_amount"].Value    = GetFileAmount(row["trc_id"]);
                dgv_GPDJ.Rows[_index].Cells["trc_status"].Tag           = row["trc_status"];
                int statuNum = ToolHelper.GetIntValue(row["trc_status"]);
                if (statuNum != 2)
                {
                    dgv_GPDJ.Rows[_index].Cells["trc_status"].Style.ForeColor = System.Drawing.Color.DarkRed;
                }
                dgv_GPDJ.Rows[_index].Cells["trc_status"].Value = GetReadStatus(statuNum);
            }
            if (dgv_GPDJ.Columns.Count > 0)
            {
                dgv_GPDJ.Columns[0].Visible = false;
            }
        }