protected void Page_Load(object sender, EventArgs e) { this.ShowUser(); this.ControlMenuItems(); if (Session["login"] == null) { Response.Redirect("~/Form/Login.aspx"); } if (!Session["postaveni"].Equals("obec")) { Response.Redirect("~/Default.aspx"); } else { //vlastnik = (IVlastnik)this.GetFactory(DecisionMaker.Items.Vlastnik); this.GetFactory(); vlastnik = DecisionMaker.Vlastnik.CreateVlastnik(); vlastnici = vlastnik.Select(); GridViewVlastnici.DataSource = vlastnici; GridViewVlastnici.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { this.ShowUser(); this.ControlMenuItems(); this.GetFactory(); if (Session["login"] == null) { Response.Redirect("~/Form/Login.aspx"); } vlastnik = DecisionMaker.Vlastnik.CreateVlastnik(); if (Session["postaveni"].Equals("vlastnik")) { int id = int.Parse(Session["id_vlastnika"].ToString()); vlastnici.Add(vlastnik.Select_id(id)); } else { vlastnici = vlastnik.Select(); } //vlastnik = (IVlastnik) this.GetFactory(DecisionMaker.Items.Vlastnik); GridViewVlastnici.DataSource = vlastnici; GridViewVlastnici.DataBind(); }
protected void DetailsViewVlastnici_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { Label vlastnikLiteral = DetailsViewVlastnici.FindControl("IdVlastnika") as Label; if (vlastnikLiteral != null) { int.TryParse(vlastnikLiteral.Text.ToString(), out vlastnikId); } else { vlastnikId = -1; } if (DetailsViewVlastnici.CurrentMode == DetailsViewMode.Edit) { TextBox jmenoText = DetailsViewVlastnici.FindControl("TextJmeno") as TextBox; TextBox prijmeniText = DetailsViewVlastnici.FindControl("TextPrijmeni") as TextBox; Calendar calDatumNarozeni = DetailsViewVlastnici.FindControl("CalDatum_narozeni") as Calendar; Calendar calDatumUmrti = DetailsViewVlastnici.FindControl("CalDatum_umrti") as Calendar; TextBox rodneCisloText = DetailsViewVlastnici.FindControl("TextRodne_cislo") as TextBox; DropDownList pohlaviList = DetailsViewVlastnici.FindControl("ListPohlavi") as DropDownList; TextBox uliceText = DetailsViewVlastnici.FindControl("TextUlice") as TextBox; TextBox cisloPopisneText = DetailsViewVlastnici.FindControl("TextCislo_popisne") as TextBox; TextBox mestoText = DetailsViewVlastnici.FindControl("TextMesto") as TextBox; TextBox PSCText = DetailsViewVlastnici.FindControl("TextPSC") as TextBox; DropDownList aktualnostList = DetailsViewVlastnici.FindControl("ListAktualnost") as DropDownList; konkretniVlastnik.Id_vlastnika = vlastnikId; konkretniVlastnik.Jmeno = jmenoText.Text.ToString(); konkretniVlastnik.Prijmeni = prijmeniText.Text.ToString(); DateTime.TryParse(calDatumNarozeni.SelectedDate.ToShortDateString(), out vlastnikDatumNarozeni); konkretniVlastnik.Datum_narozeni = vlastnikDatumNarozeni; DateTime.TryParse(calDatumUmrti.SelectedDate.ToShortDateString(), out vlastnikDatumUmrti); konkretniVlastnik.Datum_umrti = vlastnikDatumUmrti; konkretniVlastnik.Rodne_cislo = rodneCisloText.Text.ToString(); konkretniVlastnik.Pohlavi = pohlaviList.Text.ToString(); konkretniVlastnik.Trvale_bydliste_ulice = uliceText.Text.ToString(); int.TryParse(cisloPopisneText.Text.ToString(), out vlastnikCisloPopisne); konkretniVlastnik.Trvale_bydliste_cislo_popisne = vlastnikCisloPopisne; konkretniVlastnik.Trvale_bydliste_mesto = mestoText.Text.ToString(); konkretniVlastnik.Trvale_bydliste_PSC = PSCText.Text.ToString(); konkretniVlastnik.Aktualni_vlastnik = aktualnostList.Text.ToString(); DetailsViewVlastnici.ChangeMode(DetailsViewMode.ReadOnly); vlastnik.Update(konkretniVlastnik); DetailsViewVlastnici.DataSource = null; DetailsViewVlastnici.DataBind(); GridViewVlastnici.DataSource = vlastnik.Select(); GridViewVlastnici.DataBind(); GridViewVlastnici.SelectRow(-1); } }
protected void OnPaging(object sender, GridViewPageEventArgs e) { GridViewVlastnici.PageIndex = e.NewPageIndex; GridViewVlastnici.DataBind(); }