コード例 #1
0
        private void btnAttachRemove_Click(object sender, EventArgs e)
        {
            //数据准备
            BaseEntity MainEty = MainGrdBind.Current as BaseEntity;

            //删除确认
            IList <VcEffect> Effects = new List <VcEffect>();

            foreach (BaseEntity ety in AttachGrdBind.SelectedObjects)
            {
                ExIList.Append <VcEffect>(this.grpMbrBF.EffectOfReleaseRln(MainEty, ety), Effects);
            }
            if (!ConfirmEffectFm.Confirm(Effects))
            {
                return;
            }

            //删除
            foreach (Object obj in AttachGrdBind.SelectedObjects)
            {
                GrpMbrBF.ReleaseRln(MainEty, obj as BaseEntity);
            }

            //界面更新
            MainGrd_SelectionChanged(sender, e);
        }
コード例 #2
0
        private void tsAttachAdd_Click(object sender, EventArgs e)
        {
            //数据准备
            BaseEntity         MainEty = MainGrdBind.Current as BaseEntity;
            IList <BaseEntity> OldRlns = new List <BaseEntity>();

            ExIList.Append <BaseEntity>(GrpMbrBF.GetRlns(MainEty), OldRlns);
            IList <BaseEntity> NewRlns = new List <BaseEntity>();

            ExIList.Append <BaseEntity>(OldRlns, NewRlns);

            //交互:用户选择
            if (!this.mainDataIsGroup)
            {
                NewRlns = SelectIF.GroupSelectMulti(GrpMbrBF, NewRlns);
                if (NewRlns == null)
                {
                    return;
                }
            }
            else
            {
                NewRlns = SelectIF.MemberSelectMulti(GrpMbrBF, NewRlns);
                if (NewRlns == null)
                {
                    return;
                }
            }

            //删除/增加确认
            IList <VcEffect> Effects = new List <VcEffect>();

            foreach (BaseEntity ety in OldRlns)
            {
                if (!NewRlns.Contains(ety))
                {
                    ExIList.Append <VcEffect>(this.grpMbrBF.EffectOfReleaseRln(MainEty, ety), Effects);
                }
            }
            foreach (BaseEntity ety in NewRlns)
            {
                if (!OldRlns.Contains(ety))
                {
                    ExIList.Append <VcEffect>(this.grpMbrBF.EffectOfCreateRln(MainEty, ety), Effects);
                }
            }
            if (!ConfirmEffectFm.Confirm(Effects))
            {
                return;
            }

            //删除/增加
            foreach (BaseEntity ety in OldRlns)
            {
                if (!NewRlns.Contains(ety))
                {
                    GrpMbrBF.ReleaseRln(MainEty, ety);
                }
            }
            foreach (BaseEntity ety in NewRlns)
            {
                if (!OldRlns.Contains(ety))
                {
                    GrpMbrBF.CreateRln(MainEty, ety);
                }
            }

            //界面更新
            MainGrd_SelectionChanged(sender, e);
        }