Ejemplo n.º 1
0
        internal void CreateMessage(dynamic company, dynamic obj, dynamic defs)
        {
            var            fac   = new DepMessageFactory(null, null);
            List <dynamic> users = new List <dynamic>();

            foreach (dynamic dep in company.Deps)
            {
                users.AddRange(fac.GetUsers(dep).ToArray());
            }
            new MessageFactory(con).CreateMessage(MsgNotifyType.Company, users, obj, defs);
        }
Ejemplo n.º 2
0
        private void makeMessage(dynamic obj, dynamic defs, Soway.Model.SqlCon con, Soway.Model.SqlCon appcon)
        {
            bool IsAddMsg = false;

            if (defs.Defination.NotifyDeps != null && defs.Defination.NotifyDeps.Count > 0)
            {
                IsAddMsg = true;
                var defmessageFac = new DepMessageFactory(this.conFac, con);

                foreach (var dep in defs.Defination.NotifyDeps)
                {
                    defmessageFac.CreateMessage(dep, obj, defs);
                }
            }
            if (defs.Defination.NotifyRoles != null && defs.Defination.NotifyRoles.Count > 0)
            {
                IsAddMsg = true;
                var rolemessageFac = new RoleMessageFactory(this.conFac, con);
                foreach (var role in defs.Defination.NotifyRoles)
                {
                    rolemessageFac.CreateMessage(role, obj, defs);
                }
            }

            if (defs.Defination.NotifyUsers != null && defs.Defination.NotifyUsers.Count > 0)
            {
                IsAddMsg = true;
                var usermessageFac = new UserMessageFacotry(conFac, con);
                usermessageFac.CreateMessage(defs.Defination.NotifyUsers, obj, defs);
            }

            if (defs.Defination.NotifyCompanies != null && defs.Defination.NotifyCompanies.Count > 0)
            {
                IsAddMsg = true;
                var companymessageFac = new CompanyMessageFactory(this.conFac, this.con);
                foreach (var company in defs.Defination.NotifyCompanies)
                {
                    companymessageFac.CreateMessage(company, obj, defs);
                }
            }

            if (IsAddMsg == false)
            {
                var allMessageFac = new AllMessageFac(conFac, con, appcon);
                allMessageFac.CreateMessage(obj, defs);
            }
        }