Exemplo n.º 1
0
    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 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;
            }
        }
    }
Exemplo n.º 3
0
 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 ";
 }
Exemplo n.º 4
0
    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>");
        }
    }
Exemplo n.º 5
0
 public void clear()
 {
     TextBox9.Clear();
     TextBox7.Clear();
     TextBox15.Clear();
     TextBox13.Clear();
     TextBox11.Clear();
     TextBox10.Clear();
     comboBox1.Text = "";
     comboBox2.Text = "";
 }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
 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ı!");
     }
 }
Exemplo n.º 8
0
 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();
     }
 }
Exemplo n.º 9
0
 private void Button3_Click(object sender, EventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     TextBox5.Clear();
     TextBox6.Clear();
     TextBox7.Clear();
     TextBox8.Clear();
     TextBox9.Clear();
     ComboBox1.Items.Clear();
     RadioButton1.Checked = false;
     RadioButton2.Checked = false;
 }
Exemplo n.º 10
0
 public void ClearTextBoxes()
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     TextBox5.Clear();
     TextBox6.Clear();
     TextBox7.Clear();
     TextBox8.Clear();
     TextBox9.Clear();
     TextBox10.Clear();
     TextBox11.Clear();
     TextBox12.Clear();
     TextBoxID.Clear();
 }
Exemplo n.º 11
0
 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();
 }
Exemplo n.º 12
0
        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"); ;
        }
Exemplo n.º 15
0
 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();
     }
 }
Exemplo n.º 16
0
        } //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
            {
            }
        }
Exemplo n.º 17
0
 private void Button2_Click(object sender, EventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     TextBox5.Clear();
     TextBox6.Clear();
     TextBox7.Clear();
     TextBox8.Clear();
     TextBox9.Clear();
     TextBox10.Clear();
     ComboBox1.Text       = "Selecione...";
     ComboBox2.Text       = "Selecione...";
     CheckBox1.Checked    = false;
     CheckBox2.Checked    = false;
     CheckBox3.Checked    = false;
     RadioButton1.Checked = false;
     RadioButton2.Checked = false;
     TextBox1.Focus();
 }
Exemplo n.º 18
0
        private void Listen()
        {
            EndPoint ServerEP = (EndPoint)T.RemoteEndPoint;

            byte[] B     = new byte[1023];
            int    inLen = 0; //接收的位元組數目

            while (true)
            {
                try
                {
                    inLen = T.ReceiveFrom(B, ref ServerEP);//收聽資訊並取得位元組數
                }
                catch (Exception)
                {
                    T.Close();
                    listBox1.Items.Clear();                                                             //清除線上名單
                    MessageBox.Show("伺服器斷線了!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Information); //顯示斷線
                    TextBox5.AppendText("(系統) : 伺服器已斷線了! \r\n");
                    button1.Enabled = true;                                                             //連線按鍵恢復可用
                    Th.Abort();                                                                         //刪除執行緒
                }

                string Msg = Encoding.Default.GetString(B, 0, inLen); //解讀完整訊息
                string St  = Msg.Substring(0, 1);                     //取出命令碼 (第一個字)
                string Str = Msg.Substring(1);                        //取出命令碼之後的訊息
                switch (St)                                           //依命令碼執行功能
                {
                case "L":                                             //接收線上名單
                    listBox1.Items.Clear();                           //清除名單
                    string[] M = Str.Split(',');                      //拆解名單成陣列
                    player = M;
                    for (int i = 0; i < M.Length; i++)
                    {
                        listBox1.Items.Add(M[i]);                                    //逐一加入名單
                    }
                    break;

                case "S":
                    Count--;
                    TextBox9.AppendText(Str + "\r\n");
                    TextBox9.AppendText(DMaster + ": +10" + "\r\n");
                    if (DMaster == User)
                    {
                        user_scro += 10;
                    }
                    break;

                case "D": TextBox5.AppendText("(公開)" + Str + "\r\n"); break;   //聊天室

                case "3": TextBox5.AppendText("(私密)" + Str + "\r\n"); break;   //私密訊息

                case "M": TextBox7.AppendText(Str + "\r\n"); break;

                case "P": PointShape(Str); break;

                case "A": Ans = Str; break;

                case "C": D.Shapes.Clear(); break;

                case "G": Game(); break;

                case "R": metroButton3.Show(); break;
                }
            }
        }
Exemplo n.º 19
0
 protected void CLS2()
 {
     TextBox10.Text = "";
     TextBox9.Text  = "";
     TextBox9.Focus();
 }
 protected void Calendar1_SelectionChanged(object sender, EventArgs e)
 {
     TextBox10.Text    = Calendar1.SelectedDate.ToShortDateString();
     Calendar1.Visible = !Calendar1.Visible;
     TextBox9.Focus();
 }
Exemplo n.º 21
0
    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();
    }