/// <summary> /// 修改变更申请 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem6_ItemClick(object sender, ItemClickEventArgs e) { var view = dgvCtny.MainView; view.PostEditor(); DataView dv = (DataView)view.DataSource; List <string> listID = C2M.SelectedParamEntityIds(dv, "ID"); if (listID.Count > 1) { MessageBox.Show("每次只能操作一条记录,您选择了" + listID.Count + "条!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (listID.Count == 0) { MessageBox.Show("请选择要操作的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (listID.Count == 1) { string ID = (string)listID[0]; ChangeAddXtraForm caxf = new ChangeAddXtraForm(ID); caxf.Show(); } }
private void dgvCtny_MouseDoubleClick(object sender, MouseEventArgs e) { ColumnView cv = (ColumnView)dgvCtny.FocusedView; DataRowView dr = (DataRowView)cv.GetFocusedRow(); if (dr == null) { return; } string ID = (string)dr.Row.ItemArray[1]; ChangeAddXtraForm caxf = new ChangeAddXtraForm(ID); caxf.Show(); }
private void barButtonItem7_ItemClick(object sender, ItemClickEventArgs e) { var checkList = GetCheckData(); if (checkList.Count == 1) { string ID = checkList[0]; ChangeAddXtraForm caxf = new ChangeAddXtraForm(ID); caxf.Show(); } else { MessageBox.Show("每次只能操作一条记录,您选择了" + checkList.Count + "条!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
/// <summary> /// 导入变更申请单模板 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem8_ItemClick(object sender, ItemClickEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Excel|*.xls;*.xlsx|All Files|*.*"; if (ofd.ShowDialog() == DialogResult.OK) { try { MitsUtils miutils = new MitsUtils(); DataSet ds = miutils.ReadExcel(ofd.FileName, "Sheet1"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { var dt = ds.Tables[0]; dt.Columns["备案号(VIN)"].ColumnName = "VIN"; dt.Columns["产品型号"].ColumnName = "CLXH"; dt.Columns["通用名称"].ColumnName = "TYMC"; dt.Columns["燃料种类"].ColumnName = "RLLX"; dt.Columns["燃料消耗量(综合)"].ColumnName = "CT_ZHGKRLXHL"; dt.Columns["整备质量"].ColumnName = "ZCZBZL"; dt.Columns["变速器型式"].ColumnName = "CT_BSQXS"; dt.Columns["座椅排数"].ColumnName = "ZWPS"; dt.Columns["操作类型"].ColumnName = "APPLYTYPE"; dt.Columns.Add("UPDATEFIELD"); dt.Columns.Add("FIELDOLD"); dt.Columns.Add("FIELDNEW"); ChangeAddXtraForm caxf = new ChangeAddXtraForm(); caxf.import = true; caxf.LoadDataByVin(dt.AsDataView()); caxf.Show(); } } catch (Exception ex) { MessageBox.Show("导入失败:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }