本文整理汇总了C#中Job.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Job.Save方法的具体用法?C# Job.Save怎么用?C# Job.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job.Save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveNewNewsletter_ClickHandler
void SaveNewNewsletter_ClickHandler(object sender, EventArgs e)
{
string name = txtNewNewsletterName.Text;
string desc = txtNewNewsletterDesc.Text;
if (string.IsNullOrEmpty(name))
ShowError("Name cannot be empty");
// Create and Save
Job newJob = new Job(0, name, desc);
newJob.PageId = CurrentPage.ContentLink.ID;
newJob.Save();
//Redirect to the job page
if (newJob.Id != 0)
/// TODO: This surely cannot work with EPiServer 7.x
Response.Redirect(NewsLetterConfiguration.GetEditPanelLink(newJob));
else
ShowError("Something went wrong saving new job");
}
示例2: ContentEventsOnCreatedContent
private void ContentEventsOnCreatedContent(object sender, ContentEventArgs contentEventArgs)
{
PageData page = contentEventArgs.Content as PageData;
if (page == null)
{
return;
}
var correctBase = page as INewsletterBase;
if (correctBase != null)
{
Job job = Job.LoadByPageId(page.PageLink.ID);
if (job == null)
{
string name = page.PageName;
string desc = string.Empty;
// Create and Save
Job newJob = new Job(page.PageLink.ID, name, desc);
newJob.Save();
}
}
}
示例3: CreateJob
/// <summary>
/// Creates a job.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="description">The description.</param>
/// <returns></returns>
/// <exception cref="Exception">Could not save</exception>
static Job CreateJob(string name, string description)
{
Job job = new Job { Name = name, Description = description };
if (!job.Save())
throw new Exception("Could not save");
return job;
}