예제 #1
0
        private void Frm_MainFrame_Shown(object sender, EventArgs e)
        {
            string querySql = $"SELECT ui_special_id FROM user_info WHERE ui_id='{UserHelper.GetUser().UserId}'";
            object obj      = SQLiteHelper.ExecuteOnlyOneQuery(querySql);

            if (obj == null)
            {
                Frm_IdentityChoose frm_Identity = new Frm_IdentityChoose();
                if (frm_Identity.ShowDialog() == DialogResult.OK)
                {
                    obj = SQLiteHelper.ExecuteOnlyOneQuery(querySql);
                    new Frm_Explain().ShowDialog();
                }
            }
            if (obj != null)
            {
                UserHelper.GetUser().SpecialId   = GetValue(obj);
                UserHelper.GetUser().SpecialName = SQLiteHelper.GetValueByKey(obj);

                object unitName = SQLiteHelper.ExecuteOnlyOneQuery($"SELECT ui_department FROM user_info WHERE ui_id='{UserHelper.GetUser().UserId}'");
                UserHelper.GetUser().UserUnitName = GetValue(unitName);

                LoadTreeList(UserHelper.GetUser().SpecialId);

                NodeMouseClick(sender, new TreeNodeMouseClickEventArgs(tv_DataTree.Nodes[0], MouseButtons.Left, 1, 0, 0));
                LoadStateTip();

                lbl_UserName.Text = UserHelper.GetUser().RealName;
                lbl_UserUnit.Text = UserHelper.GetUser().UserUnitName;
            }
        }
예제 #2
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            string username = txt_Username.Text;
            string password = txt_Password.Text;

            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                object uid = SQLiteHelper.ExecuteOnlyOneQuery($"SELECT ui_id FROM user_info WHERE ui_username='******' AND ui_password='******'");
                if (!string.IsNullOrEmpty(GetValue(uid)))
                {
                    DataRow row = SQLiteHelper.ExecuteSingleRowQuery($"SELECT * FROM user_info WHERE ui_id='{uid}'");
                    UserHelper.GetUser().UserId   = uid;
                    UserHelper.GetUser().UserName = username;
                    UserHelper.GetUser().PassWord = password;
                    UserHelper.GetUser().RealName = GetValue(row["ui_realname"]);
                    Frm_MainFrame frm             = new Frm_MainFrame();
                    frm.Show();
                    Hide();
                }
                else
                {
                    MessageBox.Show("用户名或密码错误。", "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }
예제 #3
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            string yPW = txt_PassWord.Text;

            if (UserHelper.GetUser().PassWord.Equals(yPW))
            {
                string nPW  = txt_NewPassWord.Text;
                string nPWA = txt_NewPassWordAgain.Text;
                if (nPW.Equals(nPWA) && MessageBox.Show("确定要修改密码吗?", "确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
                {
                    SQLiteHelper.ExecuteNonQuery($"UPDATE user_info SET ui_password='******' WHERE ui_id='{UserHelper.GetUser().UserId}'");
                    UserHelper.GetUser().PassWord = nPW;
                    MessageBox.Show("修改成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    Close();
                }
                else
                {
                    MessageBox.Show("两次输入密码不一致。", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("原密码不正确。", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void Pic_Add_Click(object sender, EventArgs e)
        {
            TreeNode node = new TreeNode()
            {
                Name = UserHelper.GetUser().SpecialId, Tag = ControlType.Plan_Project
            };
            Frm_Wroking frm_Wroking = new Frm_Wroking(node, LoadTreeList);

            frm_Wroking.Show();
        }
예제 #5
0
 /// <summary>
 /// 重置控件
 /// </summary>
 private void ResetControl()
 {
     foreach (Control item in Controls)
     {
         if (!(item is Label))
         {
             if (item is TextBox || item is DateTimePicker)
             {
                 item.ResetText();
             }
             else if (item is NumericUpDown)
             {
                 (item as NumericUpDown).Value = 0;
             }
             else if (item is DateTimePicker)
             {
                 (item as DateTimePicker).Value = DateTime.Now;
             }
             else if (item is ComboBox)
             {
                 if (item.Name.Equals("txt_fileName"))
                 {
                     ComboBox cbo = item as ComboBox;
                     cbo.Items.Clear();
                     cbo.Text = null;
                 }
                 else if (!item.Name.Equals("cbo_stage"))
                 {
                     (item as ComboBox).SelectedIndex = 0;
                 }
             }
             else if (item is Panel)
             {
                 foreach (Control con in item.Controls)
                 {
                     if (con is RadioButton)
                     {
                         (con as RadioButton).Checked = false;
                     }
                     else if (con is CheckBox)
                     {
                         (con as CheckBox).Checked = false;
                     }
                 }
             }
             else if (item is ListView)
             {
                 (item as ListView).Items.Clear();
             }
         }
     }
     txt_unit.Text = UserHelper.GetUser().UserUnitName;
 }
예제 #6
0
        private void pic_Manager_Click(object sender, EventArgs e)
        {
            string specialId = UserHelper.GetUser().SpecialId;

            if (!string.IsNullOrEmpty(specialId))
            {
                Frm_Manager manager = new Frm_Manager(specialId);
                manager.ShowDialog();
            }
            else
            {
                MessageBox.Show("当前用户尚未指定专项。");
            }
        }
예제 #7
0
        private void 课题TToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = tv_DataTree.SelectedNode;

            if (!node.Tag.Equals(ControlType.Plan))
            {
                Frm_Wroking frm = new Frm_Wroking(node, LoadTreeList);
                frm.cbo_Project_HasNext.SelectedIndex = 2;
                frm.Cbo_Project_HasNext_SelectionChangeCommitted(sender, e);
                frm.tab_Menu.SelectedIndex = frm.tab_Menu.TabCount - 1;
                frm.Show();
            }
            else
            {
                TreeNode _node = new TreeNode()
                {
                    Name = UserHelper.GetUser().SpecialId, Tag = ControlType.Topic
                };
                Frm_Wroking frm_Wroking = new Frm_Wroking(_node, LoadTreeList);
                frm_Wroking.Show();
            }
        }
예제 #8
0
        private void CopyXmlData(string sPath)
        {
            tip.Text = "正在导入XML文件数据,请稍后...";
            DirectoryInfo directory = new DirectoryInfo(sPath);

            FileInfo[] xmlFiles = directory.GetFiles("*.xml");
            foreach (FileInfo file in xmlFiles)
            {
                pro_Show.Style = ProgressBarStyle.Marquee;

                string  xmlName = Path.GetFileNameWithoutExtension(file.Name);
                DataSet dataSet = new DataSet(xmlName);
                if ("Documents".Equals(xmlName))
                {
                    dataSet.ReadXml(new FileStream(file.FullName, FileMode.Open), XmlReadMode.Auto);
                    StringBuilder stringBuilder = new StringBuilder();
                    DataTable     projectTable  = dataSet.Tables["Project"];
                    if (projectTable != null)
                    {
                        foreach (DataRow dataRow in projectTable.Rows)
                        {
                            object objID   = dataRow["objId"];
                            int    categor = Convert.ToInt32(dataRow["categor"]);
                            if (categor == 2)
                            {
                                objID = UserHelper.GetUser().SpecialId;
                            }
                            stringBuilder.Append($"DELETE FROM project_info WHERE pi_id='{dataRow["id"]}';");
                            stringBuilder.Append("INSERT INTO project_info(" +
                                                 "pi_id, pi_code, pi_name, pi_field, pi_theme, pi_funds, pi_startdate, pi_finishdate, pi_year, pi_unit, pi_province, pi_unit_user, " +
                                                 "pi_project_user, pi_introduction, pi_obj_id, pi_worker_date) VALUES (" +
                                                 $"'{dataRow["id"]}', '{dataRow["code"]}', '{dataRow["name"]}', '{dataRow["field"]}', '{dataRow["theme"]}', '{dataRow["funds"]}', '{dataRow["startDate"]}', '{dataRow["endDate"]}', '{dataRow["year"]}', '{dataRow["unit"]}', '{dataRow["province"]}', " +
                                                 $"'{dataRow["uinter"]}', '{dataRow["prouser"]}', '{dataRow["intro"]}', '{objID}', '{DateTime.Now.ToString("s")}');");
                        }
                    }
                    DataTable topicTable = dataSet.Tables["Topic"];
                    if (topicTable != null)
                    {
                        foreach (DataRow dataRow in topicTable.Rows)
                        {
                            object objID   = dataRow["objId"];
                            int    categor = Convert.ToInt32(dataRow["categor"]);
                            if (categor == -3)
                            {
                                objID = UserHelper.GetUser().SpecialId;
                            }
                            stringBuilder.Append($"DELETE FROM topic_info WHERE ti_id='{dataRow["id"]}';");
                            stringBuilder.Append("INSERT INTO topic_info(" +
                                                 "ti_id, ti_code, ti_name, ti_field, ti_theme, ti_funds, ti_startdate, ti_finishdate, ti_year, ti_unit, ti_province, ti_unit_user, " +
                                                 "ti_project_user, ti_introduction, ti_obj_id, ti_worker_date) VALUES (" +
                                                 $"'{dataRow["id"]}', '{dataRow["code"]}', '{dataRow["name"]}', '{dataRow["field"]}', '{dataRow["theme"]}', '{dataRow["funds"]}', '{dataRow["startDate"]}', '{dataRow["endDate"]}', '{dataRow["year"]}', '{dataRow["unit"]}', '{dataRow["province"]}', " +
                                                 $"'{dataRow["uinter"]}', '{dataRow["prouser"]}', '{dataRow["intro"]}', '{objID}', '{DateTime.Now.ToString("s")}');");
                        }
                    }
                    DataTable subjectTable = dataSet.Tables["Subject"];
                    if (subjectTable != null)
                    {
                        foreach (DataRow dataRow in subjectTable.Rows)
                        {
                            stringBuilder.Append($"DELETE FROM subject_info WHERE si_id='{dataRow["id"]}';");
                            stringBuilder.Append("INSERT INTO subject_info(" +
                                                 "si_id, si_code, si_name, si_field, si_theme, si_funds, si_startdate, si_finishdate, si_year, si_unit, si_province, si_unit_user, " +
                                                 "si_project_user, si_introduction, si_obj_id, si_worker_date) VALUES (" +
                                                 $"'{dataRow["id"]}', '{dataRow["code"]}', '{dataRow["name"]}', '{dataRow["field"]}', '{dataRow["theme"]}', '{dataRow["funds"]}', '{dataRow["startDate"]}', '{dataRow["endDate"]}', '{dataRow["year"]}', '{dataRow["unit"]}', '{dataRow["province"]}', " +
                                                 $"'{dataRow["uinter"]}', '{dataRow["prouser"]}', '{dataRow["intro"]}', '{dataRow["objId"]}', '{DateTime.Now.ToString("s")}');");
                        }
                    }
                    SQLiteHelper.ExecuteNonQuery(stringBuilder.ToString());
                }
                else if ("Files".Equals(xmlName))
                {
                    dataSet.ReadXml(new FileStream(file.FullName, FileMode.Open), XmlReadMode.Auto);
                    StringBuilder stringBuilder = new StringBuilder();
                    DataTable     fileTable     = dataSet.Tables["File"];
                    if (fileTable != null)
                    {
                        foreach (DataRow dataRow in fileTable.Rows)
                        {
                            stringBuilder.Append($"DELETE FROM files_info WHERE fi_id='{dataRow["pfl_id"]}';");
                            stringBuilder.Append("INSERT INTO files_info (" +
                                                 "fi_id, fi_code, fi_stage, fi_categor, fi_name, fi_user, fi_type, fi_pages, fi_count, fi_create_date, fi_unit, " +
                                                 "fi_carrier, fi_link, fi_obj_id, fi_sort, fi_remark, fi_box_id, fi_box_sort) " +
                                                 "VALUES(" +
                                                 $"'{dataRow["pfl_id"]}', '{dataRow["pfl_code"]}', '{dataRow["pfl_stage"]}', '{dataRow["pfl_categor"]}', '{dataRow["pfl_name"]}', '{dataRow["pfl_user"]}', '{dataRow["pfl_type"]}', '{dataRow["pfl_pages"]}', '{dataRow["pfl_amount"]}', '{dataRow["pfl_date"]}', " +
                                                 $"'{dataRow["pfl_unit"]}', '{dataRow["pfl_carrier"]}', '{dataRow["pfl_link"]}', '{dataRow["pfl_obj_id"]}', '{dataRow["pfl_sort"]}', '{dataRow["pfl_remark"]}', '{dataRow["pfl_box_id"]}', '{dataRow["pfl_box_sort"]}');");
                        }
                        SQLiteHelper.ExecuteNonQuery(stringBuilder.ToString());
                    }
                }
                else if ("Boxs".Equals(xmlName))
                {
                    dataSet.ReadXml(new FileStream(file.FullName, FileMode.Open), XmlReadMode.Auto);
                    StringBuilder stringBuilder = new StringBuilder();
                    DataTable     boxTable      = dataSet.Tables["Box"];
                    if (boxTable != null)
                    {
                        foreach (DataRow dataRow in boxTable.Rows)
                        {
                            stringBuilder.Append($"DELETE FROM files_box_info WHERE pb_id='{dataRow["pb_id"]}';");
                            stringBuilder.Append("INSERT INTO files_box_info (" +
                                                 "pb_id, pb_box_number, pb_gc_id, pb_obj_id, pb_special_id, pt_id) VALUES(" +
                                                 $"'{dataRow["pb_id"]}', '{dataRow["pb_box_number"]}', '{dataRow["pb_gc_id"]}', '{dataRow["pb_obj_id"]}', '{UserHelper.GetUser().SpecialId}', '{dataRow["pt_id"]}');");
                        }
                    }
                    DataTable tagTable = dataSet.Tables["Tag"];
                    if (tagTable != null)
                    {
                        foreach (DataRow dataRow in tagTable.Rows)
                        {
                            stringBuilder.Append($"DELETE FROM files_tag_info WHERE pt_id='{dataRow["pt_id"]}';");
                            stringBuilder.Append("INSERT INTO files_tag_info (pt_id, pt_code, pt_name, pt_obj_id) VALUES(" +
                                                 $"'{dataRow["pt_id"]}', '{dataRow["pt_code"]}', '{dataRow["pt_name"]}', '{dataRow["pt_obj_id"]}');");
                        }
                    }
                    SQLiteHelper.ExecuteNonQuery(stringBuilder.ToString());
                }
            }
            tip.Text = string.Empty;
        }
예제 #9
0
        /// <summary>
        /// 拷贝文件到备份服务器
        /// </summary>
        /// <param name="sPath">源文件夹路径</param>
        /// <param name="rootFolder">目标文件夹基路径</param>
        private void CopyFile(string sPath, string rootFolder, string pid)
        {
            DirectoryInfo info = new DirectoryInfo(sPath);

            FileInfo[] file = info.GetFiles();
            //排除数据库文件和清单文件
            for (int i = 0; i < file.Length; i++)
            {
                string fileName = file[i].Name;
                if (!(fileName.Contains("ISTIC") && file[i].Extension.Contains("db")))
                {
                    string primaryKey = Guid.NewGuid().ToString();
                    try
                    {
                        SetTip($"正在备份文件[{fileName}]");
                        object value = SQLiteHelper.ExecuteOnlyOneQuery($"SELECT bfi_id FROM backup_files_info WHERE bfi_name='{fileName}' AND bfi_path='{rootFolder}'");
                        if (string.IsNullOrEmpty(GetValue(value)))
                        {
                            SQLiteHelper.ExecuteNonQuery($"INSERT INTO backup_files_info(bfi_id, bfi_code, bfi_name, bfi_path, bfi_date, bfi_pid, bfi_userid, bfi_type) VALUES " +
                                                         $"('{primaryKey}', '{indexCount++.ToString().PadLeft(6, '0')}', '{fileName}', '{rootFolder}', '{DateTime.Now.ToString("s")}', '{pid}', '{UserHelper.GetUser().UserId}', '{0}')");
                        }
                        else
                        {
                            SQLiteHelper.ExecuteNonQuery($"UPDATE backup_files_info SET bfi_code='{indexCount++.ToString().PadLeft(6, '0')}', bfi_date='{DateTime.Now.ToString("s")}', bfi_pid='{pid}', bfi_userid='{UserHelper.GetUser().UserId}' WHERE bfi_id='{value}';");
                        }
                        ServerHelper.UploadFile(file[i].FullName, rootFolder, fileName);
                    }
                    catch (Exception) { }
                    pro_Show.Value += 1;
                }
            }
            DirectoryInfo[] infos = info.GetDirectories();
            for (int i = 0; i < infos.Length; i++)
            {
                if (!IsSystemHidden(infos[i]))
                {
                    string primaryKey = Guid.NewGuid().ToString();
                    object value      = SQLiteHelper.ExecuteOnlyOneQuery($"SELECT bfi_id FROM backup_files_info WHERE bfi_name='{infos[i].Name}' AND bfi_path='{rootFolder}'");
                    if (string.IsNullOrEmpty(GetValue(value)))
                    {
                        SQLiteHelper.ExecuteNonQuery($"INSERT INTO backup_files_info(bfi_id, bfi_code, bfi_name, bfi_path, bfi_date, bfi_pid, bfi_userid, bfi_type) VALUES " +
                                                     $"('{primaryKey}', '{indexCount++.ToString().PadLeft(6, '0')}', '{infos[i].Name}', '{rootFolder}', '{DateTime.Now.ToString("s")}', '{pid}', '{UserHelper.GetUser().UserId}', '{1}')");
                    }
                    else
                    {
                        SQLiteHelper.ExecuteNonQuery($"UPDATE backup_files_info SET bfi_code='{indexCount++.ToString().PadLeft(6, '0')}', bfi_date='{DateTime.Now.ToString("s")}', bfi_pid='{pid}', bfi_userid='{UserHelper.GetUser().UserId}' WHERE bfi_id='{value}';");
                        primaryKey = GetValue(value);
                    }
                    CopyFile(infos[i].FullName, rootFolder + "\\" + infos[i].Name, primaryKey);
                }
            }
        }
예제 #10
0
        /// <summary>
        /// 开始读取
        /// </summary>
        private void btn_Import_Click_1(object sender, EventArgs e)
        {
            string bName = txt_BatchName.Text;
            string sPath = txt_FilePath.Text;
            string tPath = txt_TarPath.Text;

            if (!string.IsNullOrEmpty(bName) && !string.IsNullOrEmpty(sPath) && !string.IsNullOrEmpty(tPath))
            {
                object localKey = SQLiteHelper.ExecuteOnlyOneQuery($"SELECT bfi_id FROM backup_files_info WHERE bfi_name='{bName}'");
                if (localKey != null)
                {
                    if (MessageBox.Show("继续导入将覆盖原数据中的同名文件,是否继续?", "批次名称已存在", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SaveTargetPath(); //如果是首次添加目标路径,则保存
                btn_Import.Enabled = false;
                int totalFileAmount = GetFilesCount(new DirectoryInfo(sPath));
                pro_Show.Value   = pro_Show.Minimum;
                pro_Show.Maximum = totalFileAmount;

                string rootFolder = tPath;
                if (!Directory.Exists(rootFolder))
                {
                    Directory.CreateDirectory(rootFolder);
                }
                if (localKey != null)
                {
                    SQLiteHelper.ExecuteNonQuery($"UPDATE backup_files_info SET bfi_date='{DateTime.Now.ToString("s")}', bfi_userid='{UserHelper.GetUser().UserId}' WHERE bfi_id='{localKey}'");
                }
                else
                {
                    localKey = Guid.NewGuid().ToString();
                    SQLiteHelper.ExecuteNonQuery($"INSERT INTO backup_files_info(bfi_id, bfi_code, bfi_name, bfi_date, bfi_userid, bfi_type) VALUES " +
                                                 $"('{localKey}', '{-1}', '{bName}', '{DateTime.Now.ToString("s")}', '{UserHelper.GetUser().UserId}', '{-1}')");
                }
                new Thread(delegate()
                {
                    CopyFile(sPath, rootFolder + "\\" + bName, GetValue(localKey));
                    CopyDataTable(sPath, rootFolder + "\\" + bName);
                    CopyXmlData(sPath);

                    MessageBox.Show($"数据导入完毕。", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    btn_Import.Enabled = true;
                    DialogResult       = DialogResult.OK;
                    Close();
                    Thread.CurrentThread.Abort();
                }).Start();
            }
            else
            {
                SetTip("请先填写必要信息。");
            }
        }
예제 #11
0
 private void SaveTargetPath()
 {
     if (!txt_TarPath.ReadOnly)
     {
         string primaryKey = Guid.NewGuid().ToString();
         string targetPath = txt_TarPath.Text;
         string insertSql  = $"INSERT INTO private_info(pri_id, pri_key, pri_value, pri_userid) VALUES('{primaryKey}','TARGET_PATH','{targetPath}','{UserHelper.GetUser().UserId}')";
         SQLiteHelper.ExecuteNonQuery(insertSql);
     }
 }
예제 #12
0
        /// <summary>
        /// 课题列表
        /// </summary>
        /// <param name="pid">项目ID</param>
        private bool LoadTopicList(object pid, object parentObjName)
        {
            dgv_ShowData.Rows.Clear();
            dgv_ShowData.Columns.Clear();

            dgv_ShowData.Columns.AddRange(new DataGridViewColumn[]
            {
                new DataGridViewTextBoxColumn()
                {
                    Name = "top_id", HeaderText = "序号", FillWeight = 3
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "top_code", HeaderText = "编号", FillWeight = 8
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "top_name", HeaderText = "名称", FillWeight = 10
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "top_unit", HeaderText = "承担单位", FillWeight = 8
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "top_user", HeaderText = "负责人", FillWeight = 5
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "top_phone", HeaderText = "手机", FillWeight = 4
                },
                new DataGridViewLinkColumn()
                {
                    Name = "top_totalFileAmount", HeaderText = "总文件数", FillWeight = 3
                },
                new DataGridViewLinkColumn()
                {
                    Name = "top_lostFileAmount", HeaderText = "必备文件缺失数", FillWeight = 5
                },
                new DataGridViewLinkColumn()
                {
                    Name = "top_subjectAmount", HeaderText = "子课题数", FillWeight = 4
                },
            });

            DataTable topicTable = SQLiteHelper.ExecuteQuery($"SELECT * FROM topic_info WHERE ti_obj_id='{pid}'");

            for (int i = 0; i < topicTable.Rows.Count; i++)
            {
                int index = dgv_ShowData.Rows.Add();
                dgv_ShowData.Rows[index].Tag = topicTable.Rows[i]["ti_id"];
                dgv_ShowData.Rows[index].Cells["top_id"].Value              = i + 1;
                dgv_ShowData.Rows[index].Cells["top_code"].Value            = topicTable.Rows[i]["ti_code"];
                dgv_ShowData.Rows[index].Cells["top_name"].Value            = topicTable.Rows[i]["ti_name"];
                dgv_ShowData.Rows[index].Cells["top_unit"].Value            = topicTable.Rows[i]["ti_unit"];
                dgv_ShowData.Rows[index].Cells["top_user"].Value            = topicTable.Rows[i]["ti_contacts"];
                dgv_ShowData.Rows[index].Cells["top_phone"].Value           = topicTable.Rows[i]["ti_contacts_phone"];
                dgv_ShowData.Rows[index].Cells["top_totalFileAmount"].Value = GetFileAmount(topicTable.Rows[i]["ti_id"]);
                dgv_ShowData.Rows[index].Cells["top_lostFileAmount"].Value  = GetLostFileAmount(topicTable.Rows[i]["ti_id"]);
                dgv_ShowData.Rows[index].Cells["top_subjectAmount"].Value   = GetSubjectAmount(topicTable.Rows[i]["ti_id"]);
            }
            dgv_ShowData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            dgv_ShowData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            DataGridViewStyleHelper.SetAlignWithCenter(dgv_ShowData, new string[] { "top_id", "top_totalFileAmount", "top_subjectAmount", "top_lostFileAmount" });

            btn_Query.Tag     = "TOPIC";
            lbl_position.Text = parentObjName != null ? $"{UserHelper.GetUser().SpecialName} >> {parentObjName}" : lbl_position.Text;

            return(topicTable.Rows.Count == 0 ? false : true);
        }
예제 #13
0
        private void LoadStateTip()
        {
            int totalFileAmount     = SQLiteHelper.ExecuteCountQuery($"SELECT COUNT(bfi_id) FROM backup_files_info WHERE bfi_userid='{UserHelper.GetUser().UserId}' AND bfi_type=0");
            int workedFileAmount    = SQLiteHelper.ExecuteCountQuery($"SELECT COUNT(bfi_id) FROM backup_files_info WHERE bfi_userid='{UserHelper.GetUser().UserId}' AND bfi_state=1 AND bfi_type=0");
            int disWorkedFileAmount = SQLiteHelper.ExecuteCountQuery($"SELECT COUNT(bfi_id) FROM backup_files_info WHERE bfi_userid='{UserHelper.GetUser().UserId}' AND bfi_state=0 AND bfi_type=0");

            int    gdFileAmount    = SQLiteHelper.ExecuteCountQuery($"SELECT COUNT(bfi_id) FROM backup_files_info WHERE bfi_userid='{UserHelper.GetUser().UserId}' AND bfi_state_gd=1 AND bfi_type=0");
            int    disGdFileAmount = SQLiteHelper.ExecuteCountQuery($"SELECT COUNT(bfi_id) FROM backup_files_info WHERE bfi_userid='{UserHelper.GetUser().UserId}' AND bfi_state_gd=0 AND bfi_type=0");
            string tipString       = $"总文件数:{totalFileAmount},已处理:{workedFileAmount},未处理:{disWorkedFileAmount},已归档:{gdFileAmount},未归档:{disGdFileAmount}";

            stateTip.Text = "当前加工统计:" + tipString;
        }
예제 #14
0
        /// <summary>
        /// 加载待移交列表
        /// </summary>
        private void LoadDataList()
        {
            DataTable _table = new DataTable();

            _table.Columns.AddRange(new DataColumn[]
            {
                new DataColumn("id"),
                new DataColumn("code"),
                new DataColumn("name"),
                new DataColumn("date"),
                new DataColumn("state"),
            });

            //项目
            DataTable proTable = SQLiteHelper.ExecuteQuery("SELECT pi_id id, pi_code code, pi_name name, hr_lastupdate date, hr_isupdate state FROM project_info " +
                                                           $"LEFT JOIN handover_record ON pi_id=hr_obj_id WHERE pi_obj_id='{UserHelper.GetUser().SpecialId}'");

            for (int i = 0; i < proTable.Rows.Count; i++)
            {
                DataRow _proRow = proTable.Rows[i];
                _table.ImportRow(_proRow);
                //项目-课题
                DataTable proTopTable = SQLiteHelper.ExecuteQuery($"SELECT ti_id id, ti_code code, ti_name name, hr_lastupdate date, hr_isupdate state FROM topic_info " +
                                                                  $"LEFT JOIN handover_record ON ti_id=hr_obj_id WHERE ti_obj_id='{_proRow[0]}'");
                for (int j = 0; j < proTopTable.Rows.Count; j++)
                {
                    DataRow _proTopRow = proTopTable.Rows[j];
                    _table.ImportRow(_proTopRow);
                    //项目-课题-子课题
                    DataTable proTopSubTable = SQLiteHelper.ExecuteQuery($"SELECT si_id id, si_code code, si_name name, hr_lastupdate date, hr_isupdate state FROM subject_info " +
                                                                         $"LEFT JOIN handover_record ON si_id=hr_obj_id WHERE si_obj_id='{_proTopRow[0]}'");
                    for (int k = 0; k < proTopSubTable.Rows.Count; k++)
                    {
                        DataRow _proTopSubRow = proTopSubTable.Rows[k];
                        _table.ImportRow(_proTopSubRow);
                    }
                }
            }

            //课题
            DataTable topTable = SQLiteHelper.ExecuteQuery($"SELECT ti_id id, ti_code code, ti_name name, hr_lastupdate date, hr_isupdate state FROM topic_info " +
                                                           $"LEFT JOIN handover_record ON ti_id=hr_obj_id WHERE ti_obj_id='{UserHelper.GetUser().SpecialId}'");

            for (int j = 0; j < topTable.Rows.Count; j++)
            {
                DataRow _topRow = topTable.Rows[j];
                _table.ImportRow(_topRow);
                //课题-子课题
                DataTable topSubTable = SQLiteHelper.ExecuteQuery($"SELECT si_id id, si_code code, si_name name, hr_lastupdate date, hr_isupdate state FROM subject_info " +
                                                                  $"LEFT JOIN handover_record ON si_id=hr_obj_id WHERE si_obj_id='{_topRow[0]}'");
                for (int k = 0; k < topSubTable.Rows.Count; k++)
                {
                    DataRow _topSubRow = topSubTable.Rows[k];
                    _table.ImportRow(_topSubRow);
                }
            }

            lsv_DataList.Items.Clear();
            checkBox1.Checked = false;
            foreach (DataRow row in _table.Rows)
            {
                ListViewItem item = lsv_DataList.Items.Add(GetValue(row["code"]));
                item.SubItems.AddRange(new ListViewItem.ListViewSubItem[]
                {
                    new ListViewItem.ListViewSubItem()
                    {
                        Text = GetValue(row["name"])
                    },
                    new ListViewItem.ListViewSubItem()
                    {
                        Text = GetValue(row["date"])
                    },
                    new ListViewItem.ListViewSubItem()
                    {
                        Text = row["date"] == null ? string.Empty : GetStateValue(row["state"])
                    },
                });
                item.Tag = row["id"];
            }
        }
예제 #15
0
        private void Btn_Start_Click(object sender, EventArgs e)
        {
            progressBar1.Maximum = GetTotalFileAmountBySpiId(UserHelper.GetUser().SpecialId);
            int    count = progressBar1.Maximum, okcount = 0, nocount = 0;
            string rootFolder = txt_FilePath.Text + "\\" + SQLiteHelper.ExecuteOnlyOneQuery($"SELECT spi_name FROM special_info WHERE spi_id='{UserHelper.GetUser().SpecialId}'");

            if (!Directory.Exists(rootFolder))
            {
                Directory.CreateDirectory(rootFolder);
            }
            //专项下的文件
            CopyFile(ref okcount, ref nocount, rootFolder, GetFileLinkByObjId(UserHelper.GetUser().SpecialId));
            //专项下的项目
            List <object[]> list2 = SQLiteHelper.ExecuteColumnsQuery($"SELECT pi_id, pi_name FROM project_info WHERE pi_obj_id='{UserHelper.GetUser().SpecialId}'", 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().SpecialId}'", 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);
            Close();
        }
예제 #16
0
        /// <summary>
        /// 加载目录树
        /// </summary>
        /// <param name="specialId">专项ID</param>
        public void LoadTreeList(object specialId)
        {
            tv_DataTree.Nodes.Clear();
            TreeNode rootNode = null;
            //【计划】
            DataRow row = SQLiteHelper.ExecuteSingleRowQuery($"SELECT dd_id, dd_code, dd_name FROM data_dictionary WHERE dd_id='{specialId ?? UserHelper.GetUser().SpecialId}'");

            if (row != null)
            {
                rootNode = new TreeNode()
                {
                    Name     = GetValue(row["dd_id"]),
                    Text     = GetValue(row["dd_name"]) + "    ",
                    Tag      = ControlType.Plan,
                    NodeFont = new System.Drawing.Font("微软雅黑", 10f)
                };
                //【项目】
                DataTable projectTable = SQLiteHelper.ExecuteQuery($"SELECT pi_id, pi_code, pi_name FROM project_info WHERE pi_obj_id='{rootNode.Name}'");
                for (int i = 0; i < projectTable.Rows.Count; i++)
                {
                    TreeNode treeNode = new TreeNode()
                    {
                        Name = GetValue(projectTable.Rows[i]["pi_id"]),
                        Text = GetValue(projectTable.Rows[i]["pi_code"]),
                        Tag  = ControlType.Plan_Project
                    };
                    rootNode.Nodes.Add(treeNode);
                    //【课题】
                    DataTable table2 = SQLiteHelper.ExecuteQuery($"SELECT ti_id, ti_code, ti_name FROM topic_info WHERE ti_obj_id='{treeNode.Name}' ORDER BY ti_code");
                    for (int j = 0; j < table2.Rows.Count; j++)
                    {
                        TreeNode treeNode2 = new TreeNode()
                        {
                            Name = GetValue(table2.Rows[j]["ti_id"]),
                            Text = GetValue(table2.Rows[j]["ti_code"]),
                            Tag  = ControlType.Plan_Topic
                        };
                        treeNode.Nodes.Add(treeNode2);
                        //【子课题】
                        DataTable table3 = SQLiteHelper.ExecuteQuery($"SELECT si_id, si_code, si_name FROM subject_info WHERE si_obj_id='{treeNode2.Name}' ORDER BY si_code");
                        for (int k = 0; k < table3.Rows.Count; k++)
                        {
                            treeNode2.Nodes.Add(new TreeNode()
                            {
                                Name = GetValue(table3.Rows[k]["si_id"]),
                                Text = GetValue(table3.Rows[k]["si_code"]),
                                Tag  = ControlType.Plan_Topic_Subject
                            });
                        }
                    }
                    //【子课题】
                    DataTable table4 = SQLiteHelper.ExecuteQuery($"SELECT si_id, si_code, si_name FROM subject_info WHERE si_obj_id='{treeNode.Name}' ORDER BY si_code");
                    for (int k = 0; k < table4.Rows.Count; k++)
                    {
                        treeNode.Nodes.Add(new TreeNode()
                        {
                            Name = GetValue(table4.Rows[k]["si_id"]),
                            Text = GetValue(table4.Rows[k]["si_code"]),
                            Tag  = ControlType.Plan_Topic_Subject
                        });
                    }
                }
                //【课题】
                DataTable topicTable = SQLiteHelper.ExecuteQuery($"SELECT ti_id, ti_code, ti_name FROM topic_info WHERE ti_obj_id='{rootNode.Name}'");
                for (int j = 0; j < topicTable.Rows.Count; j++)
                {
                    TreeNode treeNode = new TreeNode()
                    {
                        Name = GetValue(topicTable.Rows[j]["ti_id"]),
                        Text = GetValue(topicTable.Rows[j]["ti_code"]),
                        Tag  = ControlType.Topic
                    };
                    rootNode.Nodes.Add(treeNode);
                    //【子课题】
                    DataTable table3 = SQLiteHelper.ExecuteQuery($"SELECT si_id, si_code, si_name FROM subject_info WHERE si_obj_id='{treeNode.Name}' ORDER BY si_code");
                    for (int k = 0; k < table3.Rows.Count; k++)
                    {
                        treeNode.Nodes.Add(new TreeNode()
                        {
                            Name = GetValue(table3.Rows[k]["si_id"]),
                            Text = GetValue(table3.Rows[k]["si_code"]),
                            Tag  = ControlType.Plan_Topic_Subject
                        });
                    }
                }
                tv_DataTree.Nodes.Add(rootNode);
            }
            tv_DataTree.ExpandAll();

            LoadStateTip();
        }
예제 #17
0
        private void btn_Sure_Click(object sender, EventArgs e)
        {
            object id      = cbo_ChooseIdentity.SelectedValue;
            string name    = cbo_ChooseIdentity.Text;
            string depName = txt_Unit.Text;

            if (string.IsNullOrEmpty(depName))
            {
                new ErrorProvider().SetError(txt_Unit, "提示:单位名称不能为空。");
            }
            else if (MessageBox.Show($"选择后不可修改,确定是属于{name}吗?", "确认提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
            {
                SQLiteHelper.ExecuteNonQuery($"UPDATE user_info SET ui_department='{depName}', ui_special_id='{id}' WHERE ui_id='{UserHelper.GetUser().UserId}'");

                DialogResult = DialogResult.OK;
                Close();
            }
        }
예제 #18
0
 private void Frm_EditPassword_Load(object sender, EventArgs e)
 {
     lbl_UserName.Text = UserHelper.GetUser().UserName;
 }
예제 #19
0
        /// <summary>
        /// 移交
        /// </summary>
        private void Btn_Export_Click(object sender, EventArgs e)
        {
            int amount = lsv_DataList.CheckedItems.Count;

            if (amount > 0)
            {
                string targetPath = txt_ExportPath.Text;
                if (!string.IsNullOrEmpty(targetPath))
                {
                    pic_Wait.Visible   = true;
                    btn_Export.Enabled = false;

                    for (int i = 0; i < amount; i++)
                    {
                        string code        = lsv_DataList.CheckedItems[i].Text;
                        string _targetPath = targetPath + "\\" + code;
                        if (!Directory.Exists(_targetPath))
                        {
                            Directory.CreateDirectory(_targetPath);
                        }
                        string   rootFolder  = pro_GuiDang.Tag + "\\" + UserHelper.GetUser().SpecialName;
                        string[] directories = Directory.GetDirectories(rootFolder, code, SearchOption.AllDirectories);
                        if (directories.Length > 0)
                        {
                            DirectoryInfo directory = new DirectoryInfo(directories[0]);
                            FileInfo[]    files     = directory.GetFiles();
                            foreach (FileInfo file in files)
                            {
                                string targetFilePath = _targetPath + "\\" + file.Name;
                                if (!File.Exists(targetFilePath))
                                {
                                    File.Create(targetFilePath).Close();
                                }
                                File.Copy(file.FullName, targetFilePath, true);
                            }
                        }

                        object id        = lsv_DataList.CheckedItems[i].Tag;
                        object historyId = SQLiteHelper.ExecuteOnlyOneQuery($"SELECT hr_id FROM handover_record WHERE hr_obj_id='{id}'");
                        if (historyId == null)
                        {
                            SQLiteHelper.ExecuteNonQuery($"INSERT INTO handover_record (hr_id, hr_obj_id, hr_lastupdate) " +
                                                         $"VALUES('{Guid.NewGuid().ToString()}', '{id}', '{DateTime.Now.ToString("s")}'); ");
                        }
                        else
                        {
                            SQLiteHelper.ExecuteNonQuery($"UPDATE handover_record SET hr_lastupdate='{DateTime.Now.ToString("s")}', hr_isupdate=0 WHERE hr_id = '{historyId}'");
                        }
                    }

                    string destPath = targetPath + $"\\ISTIC_{DateTime.Now.ToString("yyyyMMddHHmm")}.db";
                    if (!Directory.Exists(Path.GetDirectoryName(destPath)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(destPath));
                    }
                    if (!File.Exists(destPath))
                    {
                        File.Create(destPath).Close();
                    }
                    string sourFile = Application.StartupPath + @"\ISTIC.db";
                    File.Copy(sourFile, destPath, true);

                    pic_Wait.Visible   = false;
                    btn_Export.Enabled = true;
                    if (MessageBox.Show("移交完毕,是否现在打开文件夹?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
                    {
                        WinFormOpenHelper.OpenWinForm(0, "open", null, null, targetPath, ShowWindowCommands.SW_NORMAL);
                    }
                    LoadDataList();
                }
                else
                {
                    MessageBox.Show("请指定移交路径。", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            else
            {
                MessageBox.Show("请至少选择一条待移交的数据。", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
예제 #20
0
 private void pic_Query_Click(object sender, EventArgs e)
 {
     new Frm_Query(UserHelper.GetUser().SpecialId).ShowDialog();
 }
예제 #21
0
        /// <summary>
        /// 归档
        /// </summary>
        private void Btn_GuiDang_Click(object sender, EventArgs e)
        {
            int needGDFileAmount = GetTotalFileAmountBySpiId(UserHelper.GetUser().SpecialId);

            pro_GuiDang.Value   = pro_GuiDang.Minimum = 0;
            pro_GuiDang.Maximum = needGDFileAmount;

            object KEY   = "SAVE_PATH";
            object value = SQLiteHelper.ExecuteOnlyOneQuery($"SELECT dd_name FROM data_dictionary WHERE dd_code='{KEY}'");

            if (value != null)
            {
                pro_GuiDang.Tag = value;
                /* ----复制文件----*/
                string rootFolder = value + "\\" + UserHelper.GetUser().SpecialName;
                if (!Directory.Exists(rootFolder))
                {
                    try { Directory.CreateDirectory(rootFolder); }
                    catch (Exception ex) { MessageBox.Show(ex.Message); return; }
                }
                //专项下的项目
                List <object[]> list2 = SQLiteHelper.ExecuteColumnsQuery($"SELECT pi_id, pi_code FROM project_info WHERE pi_obj_id='{UserHelper.GetUser().SpecialId}'", 2);
                for (int i = 0; i < list2.Count; i++)
                {
                    string _rootFolder = rootFolder + "\\" + list2[i][1];
                    if (!Directory.Exists(_rootFolder))
                    {
                        Directory.CreateDirectory(_rootFolder);
                    }
                    //项目下的文件
                    CopyFile(_rootFolder, GetFileLinkByObjId(list2[i][0]), true);

                    //项目下的课题
                    List <object[]> list5 = SQLiteHelper.ExecuteColumnsQuery($"SELECT ti_id, ti_code 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(_rootFolder2, GetFileLinkByObjId(list5[j][0]), true);

                        //课题下的子课题
                        List <object[]> list6 = SQLiteHelper.ExecuteColumnsQuery($"SELECT si_id, si_code 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(_rootFolder3, GetFileLinkByObjId(list6[k][0]), true);
                        }
                    }
                    //项目下的子课题
                    List <object[]> list7 = SQLiteHelper.ExecuteColumnsQuery($"SELECT si_id, si_code 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(_rootFolder2, GetFileLinkByObjId(list7[j][0]), true);
                    }
                }
                //专项下的课题
                List <object[]> list4 = SQLiteHelper.ExecuteColumnsQuery($"SELECT ti_id, ti_code FROM topic_info WHERE ti_obj_id='{UserHelper.GetUser().SpecialId}'", 2);
                for (int i = 0; i < list4.Count; i++)
                {
                    string _rootFolder = rootFolder + "\\" + list4[i][1];
                    if (!Directory.Exists(_rootFolder))
                    {
                        Directory.CreateDirectory(_rootFolder);
                    }
                    //课题下的文件
                    CopyFile(_rootFolder, GetFileLinkByObjId(list4[i][0]), true);

                    //课题下的子课题
                    List <object[]> list6 = SQLiteHelper.ExecuteColumnsQuery($"SELECT si_id, si_code 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(_rootFolder3, GetFileLinkByObjId(list6[k][0]), true);
                    }
                }

                gro_GuiDang.Text  += "[归档完毕]";
                gro_YiJiao.Enabled = true;
                LoadDataList();
                gro_GuiDang.Enabled = false;
            }
            else
            {
                MessageBox.Show("请先设置归档文件存放路径(全文路径)。", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
예제 #22
0
        /// <summary>
        /// 项目列表
        /// </summary>
        /// <param name="spid">专项ID</param>
        private void LoadProjectList(object spid)
        {
            dgv_ShowData.Rows.Clear();
            dgv_ShowData.Columns.Clear();

            dgv_ShowData.Columns.AddRange(new DataGridViewColumn[]
            {
                new DataGridViewTextBoxColumn()
                {
                    Name = "pro_id", HeaderText = "序号", FillWeight = 3
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "pro_code", HeaderText = "编号", FillWeight = 8
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "pro_name", HeaderText = "名称", FillWeight = 10
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "pro_unit", HeaderText = "承担单位", FillWeight = 8
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "pro_user", HeaderText = "负责人", FillWeight = 5
                },
                new DataGridViewTextBoxColumn()
                {
                    Name = "pro_phone", HeaderText = "手机", FillWeight = 4
                },
                new DataGridViewLinkColumn()
                {
                    Name = "pro_totalFileAmount", HeaderText = "总文件数", FillWeight = 3
                },
                new DataGridViewLinkColumn()
                {
                    Name = "pro_lostFileAmount", HeaderText = "必备文件缺失数", FillWeight = 5
                },
                new DataGridViewLinkColumn()
                {
                    Name = "pro_topicAmount", HeaderText = "课题/子课题数", FillWeight = 4
                },
            });
            DataTable projectTable = SQLiteHelper.ExecuteQuery($"SELECT * FROM project_info WHERE pi_obj_id='{spid}'");

            for (int i = 0; i < projectTable.Rows.Count; i++)
            {
                int index = dgv_ShowData.Rows.Add();
                dgv_ShowData.Rows[index].Tag = projectTable.Rows[i]["pi_id"];
                dgv_ShowData.Rows[index].Cells["pro_id"].Value              = index + 1;
                dgv_ShowData.Rows[index].Cells["pro_code"].Value            = projectTable.Rows[i]["pi_code"];
                dgv_ShowData.Rows[index].Cells["pro_name"].Value            = projectTable.Rows[i]["pi_name"];
                dgv_ShowData.Rows[index].Cells["pro_unit"].Value            = projectTable.Rows[i]["pi_unit"];
                dgv_ShowData.Rows[index].Cells["pro_user"].Value            = projectTable.Rows[i]["pi_contacts"];
                dgv_ShowData.Rows[index].Cells["pro_phone"].Value           = projectTable.Rows[i]["pi_contacts_phone"];
                dgv_ShowData.Rows[index].Cells["pro_totalFileAmount"].Value = GetFileAmount(projectTable.Rows[i]["pi_id"]);
                dgv_ShowData.Rows[index].Cells["pro_lostFileAmount"].Value  = GetLostFileAmount(projectTable.Rows[i]["pi_id"]);
                dgv_ShowData.Rows[index].Cells["pro_topicAmount"].Value     = GetTopicAmount(projectTable.Rows[i]["pi_id"]);
            }

            DataTable topicTable = SQLiteHelper.ExecuteQuery($"SELECT * FROM topic_info WHERE ti_obj_id='{spid}'");

            for (int i = 0; i < topicTable.Rows.Count; i++)
            {
                int index = dgv_ShowData.Rows.Add();
                dgv_ShowData.Rows[index].Tag = topicTable.Rows[i]["ti_id"];
                dgv_ShowData.Rows[index].Cells["pro_id"].Value              = index + 1;
                dgv_ShowData.Rows[index].Cells["pro_code"].Value            = topicTable.Rows[i]["ti_code"];
                dgv_ShowData.Rows[index].Cells["pro_name"].Value            = topicTable.Rows[i]["ti_name"];
                dgv_ShowData.Rows[index].Cells["pro_unit"].Value            = topicTable.Rows[i]["ti_unit"];
                dgv_ShowData.Rows[index].Cells["pro_user"].Value            = topicTable.Rows[i]["ti_contacts"];
                dgv_ShowData.Rows[index].Cells["pro_phone"].Value           = topicTable.Rows[i]["ti_contacts_phone"];
                dgv_ShowData.Rows[index].Cells["pro_totalFileAmount"].Value = GetFileAmount(topicTable.Rows[i]["ti_id"]);
                dgv_ShowData.Rows[index].Cells["pro_lostFileAmount"].Value  = GetLostFileAmount(topicTable.Rows[i]["ti_id"]);
                dgv_ShowData.Rows[index].Cells["pro_topicAmount"].Value     = GetSubjectAmount(topicTable.Rows[i]["ti_id"]);
            }

            dgv_ShowData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            dgv_ShowData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            DataGridViewStyleHelper.SetAlignWithCenter(dgv_ShowData, new string[] { "pro_id", "pro_totalFileAmount", "pro_topicAmount", "pro_lostFileAmount" });

            btn_Query.Tag = "PROJECT";

            lbl_position.Text = $"{UserHelper.GetUser().SpecialName}";
        }