private void SaveBackupDepartmentsInfo(List <Department> Deplst) { DepartmentInfoBackupList backUpList = new DepartmentInfoBackupList(); backUpList.DepList = new List <DepartmentInfoBackup>(); foreach (var item in Deplst) { DepartmentInfoBackup Dep = new DepartmentInfoBackup(); if (item.Abutment_Id != null) { Dep.Abutment_Id = (int)item.Abutment_Id; } else { Dep.Abutment_Id = -1; } Dep.Name = item.Name; if (item.ParentId != null) { Dep.ParentId = (int)item.ParentId; } else { Dep.ParentId = -1; } if (item.Abutment_ParentId != null) { Dep.Abutment_ParentId = (int)item.Abutment_ParentId; } else { Dep.Abutment_ParentId = -1; } Dep.ShowOrder = item.ShowOrder; Dep.Type = item.Type; Dep.Description = item.Description; backUpList.DepList.Add(Dep); } string initFile = InitPaths.GetBackupDepartmentsInfo(); XmlSerializeHelper.Save(backUpList, initFile, Encoding.UTF8); }
private void SaveBackupDepartmentsInfo(List <Department> Deplst) { DepartmentInfoBackupList backUpList = new DepartmentInfoBackupList(); backUpList.DepList = new List <DepartmentInfoBackup>(); foreach (var item in Deplst) { DepartmentInfoBackup Dep = new DepartmentInfoBackup(); if (item.Abutment_Id != null) { Dep.Abutment_Id = (int)item.Abutment_Id; } else { Dep.Abutment_Id = -1; } Dep.Name = item.Name; if (item.ParentId != null) { Dep.ParentId = (int)item.ParentId; } else { Dep.ParentId = -1; } if (item.Abutment_ParentId != null) { Dep.Abutment_ParentId = (int)item.Abutment_ParentId; } else { Dep.Abutment_ParentId = -1; } Dep.ShowOrder = item.ShowOrder; Dep.Type = item.Type; Dep.Description = item.Description; backUpList.DepList.Add(Dep); } string initFile = AppDomain.CurrentDomain.BaseDirectory + "Data\\部门人员门禁卡信息\\BackupDepartmentsInfo.xml"; XmlSerializeHelper.Save(backUpList, initFile, Encoding.UTF8); }