예제 #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();
            }
        }
    protected void btnSaveGroup_Click(object sender, EventArgs e)
    {
        DepartmentGroupEntity Result = GetDepartmentGroupUI();

        m_DeptGroup.SaveDepartmentGroup(Result);
        ShowMessage("单位分组数据保存成功!");
        //int Succeed = m_DeptGroup.SaveDepartmentGroup(Result);
        //if (Succeed > 0) ShowMessage("数据保存成功!");
        //if (Succeed < 0) ShowMessage("数据保存失败!");
        //DataBind();
        BindDepartmentGroup(DeptID);
        SetUIState("Default");
    }
    /// <summary>
    /// 从界面获取对象
    /// </summary>
    /// <returns></returns>
    private DepartmentGroupEntity GetDepartmentGroupUI()
    {
        DepartmentGroupEntity Result = new DepartmentGroupEntity();
        DepartmentGroupPK     ID     = new DepartmentGroupPK {
            DeptID = DeptID, GroupID = GroupID
        };

        Result.ID         = ID;
        Result.GroupName  = txtGroupName.Text;
        Result.Sex        = drpSex.SelectedValue;
        Result.IsChildren = chkIsChildren.Checked;
        Result.Duty       = txtDuty.Text;
        Result.Position   = txtPosition.Text;
        Result.PackageID  = EnvConverter.ToInt32(hPackageID.Value);
        return(Result);
    }