当前位置: 首页>>代码示例>>C#>>正文


C# CMSDataContext.SetCurrentOrgId方法代码示例

本文整理汇总了C#中CmsData.CMSDataContext.SetCurrentOrgId方法的典型用法代码示例。如果您正苦于以下问题:C# CMSDataContext.SetCurrentOrgId方法的具体用法?C# CMSDataContext.SetCurrentOrgId怎么用?C# CMSDataContext.SetCurrentOrgId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CmsData.CMSDataContext的用法示例。


在下文中一共展示了CMSDataContext.SetCurrentOrgId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoReplacements

        // this will run replacements in a new dataContext
        //
        public string DoReplacements(int pid, EmailQueueTo emailqueueto)
        {
            using (db = CMSDataContext.Create(connStr, host))
            {
                if (currentOrgId.HasValue)
                    db.SetCurrentOrgId(currentOrgId);
                var p = db.LoadPersonById(pid);
                person = p;
                var pi = emailqueueto.OrgId.HasValue
                    ? (from m in db.OrganizationMembers
                       let ts = db.ViewTransactionSummaries.SingleOrDefault(tt => tt.RegId == m.TranId && tt.PeopleId == m.PeopleId)
                       where m.PeopleId == emailqueueto.PeopleId && m.OrganizationId == emailqueueto.OrgId
                       select new PayInfo
                       {
                           PayLink = m.PayLink2(db),
                           Amount = ts.IndAmt,
                           AmountPaid = ts.IndPaid,
                           AmountDue = ts.IndDue,
                           RegisterMail = m.RegisterEmail
                       }).SingleOrDefault()
                    : null;

                var aa = db.GetAddressList(p);

                if (emailqueueto.EmailQueue.FinanceOnly == true)
                {
                    var contributionemail = (from ex in db.PeopleExtras
                                             where ex.PeopleId == p.PeopleId
                                             where ex.Field == "ContributionEmail"
                                             select ex.Data).SingleOrDefault();
                    if (contributionemail.HasValue())
                        contributionemail = contributionemail.trim();
                    if (!Util.ValidEmail(contributionemail))
                        contributionemail = p.FromEmail;
                    aa.Clear();
                    aa.Add(Util.TryGetMailAddress(contributionemail));
                }

                if (OptOuts != null && emailqueueto.EmailQueue.CCParents == true)
                {
                    var pp = OptOuts.SingleOrDefault(vv => vv.PeopleId == emailqueueto.PeopleId);
                    if(pp != null)
                    {
                        if (pp.HhPeopleId.HasValue && Util.ValidEmail(pp.HhEmail))
                        {
                            aa.Add(new MailAddress(pp.HhEmail, pp.HhName));
                            emailqueueto.Parent1 = pp.HhPeopleId;
                        }
                        if (pp.HhSpPeopleId.HasValue && Util.ValidEmail(pp.HhSpEmail))
                        {
                            aa.Add(new MailAddress(pp.HhSpEmail, pp.HhSpName));
                            emailqueueto.Parent2 = pp.HhSpPeopleId;
                        }
                    }
                }
                if (emailqueueto.AddEmail.HasValue())
                    foreach (var ad in emailqueueto.AddEmail.SplitStr(","))
                        Util.AddGoodAddress(aa, ad);

                if (emailqueueto.OrgId.HasValue && pi != null)
                    Util.AddGoodAddress(aa, Util.FullEmail(pi.RegisterMail, p.Name));

                ListAddresses = aa.DistinctEmails();

                var noreplacements = emailqueueto.EmailQueue.NoReplacements ?? false;
                var texta = new List<string>(stringlist);
                for (var i = 1; i < texta.Count; i += 2)
                    if (noreplacements && !texta[i].StartsWith("<style"))
                        texta[i] = "";
                    else
                        texta[i] = DoReplaceCode(texta[i], p, pi, emailqueueto);

                db.SubmitChanges();
                return string.Join("", texta);
            }
        }
开发者ID:clearfunction,项目名称:bvcms,代码行数:78,代码来源:EmailReplacements.cs

示例2: DoReplacements

        // this will run replacements in a new dataContext
        //
        public string DoReplacements(int pid, EmailQueueTo emailqueueto)
        {
            using (db = CMSDataContext.Create(connStr, host))
            {
                if (currentOrgId.HasValue)
                    db.SetCurrentOrgId(currentOrgId);
                var p = db.LoadPersonById(pid);
                person = p;
                var pi = emailqueueto.OrgId.HasValue
                    ? (from m in db.OrganizationMembers
                       let ts = db.ViewTransactionSummaries.SingleOrDefault(tt => tt.RegId == m.TranId && tt.PeopleId == m.PeopleId)
                       where m.PeopleId == emailqueueto.PeopleId && m.OrganizationId == emailqueueto.OrgId
                       select new PayInfo
                       {
                           PayLink = m.PayLink2(db),
                           Amount = ts.IndAmt,
                           AmountPaid = ts.IndPaid,
                           AmountDue = ts.IndDue,
                           RegisterMail = m.RegisterEmail
                       }).SingleOrDefault()
                    : null;

                var aa = db.GetAddressList(p);
                if (emailqueueto.EmailQueue.CCParents ?? false)
                    aa.AddRange(db.GetCcList(p, emailqueueto));

                if (emailqueueto.AddEmail.HasValue())
                    foreach (var ad in emailqueueto.AddEmail.SplitStr(","))
                        Util.AddGoodAddress(aa, ad);

                if (emailqueueto.OrgId.HasValue && pi != null)
                    Util.AddGoodAddress(aa, Util.FullEmail(pi.RegisterMail, p.Name));

                ListAddresses = aa.DistinctEmails();

                var noreplacements = emailqueueto.EmailQueue.NoReplacements ?? false;
                var texta = new List<string>(stringlist);
                for (var i = 1; i < texta.Count; i += 2)
                    if (noreplacements)
                        texta[i] = "";
                    else
                        texta[i] = DoReplaceCode(texta[i], p, pi, emailqueueto);

                db.SubmitChanges();
                return string.Join("", texta);
            }
        }
开发者ID:peclecl,项目名称:bvcms,代码行数:49,代码来源:EmailReplacements.cs

示例3: Email2

        private void Email2(CMSDataContext db2, IQueryable<Person> q, int queuedBy, string fromAddr, string fromName, string subject,
            string body)
        {
            var from = new MailAddress(fromAddr, fromName);
            q = from p in q
                where p.EmailAddress != null
                where p.EmailAddress != ""
                where (p.SendEmailAddress1 ?? true) || (p.SendEmailAddress2 ?? false)
                select p;
            var tag = db2.PopulateSpecialTag(q, DbUtil.TagTypeId_Emailer);

            Util.IsInRoleEmailTest = TestEmail;
            var queueremail = db2.People.Where(pp => pp.PeopleId == queuedBy).Select(pp => pp.EmailAddress).SingleOrDefault();
            if(!queueremail.HasValue())
                throw new Exception("QueuedBy PeopleId not found in model.Email");
            Util.UserEmail = queueremail;
            db2.SetCurrentOrgId(CurrentOrgId);

            var emailqueue = db2.CreateQueue(queuedBy, from, subject, body, null, tag.Id, false);
            emailqueue.Transactional = Transactional;
            db2.SendPeopleEmail(emailqueue.Id);
        }
开发者ID:GSBCfamily,项目名称:bvcms,代码行数:22,代码来源:Email.cs


注:本文中的CmsData.CMSDataContext.SetCurrentOrgId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。