private DataTable GetPinsInfo(List <LineFoot> footList) { DataTable dt = new DataTable(); DataColumn dc = new DataColumn("footName"); dt.Columns.Add(dc); dc = new DataColumn("footType"); dt.Columns.Add(dc); dc = new DataColumn("innerIdx"); dt.Columns.Add(dc); dc = new DataColumn("idx"); dt.Columns.Add(dc); foreach (LineFoot item in footList) { LineFootView itemTmp = pinsList.Find(itmp => itmp.Element == this.element.InnerIdx && itmp.Foot == item.Idx); DataRow dr = dt.NewRow(); dr["idx"] = item.Idx; dr["innerIdx"] = item.InnerIdx; dr["footName"] = itemTmp.Idx > 0 ? itemTmp.PinsName : item.Name; dr["footType"] = ((enumPinsType)(itemTmp.Idx > 0 ? itemTmp.PinsType : item.PinsType)).ToString(); dt.Rows.Add(dr); } return(dt); }
private void dgvFoots_CellEndEdit(object sender, DataGridViewCellEventArgs e) { DataGridView objData = sender as DataGridView; LineFootView item = new LineFootView() { Element = this.element.InnerIdx, Foot = Convert.ToInt32(objData.Rows[e.RowIndex].Cells["idx"].Value), PinsName = objData.Rows[e.RowIndex].Cells["footName"].Value.ToString(), PinsType = (enumPinsType)Enum.Parse(typeof(enumPinsType), objData.Rows[e.RowIndex].Cells["footType"].Value.ToString()) }; this.updateFootsInfo(item); }