Пример #1
0
        private void LoadLoginLog(string key)
        {
            view.Rows.Clear();
            searchControl.Properties.Items.Clear();
            string querySQL = $"SELECT TOP(1000) sll.*, ul.real_name FROM sys_login_log sll " +
                              $"LEFT JOIN user_list ul ON sll_user_id = ul_id WHERE 1=1 ";

            if (key != null)
            {
                querySQL += $" AND ul.real_name LIKE '%{key}%' ";
            }
            querySQL += "ORDER BY CONVERT(DATETIME, sll_online_date) DESC";
            DataTable table = SqlHelper.ExecuteQuery(querySQL);

            foreach (DataRow row in table.Rows)
            {
                int i = view.Rows.Add();
                view.Rows[i].Cells["id"].Value        = i + 1;
                view.Rows[i].Cells["username"].Value  = row["real_name"];
                view.Rows[i].Cells["ipaddress"].Value = row["sll_ipaddress"];
                view.Rows[i].Cells["login"].Value     = ToolHelper.GetDateValue(row["sll_online_date"], "yyyy-MM-dd HH:mm:dd");
                view.Rows[i].Cells["logout"].Value    = ToolHelper.GetDateValue(row["sll_offline_date"], "yyyy-MM-dd HH:mm:dd");

                searchControl.Properties.Items.Add(row["real_name"]);
            }
        }
Пример #2
0
        public static void AddWorkLog(WorkLogType logType, int amount, object batchCode, int segment, object objectId, object userid)
        {
            if (string.IsNullOrEmpty(ToolHelper.GetValue(batchCode)))
            {
                return;
            }
            string date = ToolHelper.GetDateValue(DateTime.Now, "yyyy-MM-dd");
            int    type = (int)logType;

            string existQuery = $"SELECT wl_id FROM work_log WHERE wl_user_id='{userid}' AND wl_datetime='{date}' AND wl_batch_code='{batchCode}' AND wl_type='{type}' AND wl_segment={segment}";
            object result     = SqlHelper.ExecuteOnlyOneQuery(existQuery);

            if (result != null)
            {
                string updateSQL = $"UPDATE work_log SET wl_amount += {amount} WHERE wl_id='{result}'";
                SqlHelper.ExecuteNonQuery(updateSQL);
            }
            else
            {
                //新增记录
                string insertSQL = "INSERT INTO work_log(wl_id, wl_type, wl_batch_code, wl_amount, wl_datetime, wl_user_id, wl_segment, wl_object_id) VALUES" +
                                   $"('{Guid.NewGuid().ToString()}', '{type}', '{batchCode}', '{amount}', '{date}', '{userid}', {segment}, '{objectId}')";
                SqlHelper.ExecuteNonQuery(insertSQL);
            }
        }
Пример #3
0
        private void simpleButton1_Click(object sender, System.EventArgs e)
        {
            object       sourceFile   = objectName;
            object       destDiskCode = treeView1.SelectedNode.Tag;
            object       destFolder   = treeView1.SelectedNode.Text;
            string       queryString  = $"确定将光盘({trcCode})下的文件[{sourceFile}]移动到光盘({destDiskCode})的文件夹[{destFolder}]下吗?";
            DialogResult dialogResult = DevExpress.XtraEditors.XtraMessageBox.Show(queryString, "确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dialogResult == DialogResult.OK)
            {
                string sourceFilePath = ToolHelper.GetValue(SqlHelper.ExecuteOnlyOneQuery($"SELECT bfi_path+'\\'+bfi_name FROM backup_files_info WHERE bfi_id='{objectId}';"));
                string destFolderId   = treeView1.SelectedNode.Name;
                string destFolderPath = ToolHelper.GetValue(SqlHelper.ExecuteOnlyOneQuery($"SELECT bfi_path+'\\'+bfi_name FROM backup_files_info WHERE bfi_id='{destFolderId}';"));

                if (File.Exists(sourceFilePath))
                {
                    string updateSQL = $"UPDATE backup_files_info SET bfi_path='{destFolderPath}', bfi_pid='{destFolderId}', bfi_date='{DateTime.Now}', bfi_userid='{UserHelper.GetUser().UserKey}' WHERE bfi_id='{objectId}'";
                    SqlHelper.ExecuteNonQuery(updateSQL);

                    FileInfo file = new FileInfo(sourceFilePath);
                    if (!Directory.Exists(destFolderPath))
                    {
                        Directory.CreateDirectory(destFolderPath);
                    }
                    string newDestFilePath = destFolderPath + "\\" + Path.GetFileName(sourceFilePath);
                    file.CopyTo(newDestFilePath, true);
                }
                DevExpress.XtraEditors.XtraMessageBox.Show("操作成功");
                DialogResult = DialogResult.OK;
                Close();
            }
        }
Пример #4
0
        private void Btn_Sure_Click(object sender, EventArgs e)
        {
            if (CheckDatas())
            {
                object primaryKey = Guid.NewGuid().ToString();
                if (lbl_FIleName.Tag == null)
                {
                    string code      = lbl_Code.Text;
                    string unit      = txt_Unit.Text;
                    string user      = txt_User.Text;
                    string phone     = txt_Phone.Text;
                    int    ftype     = cbo_FileType.SelectedIndex;
                    string bdate     = ToolHelper.GetDateValue(txt_Borrow_Date.EditValue, "yyyy-MM-dd HH:mm");
                    string bterm     = txt_Borrow_Term.Text;
                    string sbdate    = ToolHelper.GetDateValue(txt_Should_Return_Date.EditValue, "yyyy-MM-dd");
                    string loguser   = lbl_LogUser.Text;
                    string remark    = txt_Remark.Text;
                    string insertSQL = "INSERT INTO borrow_log(bl_id, bl_code, bl_file_id, bl_borrow_state, bl_return_state, bl_form, bl_user, bl_user_unit, bl_user_phone, bl_date, bl_term, bl_should_return_term, bl_log_user, bl_remark) " +
                                       $"VALUES ('{primaryKey}', '{code}', '{FILE_ID}', '{1}', '{0}', '{ftype}', '{user}', '{unit}', '{phone}', '{bdate}', '{bterm}', '{sbdate}', '{loguser}', '{remark}')";

                    SqlHelper.ExecuteNonQuery(insertSQL);
                }
                else
                {
                    primaryKey = lbl_FIleName.Tag;
                    string rbdate    = ToolHelper.GetDateValue(txt_Real_Return_Date.EditValue, "yyyy-MM-dd HH:mm:dd");
                    string updateSQL = $"UPDATE borrow_log SET bl_real_return_term='{rbdate}', bl_borrow_state=0, bl_return_state=1 WHERE bl_id='{primaryKey}'";
                    SqlHelper.ExecuteNonQuery(updateSQL);
                }
                DevExpress.XtraEditors.XtraMessageBox.Show("操作成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                DialogResult = DialogResult.OK;
                Tag          = primaryKey;
                Close();
            }
        }
Пример #5
0
        /// <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);
                }
            }
        }
Пример #6
0
 private static string GetTrueValue(object value)
 {
     return(ToolHelper.GetValue(value)
            .Replace(",", ",")
            .Replace("\n", string.Empty)
            .Replace("\t", string.Empty)
            .Replace("\r", string.Empty));
 }
Пример #7
0
        /// <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 = "确认归还";
                        }
                    }
                }
            }
        }
Пример #8
0
        /// <summary>
        /// 获取时间对象的DATE格式对象,若转换失败则返回当前时间
        /// </summary>
        internal static DateTime GetDateValue(object value)
        {
            string dateStr = ToolHelper.GetValue(value);

            if (DateTime.TryParse(dateStr, out DateTime date))
            {
                return(date);
            }
            return(new DateTime());
        }
Пример #9
0
        /// <summary>
        /// 查询唯一结果的SQL(无结果返回null)
        /// </summary>
        public static object ExecuteOnlyOneQuery(string querySql)
        {
            SqlCommand sqlCommand = new SqlCommand(querySql, GetConnect());
            object     result     = sqlCommand.ExecuteScalar();

            if (result != null)
            {
                if (string.IsNullOrEmpty(ToolHelper.GetValue(result)))
                {
                    result = null;
                }
            }
            return(result);
        }
Пример #10
0
        /// <summary>
        /// 重置指定批次下所有数据状态为 未提交
        /// </summary>
        /// <param name="type">类型<para>1:计划</para><para>2:专项</para></param>
        /// <param name="batchIds">批次ID</param>
        private void SetStateToUnsubmit(int type, object[] batchIds)
        {
            string        updateSQL  = string.Empty;
            List <object> projectIds = new List <object>();

            if (type == 1)
            {
                object[] planIds     = SqlHelper.ExecuteSingleColumnQuery($"SELECT pi_id FROM project_info WHERE pi_categor=1 AND pi_obj_id IN ({ToolHelper.GetStringBySplit(batchIds, ",", "'")})");
                string   proQuerySql = "SELECT A.pi_id FROM project_info p LEFT JOIN ( " +
                                       "SELECT pi_id, pi_obj_id FROM project_info WHERE pi_categor=2 UNION ALL " +
                                       "SELECT ti_id, ti_obj_id FROM topic_info WHERE ti_categor=-3)A ON A.pi_obj_id=p.pi_id " +
                                       $"WHERE p.pi_id IN ({ToolHelper.GetStringBySplit(planIds, ",", "'")})";
                object[] proIds = SqlHelper.ExecuteSingleColumnQuery(proQuerySql);
                projectIds.AddRange(proIds);
            }
            else if (type == 2)
            {
                string querySQL = "SELECT idi.imp_id FROM imp_dev_info idi INNER JOIN imp_info ii ON idi.imp_obj_id = ii.imp_id INNER JOIN transfer_registration_pc trp ON ii.imp_obj_id = trp.trp_id " +
                                  $"WHERE trp.trp_id IN({ToolHelper.GetStringBySplit(batchIds, ",", "'")})";
                object[] specialIds  = SqlHelper.ExecuteSingleColumnQuery(querySQL);
                string   proQuerySql = "SELECT A.pi_id FROM imp_dev_info idi LEFT JOIN ( " +
                                       "SELECT pi_id, pi_obj_id FROM project_info WHERE pi_categor=2 UNION ALL " +
                                       "SELECT ti_id, ti_obj_id FROM topic_info WHERE ti_categor=-3)A ON A.pi_obj_id=idi.imp_id " +
                                       $"WHERE idi.imp_id IN ({ToolHelper.GetStringBySplit(specialIds, ",", "'")})";
                object[] proIds = SqlHelper.ExecuteSingleColumnQuery(proQuerySql);
                projectIds.AddRange(proIds);
            }
            if (projectIds.Count > 0)
            {
                string pids = ToolHelper.GetStringBySplit(projectIds.ToArray(), ",", "'");
                updateSQL +=
                    $"UPDATE project_info SET pi_submit_status=1, pi_worker_id=null, pi_checker_id=null WHERE pi_id IN ({pids});" +
                    $"UPDATE topic_info SET ti_submit_status=1, ti_worker_id=null, ti_checker_id=null WHERE ti_id IN ({pids});";

                string topQuerySql = "SELECT A.ti_id FROM( " +
                                     "SELECT ti_id, ti_obj_id FROM topic_info WHERE ti_categor = 3 UNION ALL " +
                                     "SELECT si_id, si_obj_id FROM subject_info )A " +
                                     $"WHERE A.ti_obj_id IN({pids})";
                object[] topIds = SqlHelper.ExecuteSingleColumnQuery(topQuerySql);
                if (topIds.Length > 0)
                {
                    string tids = ToolHelper.GetStringBySplit(topIds, ",", "'");
                    updateSQL +=
                        $"UPDATE subject_info SET si_submit_status=1, si_worker_id=null, si_checker_id=null WHERE si_id IN ({tids});" +
                        $"UPDATE topic_info SET ti_submit_status=1, ti_worker_id=null, ti_checker_id=null WHERE ti_id IN ({tids});" +
                        $"UPDATE subject_info SET si_submit_status=1, si_worker_id=null, si_checker_id=null WHERE si_obj_id IN ({tids});";
                }
            }
            SqlHelper.ExecuteNonQuery(updateSQL);
        }
Пример #11
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);
        }
Пример #12
0
        private void SimpleButton1_Click(object sender, System.EventArgs e)
        {
            List <object> list = new List <object>();

            for (int i = 0; i < chkl.CheckedItems.Count; i++)
            {
                ObjectEntity entity = chkl.CheckedItems[i] as ObjectEntity;
                list.Add(entity.ID);
            }
            if (list.Count > 0)
            {
                objectCode   = ToolHelper.GetStringBySplit(list.ToArray(), ",", "'");
                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
Пример #13
0
        private void Frm_DomRec_Load(object sender, EventArgs e)
        {
            //来源单位
            DataRow row = SqlHelper.ExecuteSingleRowQuery("SELECT dd_name, trp_log_data FROM transfer_registration_pc " +
                                                          $"LEFT JOIN data_dictionary ON dd_id = com_id WHERE trp_id = '{trpId}';");

            if (row != null)
            {
                lbl_Body.Text  = $"  {row["dd_name"]}:\n";
                lbl_Body.Text += $"  今中国科学技术信息研究所于{ToolHelper.GetDateValue(row["trp_log_data"], "yyyy年MM月")}收到贵单位提交的    捆纸质档案, 电子档案    件," +
                                 $"并于{ToolHelper.GetDateValue(DateTime.Now, "yyyy年MM月")}完成确认," +
                                 $"共计纸质档案    卷,电子档案    件,并附案卷列表(附件一)。 此据。";
            }
            txt_Head.Focus();
        }
Пример #14
0
 private void Btn_Sure_Click(object sender, EventArgs e)
 {
     SelectedFileId   = new string[lsv_Selected.Items.Count];
     SelectedFileName = new string[lsv_Selected.Items.Count];
     for (int i = 0; i < SelectedFileId.Length; i++)
     {
         SelectedFileId[i]   = lsv_Selected.Items[i].Name;
         SelectedFileName[i] = ToolHelper.GetValue(lsv_Selected.Items[i].Tag);
     }
     if (SelectedFileId.Length > 0)
     {
         DialogResult = DialogResult.OK;
     }
     Close();
 }
Пример #15
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);
                        }
                    }
                }
            }
        }
Пример #16
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();
         }
     }
 }
Пример #17
0
        /// <summary>
        /// 加载来源单位列表
        /// </summary>
        private void LoadCompanySource()
        {
            string querySql = "SELECT dd_id, dd_name FROM data_dictionary WHERE dd_pId=" +
                              "(SELECT dd_id FROM data_dictionary WHERE dd_code = 'dic_key_company_source') ORDER BY dd_sort";
            DataTable table = SqlHelper.ExecuteQuery(querySql);

            for (int i = 0; i < table.Rows.Count; i++)
            {
                AccordionControlElement element = new AccordionControlElement()
                {
                    Style = ElementStyle.Item,
                    Name  = ToolHelper.GetValue(table.Rows[i]["dd_id"]),
                    Text  = ToolHelper.GetValue(table.Rows[i]["dd_name"]),
                };
                acg_Register.Elements.Add(element);
            }
        }
Пример #18
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);
        }
Пример #19
0
        /// <summary>
        /// 获取文件相关链接列表
        /// </summary>
        private object[] GetFileLink()
        {
            List <object> list = new List <object>();

            foreach (DataGridViewRow row in dgv_link.Rows)
            {
                foreach (DataGridViewCell cell in row.Cells)
                {
                    string value = ToolHelper.GetValue(cell.Value);
                    if (!string.IsNullOrEmpty(value))
                    {
                        list.Add(value);
                    }
                }
            }
            return(list.ToArray());
        }
Пример #20
0
        private void BatchRecInfo_Load(object sender, EventArgs e)
        {
            string querySQL = "SELECT C.trp_code, B.real_name, A.wr_source_id, A.wr_date FROM work_registration A " +
                              "LEFT JOIN user_list B ON B.ul_id = A.wr_source_id " +
                              "LEFT JOIN transfer_registration_pc C on A.trp_id = C.trp_id " +
                              $"WHERE A.trp_id = '{TRP_ID}' ORDER BY A.wr_date ";
            DataTable table = SqlHelper.ExecuteQuery(querySQL);

            foreach (DataRow row in table.Rows)
            {
                int i = view.Rows.Add();
                view.Rows[i].Cells[0].Value = row["trp_code"];
                view.Rows[i].Cells[1].Value = ToolHelper.GetDateValue(row["wr_date"], "yyyy-MM-dd HH:mm");
                view.Rows[i].Cells[2].Value = row["real_name"];
                view.Rows[i].Cells[3].Value = GetWorkAmount(TRP_ID, row["wr_source_id"]);
            }
        }
Пример #21
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;
        }
Пример #22
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);
            }
        }
Пример #23
0
 /// <summary>
 /// 获取完整的封面HTML模板页
 /// </summary>
 /// <param name="bj">边距mm数</param>
 private string GetCoverHtmlString(object docName, string fmString, object bj, object GCNumber)
 {
     fmString = fmString.Replace("20mm", $"{bj}");
     if (string.IsNullOrEmpty(ToolHelper.GetValue(parentObjectName)))
     {
         fmString = fmString.Replace("id=\"ajmc\">", $"id=\"ajmc\">{docName}");
     }
     else
     {
         fmString = fmString.Replace("id=\"ajmc\">", $"id=\"ajmc\">{parentObjectName}");
         fmString = fmString.Replace("id=\"ktmc\">", $"id=\"ktmc\">{docName}");
     }
     fmString = fmString.Replace("id=\"bzdw\">", $"id=\"bzdw\">{unitName}");
     fmString = fmString.Replace("id=\"bzrq\">", $"id=\"bzrq\">{ToolHelper.GetDateValue(ljDate, "yyyy-MM-dd")}");
     fmString = fmString.Replace("id=\"bgqx\">", $"id=\"bgqx\">永久");
     fmString = fmString.Replace("id=\"gch\">", $"id=\"gch\">{GCNumber}");
     return(fmString);
 }
Пример #24
0
        private void LoadDiskList(object trpID, object trcCode)
        {
            object   batchCode = SqlHelper.ExecuteOnlyOneQuery($"SELECT trp_name+'['+ trp_code+']' FROM transfer_registration_pc WHERE trp_id='{trpID}';");
            TreeNode batchNode = new TreeNode(ToolHelper.GetValue(batchCode))
            {
                ImageIndex = 0
            };

            treeView1.Nodes.Add(batchNode);
            string querySQL = $"SELECT A.bfi_id, B.trc_code, B.trc_name FROM backup_files_info A LEFT JOIN transfer_registraion_cd B ON A.bfi_trcid = B.trc_id " +
                              $"WHERE B.trp_id ='{trpID}' AND A.bfi_type = -1 ORDER BY b.trc_code";
            DataTable table = SqlHelper.ExecuteQuery(querySQL);

            foreach (DataRow row in table.Rows)
            {
                TreeNode diskNode = new TreeNode()
                {
                    Name       = ToolHelper.GetValue(row["bfi_id"]),
                    Text       = $"{row["trc_name"]}[{row["trc_code"]}]",
                    ImageIndex = 1,
                    Tag        = row["trc_code"]
                };
                batchNode.Nodes.Add(diskNode);

                string    _querySQL = $"SELECT bfi_id, bfi_name FROM backup_files_info WHERE bfi_pid ='{row["bfi_id"]}' AND bfi_type = 1 ORDER BY bfi_path";
                DataTable _table    = SqlHelper.ExecuteQuery(_querySQL);
                foreach (DataRow _row in _table.Rows)
                {
                    TreeNode folderNode = new TreeNode()
                    {
                        Name       = ToolHelper.GetValue(_row["bfi_id"]),
                        Text       = $"{_row["bfi_name"]}",
                        ImageIndex = 1,
                        Tag        = row["trc_code"]
                    };
                    diskNode.Nodes.Add(folderNode);
                }
            }

            if (treeView1.Nodes.Count > 0)
            {
                treeView1.ExpandAll();
            }
        }
Пример #25
0
        private void Frm_QueryDetail_Load(object sender, System.EventArgs e)
        {
            txt_Project_Code.Text      = ToolHelper.GetValue(row["pi_code"]);
            txt_Project_Name.Text      = ToolHelper.GetValue(row["pi_name"]);
            txt_Project_Field.Text     = ToolHelper.GetValue(row["pi_field"]);
            txt_Project_Theme.Text     = ToolHelper.GetValue(row["pb_theme"]);
            txt_Project_StartTime.Text = ToolHelper.GetValue(row["pi_start_datetime"]);
            txt_Project_EndTime.Text   = ToolHelper.GetValue(row["pi_end_datetime"]);
            txt_Project_Unit.Text      = ToolHelper.GetValue(row["pi_unit"]);
            txt_Project_Province.Text  = ToolHelper.GetValue(row["pi_province"]);
            txt_Project_ProUser.Text   = ToolHelper.GetValue(row["pi_prouser"]);
            txt_Project_Funds.Text     = ToolHelper.GetValue(row["pi_funds"]);
            txt_Project_Year.Text      = ToolHelper.GetValue(row["pi_year"]);
            txt_Project_UnitUser.Text  = ToolHelper.GetValue(row["pi_uniter"]);
            txt_Project_Intro.Text     = ToolHelper.GetValue(row["pi_intro"]);

            txt_Project_Intro.SelectionStart = 0;
            Btn_Close.Focus();
        }
Пример #26
0
        //查询
        private void UG_btnSearch(object sender, EventArgs e)
        {
            string key = userGroup_SearchKey.Text;

            if (!string.IsNullOrEmpty(key))
            {
                view.ClearSelection();
                foreach (DataGridViewRow row in view.Rows)
                {
                    foreach (DataGridViewCell cell in row.Cells)
                    {
                        if (ToolHelper.GetValue(cell.Value).Contains(key))
                        {
                            cell.Selected = true;
                            return;
                        }
                    }
                }
            }
        }
Пример #27
0
        /// <summary>
        /// 判断指定文件夹节点下的所有文件是否全部已加工,如果是,则移除此文件夹
        /// </summary>
        private bool ClearHasWordedWithFolder(TreeNode node)
        {
            bool result = true;
            bool flag   = true;

            for (int i = 0; i < node.Nodes.Count; i++)
            {
                TreeNode item = node.Nodes[i];
                int      type = Convert.ToInt32(item.ToolTipText);//0:文件 1:文件夹
                if (type == 0)
                {
                    flag = false;
                }
                else if (type == 1)
                {
                    result = ClearHasWordedWithFolder(item);
                }
            }
            if (result)
            {
                foreach (TreeNode item in node.Nodes)
                {
                    int type  = Convert.ToInt32(item.ToolTipText); //0:文件 1:文件夹
                    int state = item.ImageIndex;                   //3:已加工
                    if (type == 0 && state != 3)
                    {
                        result = false;
                        break;
                    }
                }
            }
            if (result && flag)
            {
                if (!string.IsNullOrEmpty(ToolHelper.GetValue(node.Tag)))//批次名称永不消逝
                {
                    node.Remove();
                }
            }
            return(result);
        }
Пример #28
0
        /// <summary>
        /// 加载根节点树(调用树节点方法)
        /// </summary>
        /// <param name="isShowAll">是否显示已加工节点</param>
        private void LoadRootTree(bool isShowAll)
        {
            object batchCode = SqlHelper.ExecuteOnlyOneQuery($"SELECT bfi_name FROM backup_files_info WHERE bfi_id='{rootId[0]}'");

            tv_file.Nodes.Clear();
            //一级节点【批次编号】
            TreeNode batchNode = new TreeNode()
            {
                Text        = ToolHelper.GetValue(batchCode),
                ToolTipText = "-1",
            };

            tv_file.Nodes.Add(batchNode);
            for (int i = 0; i < rootId.Length; i++)
            {
                object[] objs = SqlHelper.ExecuteRowsQuery("SELECT bfi_id, bfi_name, bfi_path, bfi_type, trc_code FROM backup_files_info a " +
                                                           $"LEFT JOIN transfer_registraion_cd b on a.bfi_trcid = b.trc_id WHERE bfi_id='{rootId[i]}'");
                //二级节点【光盘编号】
                string   rootFileName = ToolHelper.GetValue(objs[4]);
                TreeNode diskNode     = new TreeNode()
                {
                    Text        = rootFileName,
                    ToolTipText = ToolHelper.GetValue(objs[3]),
                };
                batchNode.Nodes.Add(diskNode);
                InitialTree(rootId[i], diskNode, isShowAll);
            }
            if (tv_file.Nodes.Count > 0)
            {
                tv_file.Nodes[0].Expand();
                if (!chk_ShowAll.Checked)
                {
                    ClearHasWordedWithFolder(tv_file.Nodes[0]);
                }
                if (IsMoveMode)
                {
                    tv_file.ExpandAll();
                }
            }
        }
Пример #29
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);
            }
        }
Пример #30
0
        /// <summary>
        /// 根据指定批次ID获取其补录的其他批次根节点ID
        /// </summary>
        /// <param name="batchId">待查找批次ID</param>
        /// <param name="type">查找类型<para>0:计划</para><para>1:专项</para></param>
        public static object[] GetOtherBatchRootIds(object batchId, int type)
        {
            object otherBatchIds      = ExecuteOnlyOneQuery($"SELECT br_auxiliary_id FROM batch_relevance WHERE br_main_id='{batchId}'");
            string otherBatchIdString = ToolHelper.GetFullStringBySplit(ToolHelper.GetValue(otherBatchIds), ',', ",", "'");

            if (otherBatchIdString.Length > 0)
            {
                if (type == 0)
                {
                    string querySql = $"SELECT pi_id FROM project_info WHERE pi_categor = 1 AND pi_obj_id IN ({otherBatchIdString})";
                    return(ExecuteSingleColumnQuery(querySql));
                }
                else
                {
                    string querySql = "SELECT idi.imp_id FROM imp_info ii " +
                                      "INNER JOIN imp_dev_info idi ON idi.imp_obj_id = ii.imp_id " +
                                      $"WHERE ii.imp_obj_id IN ({otherBatchIdString})";
                    return(ExecuteSingleColumnQuery(querySql));
                }
            }
            return(null);
        }