Ejemplo n.º 1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        Label1.Visible = false;
        Label2.Visible = false;
        if (!TextBox2.Text.Equals(TextBox3.Text))
        {
            Label2.Visible = true;
            return;
        }
        if (TextBox1.Text.Length < 2 || TextBox2.Text.Length < 2 || TextBox4.Text.Length < 2 || TextBox5.Text.Length < 2 || TextBox6.Text.Length < 2 || TextBox7.Text.Length < 2 || TextBox8.Text.Length < 2)
        {
            Label1.Visible = true;
            return;
        }
        Process.user us = new Process.user();
        us.usename = TextBox1.Text;
        us.pass    = TextBox2.Text;
        us.fn      = TextBox4.Text;
        us.ln      = TextBox5.Text;
        us.email   = TextBox6.Text;
        us.ph      = TextBox7.Text;
        us.gender  = DropDownList1.SelectedItem.ToString();
        us.cn      = TextBox8.ToString();
        us.ulev    = "admin";
        Process pr = new Process();

        pr.adduser(us);
        Response.Redirect("Default.aspx");
    }
Ejemplo n.º 2
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 ";
 }
Ejemplo n.º 3
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>");
        }
    }
Ejemplo n.º 4
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>");
        }
    }
Ejemplo n.º 5
0
 public void ClearTextBoxes()
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     TextBox5.Clear();
     TextBox6.Clear();
     TextBox7.Clear();
     TextBox8.Clear();
     TextBoxID.Clear();
 }
Ejemplo n.º 6
0
 private void TextBox8_Leave(object sender, EventArgs e)
 {
     if (TextBox8.Text == "")
     {
         EP.SetError(TextBox8, "Fill the Test Cell no. first");
         TextBox8.Focus();
     }
     else
     {
         EP.Clear();
     }
 }
Ejemplo n.º 7
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox8.Text == Label3.Text)
        {
            string inte = "";
            int    i    = 0;
            for (i = 0; i < CheckBoxList1.Items.Count; i++)
            {
                if (CheckBoxList1.Items[i].Selected == true)
                {
                    inte = inte + CheckBoxList1.Items[i].Text + ",";
                }
            }

            inte = inte.Substring(0, inte.Length - 1);
            cn.Open();
            cmd.Connection  = cn;
            cmd.CommandText = "insert into Cust_Data values('" + Label1.Text + "','" + TextBox1.Text + "','" + TextBox7.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox6.Text + "','On','" + inte + "')";
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            cn.Close();

            cn.Open();
            cmd.Connection  = cn;
            cmd.CommandText = "insert into Cust_Login values('" + Label1.Text + "','" + TextBox5.Text + "')";
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            cn.Close();

            Label1.Text   = "";
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            TextBox5.Text = "";
            TextBox6.Text = "";
            TextBox7.Text = "";
            TextBox8.Text = "";
            Label3.Text   = "";

            Label2.Text = "Customer Registered Successfully";
        }
        else
        {
            Random r = new Random();
            cap           = r.Next().ToString();
            Label3.Text   = cap;
            Label2.Text   = "Invalid. Try Again";
            TextBox8.Text = "";
            TextBox8.Focus();
        }
    }
Ejemplo n.º 8
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        Label8.Text = "";
        if (TextBox2.Equals("") || TextBox4.Equals("") || TextBox7.Equals("") || TextBox8.Equals(""))
        {
            //do nothing as either student or book has failed some criteria
        }
        else
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            con.Open();

            String     str3 = "select * from card_rules";
            SqlCommand cmd3 = new SqlCommand(str3, con);
            cmd3.ExecuteNonQuery();

            SqlDataAdapter da3 = new SqlDataAdapter();
            da3.SelectCommand = cmd3;

            DataSet ds3 = new DataSet();
            da3.Fill(ds3);

            int        tl   = Convert.ToInt32(ds3.Tables[0].Rows[0]["time_limit"].ToString());
            int        df   = Convert.ToInt32(ds3.Tables[0].Rows[0]["daily_fine"].ToString());
            String     str2 = "SELECT CONVERT (date, SYSDATETIME())";
            SqlCommand cmd2 = new SqlCommand(str2, con);
            cmd2.ExecuteNonQuery();
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd2;
            DataSet ds = new DataSet();
            da.Fill(ds);
            String issuedate = ds.Tables[0].Rows[0][0].ToString();



            String     str = "insert into issuebook values('" + TextBox1.Text + "','" + TextBox3.Text + "','" + TextBox8.Text + "','" + issuedate + "')";
            SqlCommand cmd = new SqlCommand(str, con);
            //cmd.Parameters.AddWithValue("@accno", TextBox1.Text);
            //cmd.Parameters.AddWithValue("@id", TextBox3.Text);
            //cmd.Parameters.AddWithValue("@bname", TextBox8.Text);
            //cmd.Parameters.AddWithValue("@issuedate", issuedate);
            int i = cmd.ExecuteNonQuery();

            if (i == 1)
            {
                Label8.Text = "Book with Accession No: " + TextBox1.Text + " assigned to " + TextBox3.Text + " and you have to return in " + tl + " days otherwise penalty per day: " + df + " Rupees";
            }
            con.Close();
        }
    }
Ejemplo 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;
 }
        private void TextBox7_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            char c = Convert.ToChar(e.Text);

            if (Char.IsControl(c))
            {
                TextBox8.Focus();
                return;
            }
            if (Char.IsLetter(c) || Char.IsSurrogate(c))
            {
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
        }
Ejemplo n.º 11
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();
 }
Ejemplo n.º 12
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();
    }