コード例 #1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5MC_RGR_1144 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();

            var m2g = ORM_HEC_CMT_GroupSubscription.Query.Search(Connection, Transaction, new ORM_HEC_CMT_GroupSubscription.Query()
            {
                Tenant_RefID         = securityTicket.TenantID,
                Membership_RefID     = Parameter.HEC_CMT_MembershipID,
                CommunityGroup_RefID = Parameter.HEC_CMT_CommunityGroupID,
                IsDeleted            = false
            }).Single();

            var query = new ORM_HEC_CMT_OfferedRole.Query();
            query.GlobalPropertyMatchingID = Parameter.GlobalPropertyMatchingID;
            query.IsDeleted    = false;
            query.Tenant_RefID = securityTicket.TenantID;
            var role = ORM_HEC_CMT_OfferedRole.Query.Search(Connection, Transaction, query).Single();

            var r2gs = ORM_HEC_CMT_OfferedRoles_2_GroupSubscription.Query.SoftDelete(Connection, Transaction, new ORM_HEC_CMT_OfferedRoles_2_GroupSubscription.Query()
            {
                Tenant_RefID = securityTicket.TenantID,
                HEC_CMT_GroupSubscription_RefID = m2g.HEC_CMT_GroupSubscriptionID,
                HEC_CMT_OfferedRole_RefID       = role.HEC_CMT_OfferedRoleID,
                IsDeleted = false
            });

            return(returnValue);

            #endregion UserCode
        }
コード例 #2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5MC_UGR_1535 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            var query = new ORM_HEC_CMT_OfferedRole.Query();
            query.GlobalPropertyMatchingID = Parameter.GlobalPropertyMatchingID;
            query.IsDeleted    = false;
            query.Tenant_RefID = securityTicket.TenantID;
            var role = ORM_HEC_CMT_OfferedRole.Query.Search(Connection, Transaction, query).Single();

            var groupMembers = ORM_HEC_CMT_GroupSubscription.Query.Search(Connection, Transaction, new ORM_HEC_CMT_GroupSubscription.Query()
            {
                Tenant_RefID         = securityTicket.TenantID,
                CommunityGroup_RefID = Parameter.HEC_CMT_CommunityGroupID,
                IsDeleted            = false
            }).ToArray();

            foreach (var memberID in Parameter.AddRole_MembersIDs)
            {
                var membAssotiation = groupMembers.Single(s => s.Membership_RefID == memberID);

                var r2gs = ORM_HEC_CMT_OfferedRoles_2_GroupSubscription.Query.Search(Connection, Transaction, new ORM_HEC_CMT_OfferedRoles_2_GroupSubscription.Query()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    HEC_CMT_GroupSubscription_RefID = membAssotiation.HEC_CMT_GroupSubscriptionID,
                    HEC_CMT_OfferedRole_RefID       = role.HEC_CMT_OfferedRoleID,
                    IsDeleted = false
                }).SingleOrDefault();
                if (r2gs == null)
                {
                    r2gs = new ORM_HEC_CMT_OfferedRoles_2_GroupSubscription()
                    {
                        Tenant_RefID = securityTicket.TenantID,
                        AssignmentID = Guid.NewGuid(),
                        HEC_CMT_GroupSubscription_RefID = membAssotiation.HEC_CMT_GroupSubscriptionID,
                        HEC_CMT_OfferedRole_RefID       = role.HEC_CMT_OfferedRoleID
                    };
                    r2gs.Save(Connection, Transaction);
                }
            }

            foreach (var otherMemberID in Parameter.RemoveRole_MembersIDs)
            {
                var membAssotiation = groupMembers.Single(s => s.Membership_RefID == otherMemberID);
                var r2gs            = ORM_HEC_CMT_OfferedRoles_2_GroupSubscription.Query.SoftDelete(Connection, Transaction, new ORM_HEC_CMT_OfferedRoles_2_GroupSubscription.Query()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    HEC_CMT_GroupSubscription_RefID = membAssotiation.HEC_CMT_GroupSubscriptionID,
                    HEC_CMT_OfferedRole_RefID       = role.HEC_CMT_OfferedRoleID,
                    IsDeleted = false
                });
            }



            return(returnValue);

            #endregion UserCode
        }
コード例 #3
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5MC_AGR_1140 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            var query = new ORM_HEC_CMT_OfferedRole.Query();
            query.GlobalPropertyMatchingID = Parameter.GlobalPropertyMatchingID;
            query.IsDeleted    = false;
            query.Tenant_RefID = securityTicket.TenantID;
            var role = ORM_HEC_CMT_OfferedRole.Query.Search(Connection, Transaction, query).Single();


            var m2g = ORM_HEC_CMT_GroupSubscription.Query.Search(Connection, Transaction, new ORM_HEC_CMT_GroupSubscription.Query()
            {
                Tenant_RefID         = securityTicket.TenantID,
                Membership_RefID     = Parameter.HEC_CMT_MembershipID,
                CommunityGroup_RefID = Parameter.HEC_CMT_CommunityGroupID,
                IsDeleted            = false
            }).Single();

            var r2gs = ORM_HEC_CMT_OfferedRoles_2_GroupSubscription.Query.Search(Connection, Transaction, new ORM_HEC_CMT_OfferedRoles_2_GroupSubscription.Query()
            {
                Tenant_RefID = securityTicket.TenantID,
                HEC_CMT_GroupSubscription_RefID = m2g.HEC_CMT_GroupSubscriptionID,
                HEC_CMT_OfferedRole_RefID       = role.HEC_CMT_OfferedRoleID,
                IsDeleted = false
            }).SingleOrDefault();
            if (r2gs == null)
            {
                r2gs = new ORM_HEC_CMT_OfferedRoles_2_GroupSubscription()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    AssignmentID = Guid.NewGuid(),
                    HEC_CMT_GroupSubscription_RefID = m2g.HEC_CMT_GroupSubscriptionID,
                    HEC_CMT_OfferedRole_RefID       = role.HEC_CMT_OfferedRoleID
                };
                r2gs.Save(Connection, Transaction);
            }

            return(returnValue);

            #endregion UserCode
        }
コード例 #4
0
ファイル: DMCommunityRoles.cs プロジェクト: OlafMd/MedCon1.0
        ///<summary>
        /// Get Communication Contact Type for current Tenant from DB or create it if there is no entry
        ///<summary>
        public static Guid Get_CommunityRole_for_GlobalPropertyMatchingID(DbConnection Connection, DbTransaction Transaction, String globalPropertyMatchingID, Guid communityID, SessionSecurityTicket securityTicket)
        {
            var query = new ORM_HEC_CMT_OfferedRole.Query();

            query.GlobalPropertyMatchingID = globalPropertyMatchingID;
            query.IsDeleted    = false;
            query.Tenant_RefID = securityTicket.TenantID;

            var result = ORM_HEC_CMT_OfferedRole.Query.Search(Connection, Transaction, query);

            if (result == null || result.Count() == 0)
            {
                return(Save_CommunityRoleForTenant(Connection, Transaction, globalPropertyMatchingID, communityID, securityTicket));
            }

            if (result.Count() == 1)
            {
                return(result.First().HEC_CMT_OfferedRoleID);
            }
            else
            {
                throw new Exception("Multiple OfferedRole with same \"type\" field are defined in the database!");
            }
        }
コード例 #5
0
        protected static FR_L5MC_JPG_1356 Execute(DbConnection Connection, DbTransaction Transaction, P_L5MC_JPG_1356 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5MC_JPG_1356();
            returnValue.Result = new L5MC_JPG_1356();

            var group = ORM_HEC_CMT_CommunityGroup.Query.Search(Connection, Transaction, new ORM_HEC_CMT_CommunityGroup.Query()
            {
                IsDeleted          = false,
                Tenant_RefID       = securityTicket.TenantID,
                IsPrivate          = true,
                CommunityGroupCode = Parameter.GroupCode
            }).SingleOrDefault();

            if (group != null)
            {
                returnValue.Result.Group = new L5MC_JPG_1356_Group()
                {
                    HEC_CMT_CommunityGroupID = group.HEC_CMT_CommunityGroupID
                };

                var posibleCurrentAssignment = ORM_HEC_CMT_GroupSubscription.Query.Search(Connection, Transaction, new ORM_HEC_CMT_GroupSubscription.Query()
                {
                    Tenant_RefID         = securityTicket.TenantID,
                    IsDeleted            = false,
                    Membership_RefID     = Parameter.HEC_CMT_MembershipID,
                    CommunityGroup_RefID = group.HEC_CMT_CommunityGroupID
                }).ToArray();

                if (posibleCurrentAssignment.Length == 0)
                {
                    var community = ORM_HEC_CMT_Community.Query.Search(Connection, Transaction, new ORM_HEC_CMT_Community.Query()
                    {
                        Tenant_RefID = securityTicket.TenantID,
                        IsDeleted    = false,
                        IsCommunityOperatedByThisTenant = true
                    }).Single();

                    var m2g = new ORM_HEC_CMT_GroupSubscription()
                    {
                        Tenant_RefID                = securityTicket.TenantID,
                        Membership_RefID            = Parameter.HEC_CMT_MembershipID,
                        CommunityGroup_RefID        = group.HEC_CMT_CommunityGroupID,
                        HEC_CMT_GroupSubscriptionID = Guid.NewGuid()
                    };
                    m2g.Save(Connection, Transaction);

                    var query = new ORM_HEC_CMT_OfferedRole.Query();
                    query.GlobalPropertyMatchingID = Parameter.GlobalPropertyMatchingID;
                    query.IsDeleted    = false;
                    query.Tenant_RefID = securityTicket.TenantID;

                    var role = ORM_HEC_CMT_OfferedRole.Query.Search(Connection, Transaction, query).Single();

                    var r2gs = new ORM_HEC_CMT_OfferedRoles_2_GroupSubscription()
                    {
                        Tenant_RefID = securityTicket.TenantID,
                        AssignmentID = Guid.NewGuid(),
                        HEC_CMT_GroupSubscription_RefID = m2g.HEC_CMT_GroupSubscriptionID,
                        HEC_CMT_OfferedRole_RefID       = role.HEC_CMT_OfferedRoleID
                    };
                    r2gs.Save(Connection, Transaction);

                    returnValue.Result.Group.Success = true;
                }
            }

            return(returnValue);

            #endregion UserCode
        }