Exemplo n.º 1
0
        private void Frm_Export_Load(object sender, EventArgs e)
        {
            LoadFileInfo(UserHelper.GetUser().UserSpecialId);
            List <object[]> projectIds = SQLiteHelper.ExecuteColumnsQuery($"SELECT pi_id FROM project_info WHERE pi_obj_id='{UserHelper.GetUser().UserSpecialId}'", 1);

            for (int i = 0; i < projectIds.Count; i++)
            {
                LoadFileInfo(projectIds[i][0]);
                List <object[]> pro_top_ids = SQLiteHelper.ExecuteColumnsQuery($"SELECT ti_id FROM topic_info WHERE ti_obj_id='{projectIds[i][0]}'", 1);
                for (int j = 0; j < pro_top_ids.Count; j++)
                {
                    LoadFileInfo(pro_top_ids[j][0]);
                    List <object[]> pro_top_sub_ids = SQLiteHelper.ExecuteColumnsQuery($"SELECT si_id FROM subject_info WHERE si_obj_id='{pro_top_ids[j][0]}'", 1);
                    for (int k = 0; k < pro_top_sub_ids.Count; k++)
                    {
                        LoadFileInfo(pro_top_sub_ids[k][0]);
                    }
                }
            }
            List <object[]> topicIds = SQLiteHelper.ExecuteColumnsQuery($"SELECT ti_id FROM topic_info WHERE ti_obj_id='{UserHelper.GetUser().UserSpecialId}'", 1);

            for (int i = 0; i < topicIds.Count; i++)
            {
                LoadFileInfo(topicIds[i][0]);
                List <object[]> pro_top_sub_ids = SQLiteHelper.ExecuteColumnsQuery($"SELECT si_id FROM subject_info WHERE si_obj_id='{topicIds[i][0]}'", 1);
                for (int k = 0; k < pro_top_sub_ids.Count; k++)
                {
                    LoadFileInfo(pro_top_sub_ids[k][0]);
                }
            }

            pro_Show.Maximum = list.Count;
        }
Exemplo n.º 2
0
        private void btn_Export_Click(object sender, EventArgs e)
        {
            object KEY   = "SAVE_PATH";
            object value = SQLiteHelper.ExecuteOnlyOneQuery($"SELECT dd_name FROM data_dictionary WHERE dd_code='{KEY}'");

            if (value != null)
            {
                /* ----复制文件----*/
                pro_Show.Maximum = GetTotalFileAmountBySpiId(UserHelper.GetUser().UserSpecialId);
                int    count = pro_Show.Maximum, okcount = 0, nocount = 0;
                string rootFolder = value + "\\" + SQLiteHelper.ExecuteOnlyOneQuery($"SELECT spi_name FROM special_info WHERE spi_id='{UserHelper.GetUser().UserSpecialId}'");
                if (!Directory.Exists(rootFolder))
                {
                    Directory.CreateDirectory(rootFolder);
                }
                //专项下的文件
                CopyFile(ref okcount, ref nocount, rootFolder, GetFileLinkByObjId(UserHelper.GetUser().UserSpecialId));
                //专项下的项目
                List <object[]> list2 = SQLiteHelper.ExecuteColumnsQuery($"SELECT pi_id, pi_name FROM project_info WHERE pi_obj_id='{UserHelper.GetUser().UserSpecialId}'", 2);
                for (int i = 0; i < list2.Count; i++)
                {
                    string _rootFolder = rootFolder + "\\" + list2[i][1];
                    if (!Directory.Exists(_rootFolder))
                    {
                        Directory.CreateDirectory(_rootFolder);
                    }
                    //项目下的文件
                    CopyFile(ref okcount, ref nocount, _rootFolder, GetFileLinkByObjId(list2[i][0]));

                    //项目下的课题
                    List <object[]> list5 = SQLiteHelper.ExecuteColumnsQuery($"SELECT ti_id, ti_name FROM topic_info WHERE ti_obj_id='{list2[i][0]}'", 2);
                    for (int j = 0; j < list5.Count; j++)
                    {
                        string _rootFolder2 = _rootFolder + "\\" + list5[j][1];
                        if (!Directory.Exists(_rootFolder2))
                        {
                            Directory.CreateDirectory(_rootFolder2);
                        }
                        //课题下的文件
                        CopyFile(ref okcount, ref nocount, _rootFolder2, GetFileLinkByObjId(list5[j][0]));

                        //课题下的子课题
                        List <object[]> list6 = SQLiteHelper.ExecuteColumnsQuery($"SELECT si_id, si_name FROM subject_info WHERE si_obj_id='{list5[j][0]}'", 2);
                        for (int k = 0; k < list6.Count; k++)
                        {
                            string _rootFolder3 = _rootFolder2 + "\\" + list6[k][1];
                            if (!Directory.Exists(_rootFolder3))
                            {
                                Directory.CreateDirectory(_rootFolder3);
                            }
                            CopyFile(ref okcount, ref nocount, _rootFolder3, GetFileLinkByObjId(list6[k][0]));
                        }
                    }
                    //项目下的子课题
                    List <object[]> list7 = SQLiteHelper.ExecuteColumnsQuery($"SELECT si_id, si_name FROM subject_info WHERE si_obj_id='{list2[i][0]}'", 2);
                    for (int j = 0; j < list7.Count; j++)
                    {
                        string _rootFolder2 = _rootFolder + "\\" + list7[j][1];
                        if (!Directory.Exists(_rootFolder2))
                        {
                            Directory.CreateDirectory(_rootFolder2);
                        }
                        CopyFile(ref okcount, ref nocount, _rootFolder2, GetFileLinkByObjId(list7[j][0]));
                    }
                }
                //专项下的课题
                List <object[]> list4 = SQLiteHelper.ExecuteColumnsQuery($"SELECT ti_id, ti_name FROM topic_info WHERE ti_obj_id='{UserHelper.GetUser().UserSpecialId}'", 2);
                for (int i = 0; i < list4.Count; i++)
                {
                    string _rootFolder = rootFolder + "\\" + list4[i][1];
                    if (!Directory.Exists(_rootFolder))
                    {
                        Directory.CreateDirectory(_rootFolder);
                    }
                    //课题下的文件
                    CopyFile(ref okcount, ref nocount, _rootFolder, GetFileLinkByObjId(list4[i][0]));

                    //课题下的子课题
                    List <object[]> list6 = SQLiteHelper.ExecuteColumnsQuery($"SELECT si_id, si_name FROM subject_info WHERE si_obj_id='{list4[i][0]}'", 2);
                    for (int k = 0; k < list6.Count; k++)
                    {
                        string _rootFolder3 = _rootFolder + "\\" + list6[k][1];
                        if (!Directory.Exists(_rootFolder3))
                        {
                            Directory.CreateDirectory(_rootFolder3);
                        }
                        CopyFile(ref okcount, ref nocount, _rootFolder3, GetFileLinkByObjId(list6[k][0]));
                    }
                }
                MessageBox.Show($"备份完成,共计{count}个文件,成功{okcount}个,失败{nocount}个。", "操作成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                /* ----合成文件清单----*/
                string filePath = value + "\\重大专项项目(课题)档案交接清单";
                MicrosoftWordHelper.WriteDocument(filePath, list);
                if (MessageBox.Show("文件清单合成完毕, 是否需要现在打开?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
                {
                    LoadDocumnet(filePath);
                }
                Close();
            }
            else
            {
                MessageBox.Show("尚未指定文件存放路径。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Exemplo n.º 3
0
        private void Frm_MainFrame_Shown(object sender, EventArgs e)
        {
            string querySql = $"SELECT spi_id, spi_name FROM special_info WHERE spi_id=(SELECT ui_special_id FROM user_info WHERE ui_id='{UserHelper.GetUser().UserId}')";

            object[] obj = SQLiteHelper.ExecuteRowsQuery(querySql);
            if (obj == null)
            {
                Frm_IdentityChoose frm_Identity = new Frm_IdentityChoose();
                if (frm_Identity.ShowDialog() == DialogResult.OK)
                {
                    obj = SQLiteHelper.ExecuteRowsQuery(querySql);
                }
            }
            if (obj != null)
            {
                rootId = GetValue(obj[0]);
                UserHelper.GetUser().UserSpecialId = rootId;
                UserHelper.GetUser().SpecialName   = GetValue(obj[1]);
                LoadTreeList(rootId);
                NodeMouseClick(sender, new TreeNodeMouseClickEventArgs(tv_DataTree.Nodes[0], MouseButtons.Left, 1, 0, 0));

                new Frm_Explain().ShowDialog();
            }
        }