示例#1
0
        public Campaign UpdateCampaign(string code, string name, MailFrequency frequency, Newsletter fixedNewsletter,
                                       string dynamicCode, DateTime?startDate, DateTime?endDate, CampaignStatus status,
                                       CampaignType type)
        {
            CampaignDao cd = new CampaignDao(sessionFactoryConfigPath);
            Campaign    c  = cd.GetByCode(applicationName, code);

            if (c != null)
            {
                c.Name            = name;
                c.StartDate       = startDate;
                c.EndDate         = endDate;
                c.DynamicCode     = dynamicCode;
                c.Frequency       = frequency;
                c.FixedNewsletter = fixedNewsletter;
                c.Status          = status;
                c.Type            = type;
                cd.Save(c);
            }

            return(c);
        }
示例#2
0
        public Campaign CreateCampaign(string code, string name, MailFrequency frequency, Newsletter fixedNewsletter,
                                       string dynamicCode, DateTime?startDate, DateTime?endDate, CampaignStatus status,
                                       CampaignType type)
        {
            CampaignDao cd = new CampaignDao(sessionFactoryConfigPath);

            if (cd.GetByCode(applicationName, code) != null)
            {
                throw new ApplicationException(
                          string.Format("There is already a campaign with the code {{{0}}} on the application {{{1}}}", code, applicationName));
            }

            Campaign c = new Campaign();

            c.ApplicationName = applicationName;
            c.Code            = code;
            c.Name            = name;
            c.StartDate       = startDate;
            c.EndDate         = endDate;
            c.DynamicCode     = dynamicCode;
            c.Frequency       = frequency;
            c.FixedNewsletter = fixedNewsletter;
            c.Status          = status;
            c.Type            = type;

            cd.Save(c);

            return(c);
        }