private void InitContent() { try { var jo = TableData.TableDataHelper.ReadTable(Enums.TableType.Content); if (jo != null) { JavaScriptSerializer Serializer = new JavaScriptSerializer(); BindingCollection <EBContentTMP> EBContent_ListTMP = Serializer.Deserialize <BindingCollection <EBContentTMP> >(jo["0"].ToString()); BindingCollection <EBContent> EBContent_ListTMP2 = JsonConvert.DeserializeObject <BindingCollection <EBContent> >(jo["1"].ToString()); if (EBContent_ListTMP != null) { foreach (EBContentTMP item in EBContent_ListTMP) { EBContent_AllData tmp = new EBContent_AllData(); tmp.Guid = item.Guid; tmp.SectionName = item.SectionName; tmp.SendState = item.SendState; tmp.EBM_ID = item.EBM_ID; tmp.EBContentList = GetRelateEBContentlist(tmp.Guid, tmp.EBM_ID, EBContent_ListTMP2); EBContent_List_AllData.Add(tmp); } } } } catch (Exception) { throw; } }
/// <summary> /// 更新Section /// </summary> private void UpdateSection() { if (dgvEBContent.SelectedRows.Count > 0) { string EBM_ID = cbBoxEBMId.SelectedValue.ToString(); EBMContentSectionInfo form = new EBMContentSectionInfo(Enums.OperateType.Update, EBM_ID, SelectEBContent_List[dgvEBContent.SelectedRows[0].Index]); DialogResult result = form.ShowDialog(); if (result == DialogResult.OK && form.ContentAllData != null) { SelectEBContent_List[dgvEBContent.SelectedRows[0].Index] = form.ContentAllData; string guid = SelectEBContent_List[dgvEBContent.SelectedRows[0].Index].Guid; EBContent_AllData TobeDel = new EBContent_AllData(); foreach (var item in EBContent_List_AllData) { if (item.Guid == guid) { TobeDel = item; } } if (TobeDel != null) { EBContent_List_AllData.Remove(TobeDel); EBContent_List_AllData.Add(SelectEBContent_List[dgvEBContent.SelectedRows[0].Index]); } } form.Dispose(); } else { MessageBox.Show("未选中任何索引"); } }
private void DelSection() { if (dgvEBContent.SelectedRows.Count > 0) { EBContent_AllData TobeDel = SelectEBContent_List[dgvEBContent.SelectedRows[0].Index]; SelectEBContent_List.RemoveAt(dgvEBContent.SelectedRows[0].Index); string guid = TobeDel.Guid; EBContent_AllData TobeDelNew = new EBContent_AllData(); foreach (var item in EBContent_List_AllData) { if (item.Guid == guid) { TobeDelNew = item; } } if (TobeDelNew != null) { EBContent_List_AllData.Remove(TobeDelNew); } } else { MessageBox.Show("未选中任何索引"); } }
private void dgvEBContent_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex >= 0 && e.RowIndex >= 0) { if (e.ColumnIndex == ColumnSendState.Index) { SelectEBContent_List[e.RowIndex].SendState = !SelectEBContent_List[e.RowIndex].SendState; (MdiParent as EBMMain).InitStreamTable(); } if (e.ColumnIndex == Detail_data.Index) { EBMContentDe detail = new EBMContentDe(SelectEBContent_List[e.RowIndex]); DialogResult result = detail.ShowDialog(); if (result == DialogResult.OK) { SelectEBContent_List[e.RowIndex].EBContentList = detail.EBContent_List; #region 数据更新模块 string guid = SelectEBContent_List[dgvEBContent.SelectedRows[0].Index].Guid; EBContent_AllData TobeDel = new EBContent_AllData(); foreach (var item in EBContent_List_AllData) { if (item.Guid == guid) { TobeDel = item; } } if (TobeDel != null) { EBContent_List_AllData.Remove(TobeDel); EBContent_List_AllData.Add(SelectEBContent_List[dgvEBContent.SelectedRows[0].Index]); } #endregion } detail.Dispose(); } } } catch (Exception ex) { Console.Write(ex.ToString()); } }