private void btComfirm_Click(object sender, EventArgs e) { var dtExport = (DataTable)this.gridControl1.DataSource; string msg = string.Empty; if (dtExport == null || dtExport.Rows.Count < 1) { MessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (GridControlHelper.SelectedItems(this.advBandedGridView1).Rows.Count != 1) { MessageBox.Show("当前只能操作一条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } System.Object[] ItemArray = GridControlHelper.SelectedItems(this.advBandedGridView1).Rows[0].ItemArray; bool bRet = false; if (mapdes.Length + 1 == ItemArray.Length) { for (int i = 0; i < mapdes.Length; i++) { mapCLXHData.Add(mapdes[i], ItemArray[i].ToString()); if (mapdes[i] == "RLDCXX_XH" || mapdes[i] == "RLDCXX_EDGL" || mapdes[i] == "RLDCXX_SCQY") { if (ItemArray[i].ToString() != "N/A" && ItemArray[i].ToString() != "" && !String.IsNullOrEmpty(ItemArray[i].ToString())) { bRet = true; } } } if (bRet) { mapCLXHData.Add("CLSFYRLDC", "是"); } else { mapCLXHData.Add("CLSFYRLDC", "否"); } } this.DialogResult = DialogResult.OK; this.Close(); }
//单条修改 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(); } } }
//批量驳回 private void barBtnReject_ItemClick(object sender, ItemClickEventArgs e) { //记录操作日志 LogUtils.ReviewLogManager.ReviewLog(Properties.Settings.Default.LocalUserName, String.Format("{0}-{1}", this.Text, this.barBtnReject.Caption)); if (this.xtraTabControl1.SelectedTabPage.Text.Equals("待审批")) { var dtExport = (DataTable)this.gcDataInfo.DataSource; if (dtExport == null || dtExport.Rows.Count < 1) { XtraMessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var dt = GridControlHelper.SelectedItems(this.gvDataInfo); if (dt.Rows.Count < 1) { XtraMessageBox.Show("请选择您要操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { using (var rf = new RejectInfoForm(dt, 0)) { rf.ShowDialog(); if (rf.DialogResult == DialogResult.OK) { this.refrashCurrentPage(); } } } catch (Exception ex) { XtraMessageBox.Show("操作出现错误:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { XtraMessageBox.Show("只能在待审批页面操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//删除 private void barBtnLocalDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.gcCljbxx == null || ((DataTable)this.gvCljbxx.DataSource).Rows.Count < 1) { MessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var dtSel = GridControlHelper.SelectedItems(this.gvCljbxx); if (dtSel.Rows.Count < 1) { MessageBox.Show("请选择您要操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("确定要删除吗?", "删除确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.OK) { return; } try { SplashScreenManager.ShowForm(typeof(DevWaitForm)); string vinStr = string.Join("','", dtSel.AsEnumerable().Select(d => d.Field <string>("VIN")).ToArray()); AccessHelper.ExecuteNonQuery(AccessHelper.conn, string.Format("delete from FC_CLJBXX where VIN in ('{0}')", vinStr)); AccessHelper.ExecuteNonQuery(AccessHelper.conn, string.Format("delete from RLLX_PARAM_ENTITY where VIN in ('{0}')", vinStr)); } catch (Exception ex) { MessageBox.Show("操作出现错误:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { SplashScreenManager.CloseForm(); } int pageNum = Convert.ToInt32(txtPage.Text.Substring(0, txtPage.Text.LastIndexOf("/"))); this.SearchLocal(pageNum); }
private void btnPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.gvCljbxx.DataSource == null || ((DataTable)this.gvCljbxx.DataSource).Rows.Count < 1) { MessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (GridControlHelper.SelectedItems(this.gvCljbxx).Rows.Count != 1) { MessageBox.Show("当前只能操作一条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { this.gvCljbxx.PostEditor(); List <PrintModel> printModelList = new List <PrintModel>(); DataTable dt = GridControlHelper.SelectedItems(this.gvCljbxx); if (dt.Rows[0]["check"].ToString() == "True") { PrintModel printModel = new PrintModel() { Qcscqy = dt.Rows[0]["QCSCQY"].ToString() == "" ? dt.Rows[0]["JKQCZJXS"].ToString() : dt.Rows[0]["QCSCQY"].ToString(), Clxh = dt.Rows[0]["CLXH"].ToString(), Zczbzl = dt.Rows[0]["ZCZBZL"].ToString() }; string strRllx = dt.Rows[0]["RLLX"].ToString(); printModel.Qdxs = dt.Rows[0]["QDXS"].ToString(); printModel.Zdsjzzl = dt.Rows[0]["ZDSJZZL"].ToString(); #region if (strRllx == "汽油" || strRllx == "柴油" || strRllx == "两用燃料" || strRllx == "双燃料") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "CT_PL") { printModel.Pl = strValue; } if (strCode == "CT_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CT_EDGL") { printModel.Edgl = strValue; } if (strCode == "CT_SJGKRLXHL") { printModel.Sj = strValue; } if (strCode == "CT_SQGKRLXHL") { printModel.Sq = strValue; } if (strCode == "CT_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception) { }; } if (strRllx == "插电式混合动力") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CDS_HHDL_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "CDS_HHDL_PL") { printModel.Pl = strValue; } if (strCode == "CDS_HHDL_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CDS_HHDL_EDGL") { printModel.Edgl = strValue; } if (strCode == "CDS_HHDL_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception) { }; } if (strRllx == "非插电式混合动力") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "FCDS_HHDL_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "FCDS_HHDL_PL") { printModel.Pl = strValue; } if (strCode == "FCDS_HHDL_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "FCDS_HHDL_EDGL") { printModel.Edgl = strValue; } if (strCode == "FCDS_HHDL_SJGKRLXHL") { printModel.Sj = strValue; } if (strCode == "FCDS_HHDL_SQGKRLXHL") { printModel.Sq = strValue; } if (strCode == "FCDS_HHDL_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception) { }; } if (strRllx == "纯电动") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CDD_QDDJEDGL") { printModel.Edgl = strValue; } } } catch (Exception) { }; } if (strRllx == "燃料电池") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "RLDC_QDDJEDGL") { printModel.Edgl = strValue; } if (strCode == "RLDC_ZHGKHQL") { printModel.Zh = strValue; } } } catch (Exception) { }; } printModel.Rllx = strRllx; #endregion printModel.Bah = dt.Rows[0]["VIN"].ToString(); printModel.Qysj = DateTime.Now.ToShortDateString(); printModelList.Add(printModel); } Utils.printModel = printModelList; using (PrintForm pf = new PrintForm()) { pf.ShowDialog(); } } catch (Exception) { MessageBox.Show("打印出错!", "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//数据恢复 private void barBtnRecover_ItemClick(object sender, ItemClickEventArgs e) { //记录操作日志 LogUtils.ReviewLogManager.ReviewLog(Properties.Settings.Default.LocalUserName, String.Format("{0}-{1}", this.Text, this.barBtnRecover.Caption)); DataTable selDataTable = new DataTable(); if (this.xtraTabControl1.SelectedTabPage.Text.Equals("待审批")) { selDataTable = GridControlHelper.SelectedItems(this.gvDataInfo); } else if (this.xtraTabControl1.SelectedTabPage.Text.Equals("驳回")) { selDataTable = GridControlHelper.SelectedItems(this.gvBackInfo); } else { selDataTable = GridControlHelper.SelectedItems(this.gvPassInfo); } string msg = string.Empty; if (selDataTable == null || selDataTable.Rows.Count < 1) { XtraMessageBox.Show("请选择您要操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (XtraMessageBox.Show("确定要恢复吗?", "恢复确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.OK) { return; } try { SplashScreenManager.ShowForm(typeof(DevWaitForm)); //二审通过 恢复到 一审通过状态 if (this.xtraTabControl1.SelectedTabPage.Text.Equals("待审批")) { var utilsFirst = new ApproveFirstUtils(); msg += utilsFirst.recoverDataInfo(selDataTable); var utilsSecond = new ApproveSecondUtils(); msg += utilsSecond.recoverDataInfo(selDataTable); } //三审驳回/通过 恢复到 二审通过状态 else { var utilsThird = new ApproveThirdUtils(); msg += utilsThird.recoverDataInfo(selDataTable); } } catch (Exception ex) { XtraMessageBox.Show("操作出现错误:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { SplashScreenManager.CloseForm(); } using (var mf = new MessageForm(msg) { Text = "恢复操作结果" }) { mf.ShowDialog(); if (mf.DialogResult == DialogResult.Cancel) { this.refrashCurrentPage(); } } }
//导出摸板 private void barBtnExportFloder_ItemClick(object sender, ItemClickEventArgs e) { try { var dtExport = (DataTable)this.gcDataInfo.DataSource; string msg = string.Empty; if (dtExport == null || dtExport.Rows.Count < 1) { MessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FolderDialog openFolder = new FolderDialog(); if (openFolder.DisplayDialog() == DialogResult.OK) { string vin = string.Empty; var selDataTable = GridControlHelper.SelectedItems(this.gvDataInfo); var selVIN = selDataTable.AsEnumerable().Select(d => d.Field <string>("VIN")).ToArray(); vin = string.Join("','", selVIN); vin = string.Format("'{0}'", vin); if (vin == "''") { vin = string.Empty; } if (string.IsNullOrEmpty(Settings.Default.ClearYear) || string.IsNullOrEmpty(Settings.Default.Vehicle_MFCS)) { MessageBox.Show("请先设置车辆生存企业名称和清算年份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DialogResult dr = MessageBox.Show(String.Format("确定要导出【{0}】,清算年份为【{1}】的数据吗?", Settings.Default.Vehicle_MFCS, Settings.Default.ClearYear), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dr == DialogResult.OK) { try { LoadingHandler.Show(this, args => { var exutils = new ExportNewInfoUtils(); msg = exutils.ExportNewTemplate(openFolder.Path, vin); }); if (String.IsNullOrEmpty(msg)) { MessageBox.Show("导出完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { using (var mf = new MessageForm(msg) { Text = "校验结果" }) { mf.ShowDialog(); } } } catch (System.Exception ex) { MessageBox.Show("操作出现错误:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (System.Exception ex) { } }