//修改变更申请 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(String.Format("每次只能操作一条记录,您选择了{0}条!", 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(String.Format("每次只能操作一条记录,您选择了{0}条!", checkList.Count), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void repositoryItemButtonEdit2ButtonClick(object sender, EventArgs e) { try { DevExpress.XtraGrid.Views.Grid.GridView view = ((DevExpress.XtraGrid.Views.Grid.GridView)(this.dgvCtny.MainView)); int rowhandle = view.FocusedRowHandle; DataRow dr = view.GetDataRow(rowhandle); string ID = dr["ID"].ToString(); ChangeAddXtraForm caxf = new ChangeAddXtraForm(ID); caxf.simpleButton4_Click(sender, e); caxf.Dispose(); } catch (Exception ex) { MessageBox.Show("发送失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//添加 private void simpleButton4_Click(object sender, EventArgs e) { DataView dv = GetCheckData(); if (dv != null && dv.Table.Rows.Count > 0) { ChangeAddXtraForm caxf = (ChangeAddXtraForm)this.Owner; caxf.LoadDataByVin(dv); if (MessageBox.Show("添加成功,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes) { this.Close(); } } else { MessageBox.Show("请选择要操作的数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void barButtonItem8_ItemClick(object sender, ItemClickEventArgs e) { OpenFileDialog ofd = new OpenFileDialog() { 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", System.Type.GetType("System.String")); dt.Columns.Add("FIELDOLD", System.Type.GetType("System.String")); dt.Columns.Add("FIELDNEW", System.Type.GetType("System.String")); dt.Columns.Add("DID", System.Type.GetType("System.String")); dt.Columns["DID"].SetOrdinal(0); dt.Columns["APPLYTYPE"].SetOrdinal(12); ChangeAddXtraForm caxf = new ChangeAddXtraForm(); caxf.import = true; caxf.LoadDataByVin(dt.AsDataView()); caxf.Show(); } } catch (Exception ex) { MessageBox.Show("导入失败:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
//新增变更申请 private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e) { ChangeAddXtraForm caxf = new ChangeAddXtraForm(); caxf.ShowDialog(); }