示例#1
0
 public void DeleteDepartmentGroup(DepartmentGroupEntity Group)
 {
     DataAccess.DeleteDepartmentGroup(Group);
     using (DepartmentPackageDataAccess DeptPackage = new DepartmentPackageDataAccess()) {
         DeptPackage.DeleteDepartmentPackages(Group.ID.DeptID.Value, Group.ID.GroupID.Value);
     }
 }
示例#2
0
        /// <summary>
        /// 保存单位分组明细信息
        /// </summary>
        /// <param name="Group"></param>
        public void SaveDepartmentGroup(DepartmentGroupEntity Group)
        {
            DataAccess.SaveDepartmentGroup(Group);
            DepartmentPackageDataAccess DeptPackage = new DepartmentPackageDataAccess();

            DeptPackage.DeleteDepartmentPackages(Group.ID.DeptID.Value, Group.ID.GroupID.Value);
            using (PackageGroupDataAccess PackageGroup = new PackageGroupDataAccess()) {
                List <PackageGroupViewEntity> PackageGroups = PackageGroup.GetPackageGroups(Group.PackageID.Value);
                var q = from p in PackageGroups
                        select new DepartmentPackageEntity {
                    ID = new DepartmentPackagePK {
                        DeptID      = Group.ID.DeptID,
                        DeptGorupID = Group.ID.GroupID,
                        ItemID      = p.ID.GroupID
                    },
                    Category = "1",        //组合项目
                    Enabled  = true
                };
                List <DepartmentPackageEntity> DeptPackages = q.ToList();
                DeptPackages.Add(new DepartmentPackageEntity {
                    ID = new DepartmentPackagePK {
                        DeptID      = Group.ID.DeptID,
                        DeptGorupID = Group.ID.GroupID,
                        ItemID      = Group.PackageID
                    },
                    Category = "0",//套餐
                    Enabled  = true
                });
                foreach (DepartmentPackageEntity entity in DeptPackages)
                {
                    DeptPackage.SaveDepartmentPackage(entity);
                }
                //DeptPackage.DeleteDepartmentPackage();
            }
        }