예제 #1
0
        private void buttonX_Del_Click(object sender, EventArgs e)
        {
            if (dataGridView_LawFileInfo.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请先选中一行数据");
                return;
            }
            var  row         = dataGridView_LawFileInfo.SelectedRows[0];
            long ID          = (long)(row.Cells[0].Value);
            var  LawFileInfo = lawFileInfoList.Find(_ => _.ID == ID);

            if (LawFileInfo == null)
            {
                MessageBox.Show("数据错误");
                return;
            }

            try
            {
                LawFileInfoRepository repo = new LawFileInfoRepository();
                repo.Delete(ID);
                RefreshFileInfo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #2
0
        private void RefreshFileInfo()
        {
            LawFileInfoRepository repo = new LawFileInfoRepository();

            lawFileInfoList = repo.GetList();
            dataGridView_LawFileInfo.DataSource = lawFileInfoList;
        }
예제 #3
0
        private void buttonX_Search_Click(object sender, EventArgs e)
        {
            StringBuilder searchCondition = new StringBuilder(" where 1=1");

            if (!dateTimeInput_TimeStart.IsEmpty)
            {
                searchCondition.Append(" and IssueTime>@IssueTimeStart");
            }
            if (!dateTimeInput_TimeEnd.IsEmpty)
            {
                searchCondition.Append(" and IssueTime<@IssueTimeEnd");
            }
            if (!string.IsNullOrWhiteSpace(textBoxX_LawFileType.Text))
            {
                searchCondition.Append(" and LawFileType like @LawFileType");
            }
            if (!string.IsNullOrWhiteSpace(textBoxX_IssueOrganization.Text))
            {
                searchCondition.Append(" and IssueOrganization like @IssueOrganization");
            }
            if (!string.IsNullOrWhiteSpace(textBoxX_LawFileName.Text))
            {
                searchCondition.Append(" and LawFileName like @LawFileName");
            }

            LawFileInfoRepository repo = new LawFileInfoRepository();

            lawFileInfoList = repo.GetListWithCondition(searchCondition.ToString(), new
            {
                IssueTimeStart    = dateTimeInput_TimeStart.Value,
                IssueTimeEnd      = dateTimeInput_TimeEnd.Value,
                LawFileType       = "%" + textBoxX_LawFileType.Text + "%",
                IssueOrganization = "%" + textBoxX_IssueOrganization.Text + "%",
                LawFileName       = "%" + textBoxX_LawFileName.Text + "%"
            });
            dataGridView_LawFileInfo.DataSource = lawFileInfoList;
        }
예제 #4
0
        private void buttonX_Save_Click(object sender, EventArgs e)
        {
            LawFileInfoRepository repo = new LawFileInfoRepository();

            try
            {
                if (operType.Equals("Add"))
                {
                    LawFileInfo newLawFileInfo = new LawFileInfo();
                    newLawFileInfo.LawFilePath       = textBoxX_Path.Text;
                    newLawFileInfo.LawFileName       = textBoxX_Name.Text;
                    newLawFileInfo.IssueTime         = dateTimeInput_Time.Value;
                    newLawFileInfo.LawFileType       = textBoxX_LawFileType.Text;
                    newLawFileInfo.IssueOrganization = textBoxX_IssueOrganization.Text;
                    newLawFileInfo.IssueVersion      = textBoxX_IssueVersion.Text;
                    newLawFileInfo.Description       = textBoxX_Description.Text;
                    repo.Insert(newLawFileInfo);
                }
                else
                {
                    lawFileInfo.LawFilePath       = textBoxX_Path.Text;
                    lawFileInfo.LawFileName       = textBoxX_Name.Text;
                    lawFileInfo.IssueTime         = dateTimeInput_Time.Value;
                    lawFileInfo.LawFileType       = textBoxX_LawFileType.Text;
                    lawFileInfo.IssueOrganization = textBoxX_IssueOrganization.Text;
                    lawFileInfo.IssueVersion      = textBoxX_IssueVersion.Text;
                    lawFileInfo.Description       = textBoxX_Description.Text;
                    repo.Update(lawFileInfo);
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }