/// <summary> /// 添加门禁卡信息 /// </summary> /// <param name="cameraDev"></param> /// <param name="bll"></param> private static void AddDepartmentInfo(DepartmentInfoBackup DepB, Bll bll) { try { Department Dep = GetDepartmentInfo(DepB); bll.Departments.Add(Dep); } catch (Exception e) { Console.WriteLine("Error in DepartmentsBackupHelper.AddDepartmentInfo:" + e.ToString()); } }
/// <summary> /// 添加门禁卡信息 /// </summary> /// <param name="cameraDev"></param> /// <param name="bll"></param> private static bool AddDepartmentInfo(DepartmentInfoBackup DepB, Bll bll) { try { Department Dep = GetDepartmentInfo(DepB); bool r = bll.Departments.Add(Dep); return(r); } catch (Exception e) { Log.Info("Error in DepartmentsBackupHelper.AddDepartmentInfo:" + e.ToString()); return(false); } }
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); }
/// <summary> /// 获取部门信息 /// </summary> /// <param name="dev"></param> /// <returns></returns> private static Department GetDepartmentInfo(DepartmentInfoBackup DepB) { Department Dep = new Department(); if (DepB.Abutment_Id != -1) { Dep.Abutment_Id = DepB.Abutment_Id; } else { Dep.Abutment_Id = null; } Dep.Name = DepB.Name; if (DepB.ParentId != -1) { Dep.ParentId = DepB.ParentId; } else { Dep.ParentId = null; } if (DepB.Abutment_ParentId != -1) { Dep.Abutment_ParentId = DepB.Abutment_ParentId; } else { Dep.Abutment_ParentId = null; } Dep.ShowOrder = DepB.ShowOrder; Dep.Type = DepB.Type; Dep.Description = DepB.Description; return(Dep); }