public JSYD Clone() { JSYD clone = this.MemberwiseClone() as JSYD; return(clone); }
/// <summary> /// 深度克隆 /// </summary> /// <param name="jsyd"></param> /// <returns></returns> public static JSYD Clone(JSYD jsyd) { JSYD clone = jsyd.Clone(); IList <Floor> floors = ReflectManager.ReflectUtils.CloneList(jsyd.Floors); if (floors != null) { foreach (Floor floor in floors) { floor.JSYD = clone; } clone.Floors = floors; } IList <NF> nfs = ReflectManager.ReflectUtils.CloneList(jsyd.NFs); if (nfs != null) { foreach (NF nf in nfs) { nf.JSYD = clone; } clone.NFs = nfs; } ObservableCollection <JTCY> hzs = ReflectManager.ReflectUtils.CloneList(jsyd.HZs); if (hzs != null) { foreach (JTCY hz in hzs) { IList <JTCY> jTCies = ReflectManager.ReflectUtils.CloneList(hz.JTCies); ////设置户主 是同一个引用 for (int a = 0; a < jTCies.Count; a++) { if (jTCies[a].XM == hz.XM) { jTCies[a] = hz; hz.JTCies = jTCies; break; } } } clone.HZs = hzs; } ObservableCollection <JZXInfo> jZXInfos = ReflectManager.ReflectUtils.CloneList(jsyd.JZXInfos); clone.JZXInfos = jZXInfos; ObservableCollection <QZB> qzbs = ReflectManager.ReflectUtils.CloneList(jsyd.QZBs); clone.QZBs = qzbs; return(clone); }
public static void SavejSYDRow(JSYD jsyd, ZJDDataSourceViewModel dataSource) { if (jsyd == null) { return; } IList <JTCY> hzs = jsyd.HZs; if (hzs != null) { Dictionary <int, XMLObject> xmlObjectDic = JTCYCustom.GetWriteExcelXMLTable().CellDic; foreach (JTCY hz in hzs) { foreach (JTCY jtcy in hz.JTCies) { //第三个户主的名称也要更改 ICell cell = jtcy.Row.GetCell(1); if (cell != null && cell.CellType == CellType.String) { cell.SetCellValue(hz.XM); } ExcelWrite.WriteRowObject(jtcy, jtcy.Row, xmlObjectDic); } } UpdateJSYD_HZ(jsyd, hzs[0]); ExcelWrite.Save(hzs[0].Row.Sheet.Workbook, dataSource.JTCYTablePath); } ExcelWrite.WriteRowObject(jsyd, jsyd.Row, GetWriteExcelXMLTable().CellDic); ExcelWrite.Save(jsyd.Row.Sheet.Workbook, dataSource.JSYDTablePath); //农房表不用保存,分层表保存就行 IList <NF> nfs = jsyd.NFs; if (nfs != null) { Dictionary <int, XMLObject> xmlObjectDic = NFCustom.GetWriteExcelXMLTable().CellDic; foreach (NF nf in nfs) { NFCustom.UpdateNF_HZ(nf, hzs[0]); ExcelWrite.WriteRowObject(nf, nf.Row, xmlObjectDic); } } IList <Floor> floors = jsyd.Floors; if (floors != null) { Dictionary <int, XMLObject> xmlObjectDic = FloorCustom.GetWriteExcelXMLTable().CellDic; foreach (Floor floor in floors) { ExcelWrite.WriteRowObject(floor, floor.Row, xmlObjectDic); } ExcelWrite.Save(floors[0].Row.Sheet.Workbook, dataSource.NFTablePath); } }
/// <summary> /// 根据家庭成员更新 建设用地信息 /// </summary> /// <param name="jsyd"></param> /// <param name="jTCY"></param> private static void UpdateJSYD_HZ(JSYD jsyd, JTCY hz) { jsyd.QLRMC = hz.XM; jsyd.ZJHM = hz.GMSFHM; }