public RenameDocumentWindow(Document doc) { InitializeComponent(); this.vm = new RenameDocumentWindowViewModel(doc, this); DataContext = vm; NameText.Focus(); }
private void AddHorseButton_Click(object sender, EventArgs e) { DataClasses.HorseDataClass horse = new DataClasses.HorseDataClass(); if (RaceCore.HorseRacing.CreateHorse(NameText.Text, numerator, denominator, ref horse)) { setHorse(horse); clearFields(); ClearAllButton.Enabled = true; enableRace(); NameText.Focus(); } else { MessageBox.Show("Horse creation failed", "Validation", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public NeuesFahrradDialog() { InitializeComponent(); NameText.Focus(); }
protected void Confirm_Click(object sender, EventArgs e) { if (NameText.Text == "") { Response.Write("<script>alert('用户名不能为空!')</script>"); NameText.Focus(); return; } else if (WordText.Text == "") { Response.Write("<script>alert('密码不能为空!')</script>"); WordText.Focus(); return; } else if (CheckText.Text != checkNum.ToString()) { Response.Write("<script>alert('验证码错误!')</script>"); CheckText.Focus(); return; } string strConn = ConfigurationManager.ConnectionStrings["TSGConnectionString1"].ConnectionString; SqlConnection conn = new SqlConnection(strConn); DataSet ds = new DataSet(); conn.Open(); if (DropDownList1.SelectedValue == "普通读者") { string lendSql = "SELECT * FROM PATRON WHERE PATRONID = \'" + NameText.Text + "\' AND PASSWORD = \'" + WordText.Text + "\'"; SqlCommand lendCmd = new SqlCommand(lendSql, conn); try { SqlDataReader dr = lendCmd.ExecuteReader(); if (dr.Read()) { Response.Redirect("library.aspx"); } else { Response.Write("<script>alert('用户名或密码错误!')</script>"); } } catch { Response.Write("<script>alert('系统错误,请检查输入!')</script>"); } finally { library.figure = "普通读者"; } } else { string lendSql = "SELECT * FROM USERS WHERE USERID = \'" + NameText.Text + "\' AND PASSWORD = \'" + WordText.Text + "\' AND ROLE = \'" + DropDownList1.SelectedValue + "\'"; SqlCommand lendCmd = new SqlCommand(lendSql, conn); try { SqlDataReader dr = lendCmd.ExecuteReader(); if (dr.Read()) { library.figure = DropDownList1.SelectedValue; Response.Redirect("library.aspx"); } else { Response.Write("<script>alert('用户名或密码错误!')</script>"); } } catch (Exception err) { Response.Write("<script>alert('系统错误,请检查输入!')</script>"); } finally { library.figure = DropDownList1.SelectedValue; } } }