private string saveResult() { Dictionary <string, DataTable> dictionary = new Dictionary <string, DataTable>(); dictionary.Add("Report", DgvToTable(dgvReport)); dictionary.Add("Feedback", DgvToTable(dgvFeedback)); dictionary.Add("Compare", DgvToTable(dgvCompare)); DTV.Business business = new DTV.Business(); Dictionary <string, string> result = CalcCompareResult(); //比对结果数据 DataTable dt = new DataTable(); dt.Columns.Add("Type", Type.GetType("System.String")); dt.Columns.Add("Report", Type.GetType("System.String")); dt.Columns.Add("Feedback", Type.GetType("System.String")); dt.Columns.Add("Compare", Type.GetType("System.String")); dt.Columns.Add("RepLock", Type.GetType("System.Boolean")); DataRow newRow = dt.NewRow(); newRow["Type"] = "工商"; newRow["Report"] = result["Report"]; newRow["Feedback"] = result["Feedback"]; newRow["Compare"] = result["Compare"]; newRow["RepLock"] = false; dt.Rows.Add(newRow); dictionary.Add("Result", dt); return(business.SaveCompareResult(dictionary, query_id)); }
Dictionary <string, string> CalcCompareResult() { DTV.Business business = new DTV.Business(); business.query_id = this.query_id; Dictionary <string, DataTable> dictionary = new Dictionary <string, DataTable>(); dictionary.Add("Report", DgvToTable(dgvReport)); dictionary.Add("Feedback", DgvToTable(dgvFeedback)); dictionary.Add("Compare", DgvToTable(dgvCompare)); return(business.CalcResult(dictionary)); }
private void tsbSaveResult_Click(object sender, EventArgs e) { string resultstr = saveResult(); MessageBox.Show(resultstr); if (resultstr == "写入成功!") { FrmPersonList frmOwner = (FrmPersonList)this.ParentForm.Owner; frmOwner.RefreshForm(); } DTV.Business business = new DTV.Business(); dgvReport.DataSource = business.LoadReport(query_id); dgvReport.Refresh(); }
private void btnUnhidden_Click(object sender, EventArgs e) { if (MessageBox.Show("取消隐藏将会自动保存比对结果,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } //saveResult(); BLL.business_feedback bll = new BLL.business_feedback(); bll.UpdateAll("is_hidden=0"); DTV.Business business = new DTV.Business(); //载入出入境反馈数据 dgvFeedback.DataSource = business.LoadFeedback(query_id); dgvFeedback.Refresh(); }
private void UBusinesControl_Load(object sender, EventArgs e) { //设置匹配表格格式 dgvCompare.AutoGenerateColumns = false; dgvFeedback.AutoGenerateColumns = false; dgvReport.AutoGenerateColumns = false; this.dgvCompare.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; this.dgvCompare.ColumnHeadersHeight = this.dgvCompare.ColumnHeadersHeight * 2; this.dgvCompare.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter; DTV.Business business = new DTV.Business(); //载入反馈数据 dgvFeedback.DataSource = business.LoadFeedback(query_id); //载入个人报告数据 dgvReport.DataSource = business.LoadReport(query_id); //载入比对匹配数据 dgvCompare.DataSource = business.LoadCompare(query_id); dgvFeedback.ClearSelection(); dgvReport.ClearSelection(); dgvCompare.ClearSelection(); //载入比对结果数据 DataTable dt = business.LoadCompareResult(query_id); if (dt.Rows.Count == 1) { tbReport.Text = dt.Rows[0]["report_str"].ToString(); tbFeedback.Text = dt.Rows[0]["feedback_str"].ToString(); tbCompare.Text = dt.Rows[0]["compare_str"].ToString(); } if (dt.Rows.Count == 0) { GetCompareResult(); } }
private void dgvFeedback_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (dgvFeedback.Columns[e.ColumnIndex] is DataGridViewButtonColumn) { string feeFullName = dgvFeedback.Rows[e.RowIndex].Cells["fee_full_name"].Value.ToString(); string feeBusName = dgvFeedback.Rows[e.RowIndex].Cells["fee_bus_name"].Value.ToString(); DataTable dtReport = (DataTable)dgvReport.DataSource; if (dgvFeedback.Rows[e.RowIndex].Cells["fee_is_match"] != null && Convert.ToBoolean(dgvFeedback.Rows[e.RowIndex].Cells["fee_is_match"].Value)) { MessageBox.Show("本记录已匹配成功,不能添加或隐藏!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); dgvFeedback.ClearSelection(); return; } if (dgvFeedback.Columns[e.ColumnIndex].Name == "btnHidden") { int feedback_id; int.TryParse(dgvFeedback.Rows[e.RowIndex].Cells["fee_id"].Value.ToString(), out feedback_id); BLL.business_feedback bll = new BLL.business_feedback(); Model.business_feedback model = bll.GetModel(feedback_id); model.is_hidden = true; bll.Update(model); DTV.Business business = new DTV.Business(); //载入反馈数据 DataTable dt = (DataTable)dgvFeedback.DataSource; dt.Rows.Remove(dt.Select(string.Format("id={0}", feedback_id))[0]); dgvFeedback.DataSource = dt; dgvFeedback.Refresh(); } if (dgvFeedback.Columns[e.ColumnIndex].Name == "btnToReport")//左移 { if (dtReport.Select(string.Format("full_name='{0}' and bus_name='{1}'", feeFullName, feeBusName)).Length > 0) { MessageBox.Show("个人报告数据中已有记录,不能添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); dgvFeedback.ClearSelection(); return; } //添加数据到个人报告数据表中 DataRow drReport = dtReport.NewRow(); drReport["id"] = 0; drReport["query_id"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_query_id"].Value; drReport["full_name"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_full_name"].Value; drReport["bus_name"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_bus_name"].Value; drReport["bus_type"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_bus_type"].Value; drReport["subscribe"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_subscribe"].Value; drReport["proportion"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_proportion"].Value; drReport["office"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_office"].Value; drReport["status"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_status"].Value; drReport["is_match"] = true; drReport["is_import"] = false; drReport["feedback_id"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_id"].Value; dtReport.Rows.Add(drReport); dtReport.DefaultView.Sort = "feedback_id"; dgvReport.DataSource = dtReport; dgvFeedback.ClearSelection(); dgvReport.ClearSelection(); //添加数据到匹配数据表中 DataTable dtCompare = (DataTable)dgvCompare.DataSource; DataRow drCompare = dtCompare.NewRow(); drCompare["id"] = 0; drCompare["query_id"] = Convert.ToInt32(dgvFeedback.Rows[e.RowIndex].Cells["fee_query_id"].Value); drCompare["report_id"] = drReport["id"]; drCompare["feedback_id"] = Convert.ToInt32(dgvFeedback.Rows[e.RowIndex].Cells["fee_id"].Value); drCompare["rep_full_name"] = drReport["full_name"]; drCompare["rep_bus_name"] = drReport["bus_name"]; drCompare["rep_bus_type"] = drReport["bus_type"]; drCompare["rep_subscribe"] = drReport["subscribe"]; drCompare["rep_proportion"] = drReport["proportion"]; drCompare["rep_office"] = drReport["office"]; drCompare["rep_status"] = drReport["status"]; drCompare["fee_full_name"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_full_name"].Value; drCompare["fee_bus_name"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_bus_name"].Value; drCompare["fee_bus_type"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_bus_type"].Value; drCompare["fee_subscribe"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_subscribe"].Value; drCompare["fee_proportion"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_proportion"].Value; drCompare["fee_office"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_office"].Value; drCompare["fee_status"] = dgvFeedback.Rows[e.RowIndex].Cells["fee_status"].Value; drCompare["compare_type"] = "一致"; drCompare["less_value"] = 0; dtCompare.Rows.Add(drCompare); dgvCompare.DataSource = dtCompare; dgvCompare.ClearSelection(); dgvFeedback.Rows[e.RowIndex].Cells["fee_is_match"].Value = true; GetCompareResult(); } } } }