protected void SaveButton_ServerClick(object sender, EventArgs e)
{
int fid = ListFolderId;
ListInfo list;
using (TransactionScope scope = DataContext.Current.BeginTransaction())
{
int templateId = int.Parse(ddTemplates.SelectedValue);
if (templateId > 0)
{
list = ListManager.CreateListFromTemplate(templateId, fid, ListNameTextBox.Text.Trim(), cbWithData.Checked);
}
else
{
list = ListManager.CreateList(fid, ListNameTextBox.Text.Trim());
}
list.Description = txtDescription.Text;
list.Properties["ListType"].Value = int.Parse(ddType.SelectedValue);
list.Properties["Status"].Value = int.Parse(ddStatus.SelectedValue);
list.Save();
scope.Commit();
}
MetaClass mc = ListManager.GetListMetaClass(list);
string url = String.Format(CultureInfo.InvariantCulture,
"{0}?class={1}",
CHelper.ListAdminPage,
mc.Name);
Response.Redirect(url, true);
}