/// <summary> /// 修改车型参数表关联数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdateRelData_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // 获取车型参数编号 string mainIds = string.Empty; PorscheUtils porscheUtils = new PorscheUtils(true); try { List <string> ctnyList = porscheUtils.GetMainIdFromControl(this.gvCtny, (DataTable)this.dgvCtny.DataSource); List <string> fcdsList = porscheUtils.GetMainIdFromControl(this.gvFcds, (DataTable)this.dgvFcds.DataSource); if (ctnyList.Count + fcdsList.Count < 1) { MessageBox.Show("请选择车型参数信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } foreach (string ctnyId in ctnyList) { mainIds += string.Format(",'{0}'", ctnyId); } foreach (string fcdsId in fcdsList) { mainIds += string.Format(",'{0}'", fcdsId); } if (!string.IsNullOrEmpty(mainIds)) { mainIds = mainIds.Substring(1); } ReviewUpdateVinForm reviewVinForm = new ReviewUpdateVinForm(mainIds); reviewVinForm.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 删除车型参数 /// </summary> /// <param name="deleteType">修改类型:“CTNY”表示修改传统能源车型参数对应的油耗数据;“FCDS”表示修改非插电式车型参数对应的油耗数据</param> protected void DeleteMain(string deleteFuel) { // 记录修改后的CPOS或者车型参数编号 string mainIds = string.Empty; PorscheUtils porscheUtil = new PorscheUtils(false); try { List <string> mainIdList = new List <string>(); // 冲界面获取修改后的车型参数或者cpos信息 if (deleteFuel == "CTNY") { mainIdList = porscheUtil.GetMainIdFromControl(this.gvCtny, (DataTable)this.dgvCtny.DataSource); } else if (deleteFuel == "FCDS") { mainIdList = porscheUtil.GetMainIdFromControl(this.gvFcds, (DataTable)this.dgvFcds.DataSource); } else if (deleteFuel == "CDS") { mainIdList = porscheUtil.GetMainIdFromControl(this.gvCds, (DataTable)this.dgvCds.DataSource); } else if (deleteFuel == "CDD") { mainIdList = porscheUtil.GetMainIdFromControl(this.gvCdd, (DataTable)this.gvCdd.DataSource); } else if (deleteFuel == "RLDC") { mainIdList = porscheUtil.GetMainIdFromControl(this.gvRldc, (DataTable)this.gvRldc.DataSource); } if (mainIdList.Count < 1) { MessageBox.Show("请选择要删除的数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } foreach (string mainId in mainIdList) { mainIds += string.Format(",'{0}'", mainId); } if (!string.IsNullOrEmpty(mainIds)) { mainIds = mainIds.Substring(1); } string delMsg = string.Empty; if (MessageBox.Show("确定要删除吗?", "删除确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK) { delMsg = porscheUtil.DeleteMain(deleteFuel, mainIds); if (deleteFuel == "CTNY") { this.SearchMainData("CTNY"); } else if (deleteFuel == "FCDS") { this.SearchMainData("FCDS"); } else if (deleteFuel == "CDS") { this.SearchMainData("CDS"); } else if (deleteFuel == "CDD") { this.SearchMainData("CDD"); } else if (deleteFuel == "RLDC") { this.SearchMainData("RLDC"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }