protected void master_Page_PreLoad(object sender, EventArgs e) { if (!IsPostBack) { // Set Anti-XSRF token ViewState[AntiXsrfTokenKey] = Page.ViewStateUserKey; ViewState[AntiXsrfUserNameKey] = Context.User.Identity.Name ?? String.Empty; } else { // Validate the Anti-XSRF token if ((string)ViewState[AntiXsrfTokenKey] != _antiXsrfTokenValue || (string)ViewState[AntiXsrfUserNameKey] != (Context.User.Identity.Name ?? String.Empty)) { throw new InvalidOperationException("Validation of Anti-XSRF token failed."); } } var filePaths = Directory.GetFiles(Server.MapPath("~/Committee/Data/")); List<string> files = new List<string>(); foreach (string filePath in filePaths) { files.Add(Path.GetFileNameWithoutExtension(filePath)); } var repo = new CommitteeRepository(); CommitteeMenuRepeater.DataSource = repo.Committees; CommitteeMenuRepeater.DataBind(); }
public static void create(object data) { var committee = typeof(Committee).Transform(data) as Committee; if (committee == null) return; var repo = new CommitteeRepository(); repo.Save(committee); }
/// <summary> /// 建構元 /// </summary> public CommitteeController() { this._cr = new CommitteeRepository(Services.ContentService, Umbraco); }
protected void Page_Init(object sender, EventArgs e) { if (!IsPostBack) { Committee committee = LoadCommittee(); if (committee != null) { CommitteeName.InnerText = committee.CommitteeName; CommitteeDescription.InnerText = committee.Description; ChairPersons.DataSource = committee.ChairPersons; ChairPersons.DataBind(); AttachedFiles.DataSource = committee.AttachedFiles; AttachedFiles.DataBind(); var repo = new CommitteeRepository(); var entries = repo.Get<CommitteeEntry>(true).Local.ToList(); entries.Add(new CommitteeEntry() { EntryTitle = "Here is a new post", EntryBody = "Body body body" }); Entries.DataSource = entries; Entries.DataBind(); Session["entries"] = entries; AttachedFiles.DataSource = committee.AttachedFiles; AttachedFiles.DataBind(); } //Committee committee = LoadCommittee(); } else { } }
public static void SaveChangesToEntry(string val) { var en = new CommitteeRepository(); var c = en.Get<CommitteeEntry>(); }
private Committee LoadCommittee() { string[] values = Request.QueryString.GetValues(HickoryPTASite.Constants.CommitteeQueryStringKey); if (values == null) return null; var committeeName = values.FirstOrDefault(); var repo = new CommitteeRepository(); var committee = repo.Get<Committee>().FirstOrDefault(c => c.CommitteeName == committeeName); return committee; }