示例#1
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);
        }
        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();
            }
        }
示例#3
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}";
        }