Пример #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            baglanti();
            if (TextBox3.Text == "" || TextBox4.Text == "")
            {
                MessageBox.Show("Barkod Numarası ve Tanım alanlarını doldurunuz.", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            OleDbCommand cmd = new OleDbCommand("INSERT INTO BARKOD(BarkodNo,Tanim,StokKodu) Values('" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox1.Text + "')", bag);

            cmd.ExecuteNonQuery();
            MessageBox.Show("Veritabanına Kaydedildi.", "İŞLEM TAMAM", MessageBoxButtons.OK, MessageBoxIcon.Information);
            DataGridView1.Rows.Clear();
            TextBox3.Clear();
            TextBox4.Clear();
            cmd = new OleDbCommand("SELECT * FROM BARKOD ORDER BY BarkodNo ASC", bag);
            OleDbDataReader oku = cmd.ExecuteReader();

            while (oku.Read())
            {
                DataGridView1.Rows.Add(oku[0].ToString(), oku[1].ToString());
            }

            oku.Close();
        }
Пример #2
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            try
            {
                string DBHost     = "127.0.0.1";
                string DBName     = "base";
                string DBUserName = "******";
                string DBPassword = "******";

                string Conn_String = "server=" + DBHost + ";uid=" + DBUserName + ";password="******";database=" + DBName + ";";


                MySqlConnection Conn = new MySqlConnection(Conn_String);
                Conn.Open();

                name  = DropDownList1.Text;
                topic = TextBox2.Text;
                dat   = TextBox3.ToString();
                MySqlCommand cmd;
                cmd = new MySqlCommand("insert into preacher(name,date,topic) values('" + DropDownList1.Text + "','" + TextBox3.Text + "','" + TextBox2.Text + "')", Conn);
                cmd.ExecuteNonQuery();
                Conn.Close();
            }

            catch (Exception ex)
            {
                Label1.Text = ex.ToString();
            }
            Calendar1.Visible = false;
        }
Пример #3
0
        private void Button2_Click(object sender, EventArgs e)
        {
            DialogResult g;

            g = MessageBox.Show(DataGridView1.CurrentRow.Cells[0].Value + " nolu Barkod Kodu silinecek. Emin misiniz?", "DİKKAT", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
            if (g == DialogResult.Yes)
            {
                OleDbCommand cmd = new OleDbCommand("DELETE FROM BARKOD WHERE BarkodNo=" + Convert.ToInt32(DataGridView1.CurrentRow.Cells[0].Value), bag);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Barkod veritabanından silindi.", "İŞLEM TAMAM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DataGridView1.Rows.Clear();
                TextBox3.Clear();
                TextBox4.Clear();
                cmd = new OleDbCommand("SELECT * FROM BARKOD ORDER BY BarkodNo ASC", bag);
                OleDbDataReader oku = cmd.ExecuteReader();
                while (oku.Read())
                {
                    DataGridView1.Rows.Add(oku[0].ToString(), oku[1].ToString());
                }
                oku.Close();
            }
            else
            {
                return;
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            sql = "Select * From receipt";
            NpgsqlDataAdapter dat = new NpgsqlDataAdapter(sql, WebForm3.conn);
            DataSet           ds  = new DataSet();

            dat.Fill(ds);
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();

            dat.Dispose();
            Label1.Text = " Enter name of user and number of receipt which you whant to edit, please";
            Label2.Text = "Name: ";
            TextBox2.Focus();
            RequiredFieldValidator2.ControlToValidate = "TextBox2";
            RequiredFieldValidator2.ErrorMessage      = "* fill Name";

            Label3.Text = "Number: ";
            TextBox3.Focus();
            RequiredFieldValidator3.ControlToValidate = "TextBox3";
            RequiredFieldValidator3.ErrorMessage      = "* fill Number";
            Button1.Text     = "Edit";
            Button2.Visible  = false;
            Label4.Visible   = Label5.Visible = Label6.Visible = Label7.Visible = Label8.Visible = Label9.Visible = false;
            TextBox5.Visible = TextBox6.Visible = TextBox7.Visible = TextBox8.Visible = TextBox9.Visible = false;
            RequiredFieldValidator5.Visible = RequiredFieldValidator6.Visible = RequiredFieldValidator7.Visible = RequiredFieldValidator8.Visible = RequiredFieldValidator9.Visible = false;
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         TextBox3.Focus();
     }
 }
 protected void btnExcel2_Click(object sender, EventArgs e)
 {
     Label3.Visible = false;
     try
     {
         string reportname = TextBox3.Text;
         FpSpread1.Columns[4].Visible = false;
         if (reportname.ToString().Trim() != "")
         {
             if (FpSpread1.Visible == true)
             {
                 da.printexcelreport(FpSpread1, reportname);
             }
             Label3.Visible = false;
         }
         else
         {
             Label3.Text    = "Please Enter Your Report Name";
             Label3.Visible = true;
             TextBox3.Focus();
         }
         FpSpread1.Columns[4].Visible = true;
     }
     catch
     {
     }
 }
Пример #7
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (TextBox1.Text.Trim().Length == 0)
     {
         MessageBox.Show("Bạn phải nhập Tác Giả!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TextBox1.Focus();
         return;
     }
     if (TextBox2.Text.Trim().Length == 0)
     {
         MessageBox.Show("Bạn phải nhập Tên Tác Giả!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TextBox2.Focus();
         return;
     }
     if (TextBox3.Text.Trim().Length == 0)
     {
         MessageBox.Show("Bạn phải nhập Email!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TextBox3.Focus();
         return;
     }
     if (MessageBox.Show("Bạn có muốn Xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         SqlConnection con = new SqlConnection("Data Source=ADMIN\\VIEWSOINC;Initial Catalog=Gioithieutintuc;Integrated Security=True");
         SqlCommand    cmd = new SqlCommand("delete from TacGia  where TacGiaID='" + TextBox1.Text + "'", con);
         con.Open();            // mo ket noi
         cmd.ExecuteNonQuery(); // thuc thi
         con.Close();
         Loadbang();
         txbhienthi.Text = "Bạn đã xoá thành công!";
     }
 }
Пример #8
0
        protected void TextBox3_TextChanged(object sender, EventArgs e)
        {
            try
            {
                ConnectDB cdb = new ConnectDB();
                cdb.connectDataBase();
                SqlConnection con = cdb.connect;
                con.Open();
                SqlCommand com = cdb.command;

                com.CommandText = "SELECT user_id from [dbo].[user] where email =@email and role_name=@role_name";
                com.Parameters.AddWithValue("@email", TextBox3.Text);
                com.Parameters.AddWithValue("@role_name", DropDownList1.SelectedItem.Text);

                SqlDataReader rdr;
                rdr = com.ExecuteReader();
                if (rdr.Read())
                {
                    Label8.Visible = true;
                    TextBox3.Text  = "";
                    TextBox3.Focus();
                }
                else
                {
                    Label8.Visible = false;
                    TextBox4.Focus();
                }
                con.Close();
            }
            catch (Exception exc)
            {
                Response.Redirect("Error.aspx");
            }
        }
Пример #9
0
        protected void TextBox2_TextChanged(object sender, EventArgs e)
        {
            try
            {
                ConnectDB cdb = new ConnectDB();
                cdb.connectDataBase();
                SqlConnection con = cdb.connect;
                con.Open();
                SqlCommand com = cdb.command;

                com.CommandText = "SELECT user_id from [dbo].[user] where user_id =@user_id UNION SELECT user_id from [dbo].[temp_user] where user_id =@user_id";
                com.Parameters.AddWithValue("@user_id", TextBox2.Text);

                SqlDataReader rdr;
                rdr = com.ExecuteReader();
                if (rdr.Read())
                {
                    TextBox2.Text  = "";
                    Label7.Visible = true;
                    TextBox2.Focus();
                }
                else
                {
                    Label7.Visible = false;
                    TextBox3.Focus();
                }
                rdr.Close();
                con.Close();
            }
            catch (Exception exc)
            {
                Response.Redirect("Error.aspx");
            }
        }
Пример #10
0
 private void TextBox2_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         TextBox3.Focus();
     }
 }
Пример #11
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int result;

            if (Page.IsPostBack == true)
            {
                if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "" || Calendar1.SelectedDate == null || DropDownList1.SelectedValue == "Select")
                {
                    Label2.Text = "Fields can't be empty !!";
                    TextBox3.Focus();
                }
                else
                {
                    SqlConnection con1 = new SqlConnection();
                    con1.ConnectionString = ConfigurationManager.ConnectionStrings["GAIL"].ConnectionString;
                    con1.Open();
                    string     query = "insert into Queries values('" + TextBox1.Text + "','" + DropDownList1.Text + "','" + TextBox3.Text + "','" + Calendar1.SelectedDate + "','" + TextBox2.Text + "')";
                    SqlCommand cmd   = new SqlCommand(query, con1);
                    result = cmd.ExecuteNonQuery();
                    if (result > 0)
                    {
                        Label2.Text = "Query Submited we ll try to respond soon :)";
                    }
                    else
                    {
                        Label2.Text = "Please try Again :(";
                    }
                    con1.Close();
                }
            }
        }
Пример #12
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string n   = TextBox1.Text;
            string a   = TextBox2.Text;
            string mn  = TextBox3.Text;
            string ei  = TextBox4.Text;
            string p   = TextBox5.Text;
            string cp  = TextBox6.Text;
            string age = TextBox7.Text;

            string dob = TextBox8.Text;

            RegisterClass rc = new RegisterClass();
            //string res = rc.saveRegistration(n, a, mn, ei, p, cp, age, dob);

            string res1 = rc.checkemailid(ei);

            if (res1 == "false")
            {
                string res = rc.saveregistration(n, a, mn, ei, p, cp, a, dob);
                Label1.Text = res;
                Response.Redirect("signup1.aspx?email=" + ei);
            }
            else
            {
                Label1.Text   = "User with this email id already exists, please use some other emailid";
                TextBox3.Text = "";
                TextBox3.Focus();
            }
        }
Пример #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (User.Identity.IsAuthenticated)
            {
                SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]);
                SqlCommand    cmd = new SqlCommand("select * from user_details where Name='" + User.Identity.Name + "'", con);
                SqlDataReader dr;
                con.Open();
                dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    company_id = Convert.ToInt32(dr["com_id"].ToString());
                }
                con.Close();
            }

            TextBox3.Focus();
            this.Form.DefaultButton = Button1.UniqueID;

            getinvoiceno();
            show_category();
            showrating();
            BindData();

            active();
            created();
        }
    }
Пример #14
0
 private void temizle()
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
 }
Пример #15
0
        private void Button2_Click(object sender, EventArgs e)
        {
            if (c.cnn.State == ConnectionState.Open)
            {
                c.cnn.Close();
            }
            c.cnn.Open();

            if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "")
            {
                MessageBox.Show("Fill the form properly", "Reset", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                sqlcom             = c.cnn.CreateCommand();
                sqlcom.CommandText = "select * from adlogin where AdmName='" + TextBox1.Text + "' and APassword='******'";
                sqldr = sqlcom.ExecuteReader();
                if (sqldr.Read())
                {
                    if (c.cnn.State == ConnectionState.Open)
                    {
                        c.cnn.Close();
                    }
                    c.cnn.Open();
                    sqlcom             = c.cnn.CreateCommand();
                    sqlcom.CommandText = "update adlogin set APassword='******' where AdmName='" + TextBox1.Text + "'";
                    sqldr = sqlcom.ExecuteReader();

                    TextBox1.Clear();
                    TextBox2.Clear();
                    TextBox3.Clear();
                }
            }
        }
Пример #16
0
        public MainWindow()
        {
            InitializeComponent();
            TextBox1.SetBinding(TextBox.TextProperty, new Binding("[0]")
            {
                Source = mode.NamesList, Mode = BindingMode.OneWay
            });
            TextBox2.SetBinding(TextBox.TextProperty, new Binding("[2]")
            {
                Source = mode.NamesList, Mode = BindingMode.OneWay
            });
            TextBox3.SetBinding(TextBox.TextProperty, new Binding("[2].Length")
            {
                Source = mode.NamesList, Mode = BindingMode.OneWay
            });

            TextBox4.SetBinding(TextBox.TextProperty, new Binding("[0]")
            {
                Source = mode.Ctry.Province[0].City[0].Person[0].name, Mode = BindingMode.OneWay
            });
            TextBox5.SetBinding(TextBox.TextProperty, new Binding("[1]")
            {
                Source = mode.Ctry.Province[0].City[0].Person[0].name, Mode = BindingMode.OneWay
            });
            TextBox6.SetBinding(TextBox.TextProperty, new Binding("[2]")
            {
                Source = mode.Ctry.Province[0].City[0].Person[0].name, Mode = BindingMode.OneWay
            });
        }
Пример #17
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox5.Text.Equals(TextBox4.Text) == false)
        {
            Label1.Text   = "⚠ Passwords don't match...";
            TextBox4.Text = "";
            TextBox5.Text = "";
            TextBox4.Focus();
            return;
        }

        if (checkEmailAvailability() == false)
        {
            Label1.Text   = "⚠ E-mail already taken...";
            TextBox3.Text = "";
            TextBox3.Focus();
            return;
        }

        openConnection();

        cmd.CommandText = "INSERT into UserInfo (FirstName,LastName,email,password) values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "')";
        if (cmd.ExecuteNonQuery() >= 1)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Your account has been created.');window.location ='Login.aspx';", true);
            //Response.Redirect("Login.aspx");
        }
        else
        {
            Label1.Text = "⚠ Cannot Signup";
        }

        con.Close();
    }
        private void TextBox3_TextChanged(object sender, TextChangedEventArgs e)
        {
            string mensaje = "";

            for (int i = 0; i < TextBox3.Text.Length; i++)
            {
                if (TextBox3.Text[i] != 'a' &&
                    TextBox3.Text[i] != 'A' &&
                    TextBox3.Text[i] != 'e' &&
                    TextBox3.Text[i] != 'E' &&
                    TextBox3.Text[i] != 'i' &&
                    TextBox3.Text[i] != 'I' &&
                    TextBox3.Text[i] != 'o' &&
                    TextBox3.Text[i] != 'O' &&
                    TextBox3.Text[i] != 'u' &&
                    TextBox3.Text[i] != 'U')
                {
                    mensaje += TextBox3.Text[i].ToString();
                }
            }

            //El primer dígito es para saber si escribre antes del cursor = 0 o si escribe después del cursor mensaje.length (como se escribre normalmente)
            //El segundo dígito es para la anchura del cursor, es decir, 0, cursor normal, >0 entonces se solapa el ancho del cursor con el texto, sale el cursor de "sobreescribir"
            TextBox3.Select(mensaje.Length, 0);
            TextBox3.Text = mensaje;
        }
Пример #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TextBox3.Focus();


            getinvoiceno();
            show_category();

            BindData();

            active();
            created();
            if (User.Identity.IsAuthenticated)
            {
                SqlConnection con1000 = new SqlConnection(ConfigurationManager.AppSettings["connection"]);
                SqlCommand    cmd1000 = new SqlCommand("select * from user_details where company_name='" + User.Identity.Name + "'", con1000);
                SqlDataReader dr1000;
                con1000.Open();
                dr1000 = cmd1000.ExecuteReader();
                if (dr1000.Read())
                {
                    company_id = Convert.ToInt32(dr1000["com_id"].ToString());
                }
                con1000.Close();
            }
        }
    }
Пример #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Page.Title       = "Insert";
     Page.Form.Method = "post";
     Label1.Text      = "Add a receipt ";
     Label2.Text      = "Name"; Label3.Text = "Company";
     Label4.Text      = "Number"; Label5.Text = "Arrears";
     Label6.Text      = "Suma";
     TextBox2.Focus();
     TextBox3.Focus();
     TextBox4.Focus();
     TextBox5.Focus();
     TextBox6.Focus();
     Button1.Text   = "Ready";
     Button1.Width  = 125;
     TextBox2.Width = 140;
     RequiredFieldValidator2.ControlToValidate = "TextBox2";
     RequiredFieldValidator2.ErrorMessage      = "* fill Name";
     RequiredFieldValidator3.ControlToValidate = "TextBox3";
     RequiredFieldValidator3.ErrorMessage      = "* fill Company ";
     RequiredFieldValidator4.ControlToValidate = "TextBox4";
     RequiredFieldValidator4.ErrorMessage      = "* fill  Number";
     RequiredFieldValidator5.ControlToValidate = "TextBox5";
     RequiredFieldValidator5.ErrorMessage      = "* fill Arrears";
     RequiredFieldValidator6.ControlToValidate = "TextBox6";
     RequiredFieldValidator6.ErrorMessage      = "* fill Suma";
 }
Пример #21
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            {
                Response.Write("<script>alert('Please insert Name.');</script>");
                TextBox1.Focus();
            }
            else if (TextBox2.Text == "")
            {
                Response.Write("<script>alert('Please insert Contact Number');</script>");
                TextBox2.Focus();
            }

            else if (TextBox3.Text == "")
            {
                Response.Write("<script>alert('Please insert E-mail');</script>");
                TextBox3.Focus();
            }
            else if (TextBox4.Text == "")
            {
                Response.Write("<script>alert('Please insert Confirm E-mail');</script>");
                TextBox4.Focus();
            }
            else if (TextBox3.Text != TextBox4.Text)
            {
                Response.Write("<script>alert('Email is not same with Confirm Email. Please insert again.');</script>");
                TextBox4.Focus();
            }
            else
            {
                Response.Write("<script>alert('Payment is complete.');</script>");
            }
        }
Пример #22
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         string        Name   = TextBox2.Text.Trim();
         string        paw    = TextBox3.Text.Trim();
         SqlDataReader UserDr = UserManager.Login(Name, paw);
         if (UserDr.Read())
         {
             Session["UserName"] = TextBox2.Text;
             Session["UserID"]   = UserDr["UserID"].ToString();
             Response.Redirect("index.aspx");
             lblResult.Text = "登陆成功";
         }
         else
         {
             lblResult.Text = "啊哦~用户名或者密码错误";
             TextBox3.Text  = "";
             TextBox3.Focus();
         }
     }
     catch (Exception ex)
     {
         Response.Write("错误原因:" + ex);
     }
 }
Пример #23
0
        //private void TextBox2_Leave(object sender, EventArgs e)
        //{
        //    Check_AlarmStatus();
        //    TextBox2.SelectAll();
        //}

        //private void TextBox3_Leave(object sender, EventArgs e)
        //{
        //    Check_AlarmStatus();
        //    TextBox3.SelectAll();
        //}

        //private void TextBox4_Leave(object sender, EventArgs e)
        //{
        //    Check_AlarmStatus();
        //    TextBox4.SelectAll();
        //}


        private void Check_AlarmStatus()
        {
            try
            {
                if (TextBox1.BackColor != Color.LightGray)
                {
                    if ((TextBox1.Text.Substring(0, 1).ToUpper() != "I") && (TextBox1.Text.Substring(0, 1).ToUpper() != "O"))
                    {
                        MessageBox.Show("Please select the \'Alarm\' Status for Lower set Low !");
                        TextBox1.ContextMenuStrip = contextMenuStrip2;
                        TextBox1.Focus();
                        TextBox1.ContextMenuStrip.Show(TextBox1, new Point(0, TextBox1.Height)); //, ToolStripDropDownDirection.BelowRight);
                        return;
                    }
                }

                if (TextBox4.BackColor != Color.LightGray)
                {
                    if ((TextBox4.Text.Substring(0, 1).ToUpper() != "I") && (TextBox4.Text.Substring(0, 1).ToUpper() != "O"))
                    {
                        MessageBox.Show("Please select the \'Alarm\' Status for Lower set Low !");
                        TextBox4.ContextMenuStrip = contextMenuStrip2;
                        TextBox4.Focus();
                        TextBox4.ContextMenuStrip.Show(TextBox4, new Point(0, TextBox4.Height)); //, ToolStripDropDownDirection.BelowRight);
                        return;
                    }
                }

                // ******************//Check Alarm Status.... A

                if (TextBox2.BackColor != Color.LightGray)
                {
                    if (TextBox2.Text.Substring(0, 1).ToUpper() != "A")
                    {
                        MessageBox.Show("Please select the \'Alarm\' Status for Lower set Low !");
                        TextBox2.ContextMenuStrip = contextMenuStrip2;
                        TextBox2.Focus();
                        TextBox2.ContextMenuStrip.Show(TextBox2, new Point(0, TextBox2.Height)); //, ToolStripDropDownDirection.BelowRight);
                        return;
                    }
                }
                if (TextBox3.BackColor != Color.LightGray)
                {
                    if (TextBox3.Text.Substring(0, 1).ToUpper() != "A")
                    {
                        MessageBox.Show("Please select the \'Alarm\' Status for Lower set Low !");
                        TextBox3.ContextMenuStrip = contextMenuStrip2;
                        TextBox3.Focus();
                        TextBox3.ContextMenuStrip.Show(TextBox3, new Point(0, TextBox2.Height)); //, ToolStripDropDownDirection.BelowRight);
                        return;
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Check_AlarmStatus @ Error Code:-7007 " + ex.Message);
            }
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     TextBox3.Focus();                                                          //將游標指定在密碼位置
     System.Windows.Input.InputMethod.SetIsInputMethodEnabled(TextBox3, false); //設置IME和輸入是否可以是中文
     System.Windows.Input.InputMethod.SetIsInputMethodEnabled(TextBox4, false); //設置IME和輸入是否可以是中文
     System.Windows.Input.InputMethod.SetIsInputMethodEnabled(TextBox6, false); //設置IME和輸入是否可以是中文
     //startupUI();
 }
Пример #25
0
 private void button9_Click(object sender, EventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     textBox5.Clear();
 }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["FinanceDBConnectionString1"].ConnectionString);

        SqlCommand cmd1 = new SqlCommand();

        cmd1.CommandText = "Select Userid from User_Registration_Form";

        cmd1.Connection = con1;

        con1.Open();
        cmd1.ExecuteNonQuery();
        SqlDataReader dr = cmd1.ExecuteReader();

        while (dr.Read())
        {
            if (TextBox1.Text == "")
            {
                Response.Write("<script>alert('Please input User ID')</script>");
                TextBox1.Focus();
            }


            else if (TextBox3.Text == "")
            {
                Response.Write("<script>alert('Please input New password')</script>");
                TextBox3.Focus();
            }
            else if (dr["Userid"].ToString() != TextBox1.Text.Trim())
            {
                Response.Write("<script>alert('Please input right Userid')</script>");
            }



            else
            {
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["FinanceDBConnectionString1"].ConnectionString);
                string        sql = "UPDATE User_Registration_Form SET password=@password WHERE Userid=@Userid";
                //  string sq2 = "UPDATE LoginDetails SET password=@password WHERE LoginID=@Userid";
                SqlCommand cmd = new SqlCommand(sql, con);

                // SqlCommand cmd = new SqlCommand("UPDATE User_Registration_Form SET password=@password WHERE Userid=@Userid)",con);
                cmd.Parameters.AddWithValue("@Userid", TextBox1.Text);
                cmd.Parameters.AddWithValue("@password", TextBox3.Text);

                con.Open();
                cmd.ExecuteNonQuery();

                con.Close();
                Response.Write("<script>alert('password changes successfully..!!!')</script>");
                HyperLink1.Visible = true;
                // TextBox1.Text = "";
                // TextBox2.Text = "";
                // TextBox3.Text = "";
            }
        }
    }
Пример #27
0
 private void ResetRecord()
 {
     DateTimePicker1.Value = DateTime.Now;
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     btnadd.Text = "Add";
     DateTimePicker1.Focus();
 }
Пример #28
0
 private void TextBox3_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         TextBox3.ContextMenuStrip = contextMenuStrip2;
         TextBox3.Focus();
         TextBox3.ContextMenuStrip.Show(TextBox3, new Point(0, TextBox1.Height)); //, ToolStripDropDownDirection.BelowRight);
     }
 }
 protected void Button2_Click(object sender, EventArgs e)
 {
     TextBox3.Text = "";
     TextBox4.Text = "";
     TextBox5.Text = "";
     //DropDownList1.SelectedValue = "";
     //RadioButtonList1.SelectedValue = "";
     TextBox3.Focus();
 }
Пример #30
0
 private void DeliteRecord_Click(object sender, RoutedEventArgs e)
 {
     AllRecords.RemoveAt(ListView1.SelectedIndex);
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     MessageBox.Show("Complite!");
 }