protected void TextBox9_TextChanged(object sender, EventArgs e) { da = new SqlDataAdapter("select count(uname) from tbl_login where uname='" + TextBox9.Text + "' ", con); ds = new DataSet(); da.Fill(ds, "tbl_login"); if (ds.Tables["tbl_login"].Rows.Count == 1 && ds.Tables["tbl_login"].Rows[0][0].ToString() == "1") { Label17.Text = "Username is not Available."; Label17.ForeColor = System.Drawing.Color.Red; //Label17.BackColor = System.Drawing.Color.Red; TextBox9.Focus(); } else { if (TextBox9.Text != "") { Label17.Text = "Username is Available."; Label17.ForeColor = System.Drawing.Color.Green; //Label17.BackColor = System.Drawing.Color.Green; //TextBox10.Focus(); } else { Label17.Text = "Don't leave User Name field blank."; Label17.ForeColor = System.Drawing.Color.Red; } } }
protected void Button7_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("server=.;uid=sa;pwd=123456;database=cyxy"); SqlCommand cmd = new SqlCommand("select * from account where 用户名='" + Session["username"].ToString() + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows[0]["密码"].ToString() != TextBox8.Text) { Response.Write("<script>alert('原始密码不正确!')</script>"); TextBox8.Focus(); } else if (TextBox9.Text != TextBox10.Text) { Response.Write("<script>alert('两次密码输入不一致!')</script>"); TextBox9.Focus(); } else { SqlCommand cmd1 = new SqlCommand("update account set 密码='" + TextBox9.Text + "'where 用户名='" + Session["username"].ToString() + "'", con); con.Open(); cmd1.ExecuteNonQuery(); con.Close(); Response.Write("<script>alert('密码修改成功!');window.location.href='index.aspx'</script>"); } }
protected void Button7_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("server=.;uid=sa;pwd=123456;database=Web_test"); SqlCommand cmd = new SqlCommand("select * from Admin where admin='" + Session["username"].ToString() + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows[0]["Password"].ToString() != TextBox8.Text) { Response.Write("<script>alert('原始密码不正确!')</script>"); TextBox8.Focus(); } else if (TextBox9.Text != TextBox10.Text) { Response.Write("<script>alert('两次密码输入不一致!')</script>"); TextBox9.Focus(); } else { SqlCommand cmd1 = new SqlCommand("update Admin set Password='******'where admin='" + Session["username"].ToString() + "'", con); con.Open(); cmd1.ExecuteNonQuery(); con.Close(); Response.Write("<script>alert('密码修改成功!')</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { //sql = "Select * From receipt where name = '" + TextBox2.Text + "' and number = '" + TextBox3.Text + "'"; Label4.Visible = Label5.Visible = Label6.Visible = Label7.Visible = Label8.Visible = Label9.Visible = true; TextBox5.Visible = TextBox6.Visible = TextBox7.Visible = TextBox8.Visible = TextBox9.Visible = true; RequiredFieldValidator5.Visible = RequiredFieldValidator6.Visible = RequiredFieldValidator7.Visible = RequiredFieldValidator8.Visible = RequiredFieldValidator9.Visible = true; RequiredFieldValidator5.Visible = true; Button2.Visible = true; Label4.Text = " Enter new receipt"; Label5.Text = " Name: "; TextBox5.Focus(); RequiredFieldValidator5.ControlToValidate = "TextBox5"; RequiredFieldValidator5.ErrorMessage = "* fill Name"; Label6.Text = " Company: "; TextBox6.Focus(); RequiredFieldValidator6.ControlToValidate = "TextBox6"; RequiredFieldValidator6.ErrorMessage = "* fill Company"; Label7.Text = " Number: "; TextBox7.Focus(); RequiredFieldValidator7.ControlToValidate = "TextBox7"; RequiredFieldValidator7.ErrorMessage = "* fill Number"; Label8.Text = " Arrears: "; TextBox8.Focus(); RequiredFieldValidator8.ControlToValidate = "TextBox8"; RequiredFieldValidator8.ErrorMessage = "* fill Arrears"; Label9.Text = " Suma: "; TextBox9.Focus(); RequiredFieldValidator9.ControlToValidate = "TextBox9"; RequiredFieldValidator9.ErrorMessage = "* fill Suma"; Button2.Text = "Ready "; }
protected void TextBox8_TextChanged(object sender, EventArgs e) { TN.DataBind(); GridView8.DataBind(); ShowDDL(); ColorTameio(); TextBox9.Focus(); GridView3.Columns[3].HeaderText = "Ποσό " + FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Descr(Convert.ToDateTime(TextBox8.Text).ToString("yyyy-MM-dd")).ToString(); GridView4.Columns[0].HeaderText = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Descr(Convert.ToDateTime(TextBox8.Text).ToString("yyyy-MM-dd")).ToString(); }
private void TextBox9_Leave(object sender, EventArgs e) { if (TextBox9.Text == "") { EP.SetError(TextBox9, "Fill the first start time first"); TextBox9.Focus(); } else { EP.Clear(); } }
private void TextBox6_Leave(object sender, EventArgs e) { try { TextBox6.TextAlign = HorizontalAlignment.Right; TextBox6.Text = String.Format("{0:###,###.00}", Convert.ToDecimal(TextBox6.Text)); TextBox9.Focus(); } catch { MessageBox.Show("Geçersiz Para Formatı!"); } }
protected void LinkButton12_Click(object sender, EventArgs e) { hide_all(); Panel8.Visible = true; TextBox9.Text = ""; TextBox10.Text = ""; TextBox11.Text = ""; TextBox12.Text = ""; TextBox13.Text = ""; Session["id_polecenia"] = null; Session["id_bazy"] = null; if (GridView6.Rows.Count == 0) { Session["id_polecenia"] = "1"; } TextBox9.Focus(); }
void Fill2() { //For speciality,tel,idDoc SqlCommand command2 = conn.CreateCommand(); command2.CommandText = "select * from Doctors where name=@name"; command2.Parameters.Add("@name", SqlDbType.VarChar, 50).Value = TextBox8.Text; conn.Open(); command2.ExecuteNonQuery(); SqlDataReader dr2 = command2.ExecuteReader(); if (dr2.Read()) { string speciality = (string)dr2["speciality"].ToString(); TextBox9.Text = speciality; string tel = dr2["tel"].ToString(); TextBox10.Text = tel; string id = dr2["idDoc"].ToString(); idDoc.Text = id; conn.Close(); } else { //If doc not found then the user insert a new one SqlCommand command = conn.CreateCommand(); command.CommandText = "insert into Doctors(name) values (@name)"; command.Parameters.AddWithValue("name", TextBox8.Text); command.ExecuteNonQuery(); //Getting idDoc in the invisible textBox SqlCommand cmd2 = conn.CreateCommand(); cmd2.CommandText = "select * from Doctors where name=@name"; cmd2.Parameters.Add("@name", SqlDbType.VarChar, 50).Value = TextBox8.Text; cmd2.ExecuteNonQuery(); SqlDataReader dr3 = cmd2.ExecuteReader(); if (dr3.Read()) { string idDoc2 = dr3["idDoc"].ToString(); idDoc.Text = idDoc2; } TextBox9.Focus(); conn.Close(); } }
private void TextBox8_PreviewTextInput(object sender, TextCompositionEventArgs e) { char c = Convert.ToChar(e.Text); if (Char.IsControl(c)) { TextBox9.Focus(); return; } if (Char.IsLetter(c) || Char.IsSurrogate(c)) { e.Handled = false; } else { e.Handled = true; } }
protected void TextBox8_TextChanged(object sender, EventArgs e) { ColorTameio(); ShowDDL(); if (TextBox128.Text == "0") { GridView4.Visible = false; } else { GridView4.Visible = true; } TextBox130.Text = DateTime.Parse(TextBox8.Text).Year.ToString(); TextBox9.Focus(); // TextBox131.Text = DateTime.ParseExact(TextBox8.Text, "dd/MM/yyyy", CultureInfo.CurrentCulture).ToString("MM/dd/yyyy"); ; }
protected void LinkButton15_Click(object sender, EventArgs e) { if (((string)Session["id_polecenia"] == "2") && (Session["id_bazy"] != null)) { cl.usun_baze_danych((string)Session["id_bazy"]); GridView6.DataBind(); TextBox9.Text = ""; TextBox10.Text = ""; TextBox11.Text = ""; TextBox12.Text = ""; TextBox13.Text = ""; Session["id_polecenia"] = null; Session["id_bazy"] = null; if (GridView6.Rows.Count == 0) { Session["id_polecenia"] = "1"; } TextBox9.Focus(); } }
} //end of zapisywanie specjalizacji protected void GridView6_SelectedIndexChanged(object sender, EventArgs e) { try { TextBox9.Text = GridView6.SelectedDataKey[1].ToString(); TextBox10.Text = GridView6.SelectedDataKey[2].ToString(); TextBox11.Text = GridView6.SelectedDataKey[3].ToString(); TextBox12.Text = GridView6.SelectedDataKey[4].ToString(); TextBox13.Text = GridView6.SelectedDataKey[5].ToString(); Session["id_polecenia"] = "2"; Session["id_bazy"] = GridView6.SelectedDataKey[0].ToString(); string txt = GridView6.SelectedDataKey[6].ToString(); DropDownList4.SelectedIndex = DropDownList4.Items.IndexOf(DropDownList4.Items.FindByValue(GridView6.SelectedDataKey[6].ToString().Trim())); TextBox9.Focus(); } catch { } }
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { TextBox10.Text = Calendar1.SelectedDate.ToShortDateString(); Calendar1.Visible = !Calendar1.Visible; TextBox9.Focus(); }
protected void Button2_Click(object sender, EventArgs e) { string firstName, lastName, id, password, cellPhone, workPhone, cellProvider, category; bool encryption; Label2.Visible = true; string url = TextBox11.Text; if (url == null || url.Length == 0) { Label2.Text = "Enter Valid Url"; TextBox11.Focus(); return; } firstName = TextBox4.Text; if (firstName == null || firstName.Length == 0) { Label2.Text = "Enter First Name"; TextBox4.Focus(); return; } lastName = TextBox5.Text; if (lastName == null || lastName.Length == 0) { Label2.Text = "Enter Last Name"; TextBox5.Focus(); return; } id = TextBox6.Text; if (id == null || id.Length == 0) { Label2.Text = "Enter Id"; TextBox6.Focus(); return; } password = TextBox7.Text; if (password == null || password.Length == 0) { Label2.Text = "Enter Password"; TextBox7.Focus(); return; } workPhone = TextBox8.Text; if (workPhone == null || workPhone.Length == 0) { Label2.Text = "Enter Work Phone"; TextBox8.Focus(); return; } cellPhone = TextBox9.Text; if (cellPhone == null || cellPhone.Length == 0) { Label2.Text = "Enter Cell Phone"; TextBox9.Focus(); return; } cellProvider = TextBox10.Text; /* if (cellProvider == null || cellProvider.Length == 0) * { * Label2.Text = "Enter Cell Provider"; * TextBox10.Focus(); * return; * }*/ category = testSelect.Value; encryption = CheckBox1.Checked; Label2.Visible = true; List <String> data = new List <string>(); Label2.Text = category; data.Add(firstName); data.Add(lastName); data.Add(id); if (encryption) { EncryptionService.ServiceClient encryptSVC = new EncryptionService.ServiceClient(); data.Add(encryptSVC.Encrypt(password)); } else { data.Add(password); } data.Add(workPhone); data.Add(cellPhone); data.Add(category); data.Add(encryption.ToString()); data.Add(cellProvider); XmlService.Service1Client svc = new XmlService.Service1Client(); string response = svc.addPerson(data.ToArray(), url); Label2.Text = response; Button2.Focus(); }
protected void CLS2() { TextBox10.Text = ""; TextBox9.Text = ""; TextBox9.Focus(); }