using System;
using System.Web.Services;
public partial class Composite_LiveForm_Default : System.Web.UI.Page
{
protected Book book = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
{
this.book = BookRepository.Instance.GetByID(1);
this.txtTitle.Text = this.book.Title;
this.wdcPublishDate.Value = this.book.PublishDate;
}
}
[WebMethod]
public static bool UpdateTitle(int id, string title)
{
try
{
System.Threading.Thread.Sleep(3000);
Book b = BookRepository.Instance.GetByID(id);
b.Title = title;
BookRepository.Instance.Update(b);
return true;
}
catch (Exception ex)
{
// publish exception
System.Diagnostics.Debug.WriteLine(ex.Message);
return false;
}
}
[WebMethod]
public static bool UpdatePublishDate(int id, DateTime publishDate)
{
try
{
System.Threading.Thread.Sleep(3000);
Book b = BookRepository.Instance.GetByID(id);
b.PublishDate = publishDate;
BookRepository.Instance.Update(b);
return true;
}
catch (Exception ex)
{
// publish exception
System.Diagnostics.Debug.WriteLine(ex.Message);
return false;
}
}
}