//单条增加 private void barBtnSingle_ItemClick(object sender, ItemClickEventArgs e) { using (var singleInfoForm = new SingleInfoForm() { Text = "单条增加" }) { singleInfoForm.ShowDialog(); if (singleInfoForm.DialogResult == DialogResult.OK) { this.SearchLocal(1); } } }
//单条修改 private void barBtnUpdate_ItemClick(object sender, ItemClickEventArgs e) { var dtExport = (DataTable)this.gcDataInfo.DataSource; string msg = string.Empty; if (dtExport == null || dtExport.Rows.Count < 1) { MessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (GridControlHelper.SelectedItems(this.gvDataInfo).Rows.Count != 1) { MessageBox.Show("当前只能操作一条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string vin = (string)(GridControlHelper.SelectedItems(this.gvDataInfo).Rows[0].ItemArray[0]); Dictionary <string, string> mapData = QueryHelper.queryInfomationByVin(vin); if (mapData.Count < 1) { MessageBox.Show("未查到该vin对应数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string status = (string)(GridControlHelper.SelectedItems(this.gvDataInfo).Rows[0]["STATUS"]); Dictionary <string, string> mapRightData = new Dictionary <string, string>(); if (status.Equals("1")) { mapRightData = QueryHelper.queryRightByVin(vin); } using (var dlg = new SingleInfoForm(mapData, mapRightData, true, false) { Text = "单条修改" }) { dlg.ShowDialog(); if (dlg.DialogResult == DialogResult.OK) { this.refrashCurrentPage(); } } }
//窗体双击事件,VIN号的顺序取决于所查询的表 private void gcDataInfo_MouseDoubleClick(object sender, MouseEventArgs e) { ColumnView cv = (ColumnView)this.gcDataInfo.FocusedView; DataRowView dr = (DataRowView)cv.GetFocusedRow(); if (dr == null) { return; } string vin = (string)dr.Row["VIN"]; Dictionary <string, string> mapData = QueryHelper.queryInfomationByVin(vin); if (mapData.Count < 1) { MessageBox.Show("未查到该vin对应数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string status = (string)dr.Row["STATUS"]; Dictionary <string, string> mapRightData = new Dictionary <string, string>(); if (status.Equals("1")) { mapRightData = QueryHelper.queryRightByVin(vin); } using (var dlg = new SingleInfoForm(mapData, mapRightData, true, false) { Text = "单条修改" }) { dlg.ShowDialog(); if (dlg.DialogResult == DialogResult.OK) { this.refrashCurrentPage(); } } }