protected void Page_Load(object sender, EventArgs e) { VisitaIglesiaService service = new VisitaIglesiaService(); if (!service.HasExistingData(Auth.user().Id)) { Response.Redirect("VisitaIglesia.aspx"); } if (Request.QueryString["id"] != null) { string id = Request.Params["id"]; List <Models.VisitaIglesia> churches = service.Get(Convert.ToInt32(id)); string script = "var churchUserData = ["; foreach (Models.VisitaIglesia item in churches) { script += item.ToJson() + ","; } if (churches.Count > 0) { char[] separator = { ',' }; script.TrimEnd(separator); } script += "];"; ClientScript.RegisterClientScriptBlock(this.GetType(), "ChurchItems", script, true); } }
public static bool CheckUserHasExistingData() { VisitaIglesiaService service = new VisitaIglesiaService(); var hasData = service.HasExistingData(Auth.user().Id); return(hasData); }
public void SaveChurches_Click(object sender, EventArgs e) { VisitaIglesiaService service = new VisitaIglesiaService(); var hasData = service.HasExistingData(Auth.user().Id); if (hasData) { Page.ClientScript.RegisterStartupScript(this.GetType(), "CallUserHasExistingData", "UserHasExistingData()", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "CallUserHasNoExistingData", "UserHasNoExistingData()", true); } }