Ejemplo n.º 1
0
        protected void ItemCommand(object o, GridCommandEventArgs e)
        {
            if (e.CommandName == "View")
            {
                CampaignHelper.SelectedTemplateID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"];
                Response.Redirect("Template");
            }

            if (e.CommandName == "NewCampaign")
            {
                CampaignHelper.SelectedTemplateID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"];
                Response.Redirect("New-Campaign");
            }

            if (e.CommandName == RadGrid.InitInsertCommandName)
            {
                Response.Redirect("Template");
            }

            if (e.CommandName == RadGrid.DeleteCommandName)
            {
                var template = new CampaignTemplateRepository().GetByID((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"], false);
                new CampaignTemplateRepository().Delete(template);
            }
        }
Ejemplo n.º 2
0
 private void SaveTemplate(bool isSaveAs)
 {
     if (isSaveAs)
     {
         var template = new CampaignTemplate();
         template.EnteredBy    = SecurityContextManager.Current.CurrentUser.ID;
         template.ChangedBy    = SecurityContextManager.Current.CurrentUser.ID;
         template.Description  = tbDescription.Text;
         template.EmailBody    = reCampaignContent.Content;
         template.EmailSubject = tbSubject.Text;
         template.LastUpdated  = DateTime.Now;
         template.DateCreated  = DateTime.Now;
         template.TemplateName = tbTemplateName.Text;
         new CampaignTemplateRepository().Save(template);
         CampaignHelper.SelectedTemplateID = template.ID;
         LoadTemplate();
     }
     else
     {
         if (CampaignHelper.SelectedTemplateID > 0)
         {
             var template = new CampaignTemplateRepository().GetByID(CampaignHelper.SelectedTemplateID, false);
             template.ChangedBy    = SecurityContextManager.Current.CurrentUser.ID;
             template.Description  = tbDescription.Text;
             template.EmailBody    = reCampaignContent.Content;
             template.EmailSubject = tbSubject.Text;
             template.LastUpdated  = DateTime.Now;
             template.TemplateName = tbTemplateName.Text;
             new CampaignTemplateRepository().SaveOrUpdate(template);
             LoadTemplate();
         }
         else
         {
             var template = new CampaignTemplate();
             template.ChangedBy    = SecurityContextManager.Current.CurrentUser.ID;
             template.Description  = tbDescription.Text;
             template.EmailBody    = reCampaignContent.Content;
             template.EmailSubject = tbSubject.Text;
             template.LastUpdated  = DateTime.Now;
             template.TemplateName = tbTemplateName.Text;
             template.DateCreated  = DateTime.Now;
             template.EnteredBy    = SecurityContextManager.Current.CurrentUser.ID;
             new CampaignTemplateRepository().SaveOrUpdate(template);
             CampaignHelper.SelectedTemplateID = template.ID;
             LoadTemplate();
         }
     }
 }
Ejemplo n.º 3
0
 private void LoadTemplate()
 {
     if (CampaignHelper.SelectedTemplateID > 0)
     {
         var template = new CampaignTemplateRepository().GetByID(CampaignHelper.SelectedTemplateID, false);
         if (template != null)
         {
             tbDescription.Text        = template.Description;
             tbSubject.Text            = template.EmailSubject;
             tbTemplateName.Text       = template.TemplateName;
             reCampaignContent.Content = template.EmailBody;
             lblCreatedBy.Text         = GetUserFullNameByUserID(template.EnteredBy);
             lblLastUpdated.Text       = template.LastUpdated.ToString();
             lblUpdatedBy.Text         = GetUserFullNameByUserID(template.ChangedBy);
         }
     }
 }