Imports Telerik.Web.UI

Public Class GlobalPage_UzivatelNastaveni
	Inherits System.Web.UI.UserControl

	Public sID As String = "" 'ID uzivatele

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

		If sID = "" Then sID = _UserID

		Dim DS As DataTable = DB.ExecuteSelectCommand("Select * FROM [users].[list] WHERE id = '" & sID & "'")
		If DS.Rows.Count = 0 Then
			HttpContext.Current.Response.Redirect(gadrUzivatelSeznam)
		End If
		Dim cRow As DataRow = DS.Rows(0)

		If IsPostBack = False Then

			txtUserName.Text = cRow("username")
			txtPassword.Text = cRow("password")
			txtName.Text = cRow("name")

		End If

	End Sub

#Region "  UDALOSTI  "

	Private Sub cmdSave_Click(sender As Object, e As EventArgs) Handles cmdSave.Click

		DB.ExecuteCommand("UPDATE [users].[list] SET " &
							   "password = '" & _PrevestTextNaBezpecny(txtPassword.Text) & "', " &
							   "name = '" & _PrevestTextNaBezpecny(txtName.Text) & "' " &
							   "WHERE id = '" & sID & "'")

		Response.Redirect(gadrUzivatelSeznam)

	End Sub

	Private Sub cmdStorno_Click(sender As Object, e As EventArgs) Handles cmdStorno.Click

		Response.Redirect(gadrUzivatelSeznam)

	End Sub

#End Region

End Class