コード例 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string Name    = name.Text;
            string Number  = number.Text;
            string Email   = email.Text;
            string Fb      = fb.Text;
            string Other   = other.Text;
            string Address = add.Text;

            if (Name != "")
            {
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();
                    SqlCommand    cmd    = new SqlCommand("insert into Contact values(@a,@b,@c,@d,@e,@f,@g)", sqlcon);

                    cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid;
                    cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = Name;
                    cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = Number;
                    cmd.Parameters.Add("@d", SqlDbType.VarChar).Value = Email;
                    cmd.Parameters.Add("@e", SqlDbType.VarChar).Value = Fb;
                    cmd.Parameters.Add("@f", SqlDbType.VarChar).Value = Other;
                    cmd.Parameters.Add("@g", SqlDbType.VarChar).Value = Address;



                    sqlcon.Open();
                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        massage masse = new massage("Save Successful !!");
                        masse.ShowDialog();
                        name.Text   = "";
                        number.Text = "";
                        email.Text  = "";
                        fb.Text     = "";
                        other.Text  = "";
                        add.Text    = "";
                    }

                    sqlcon.Close();
                }
                catch (Exception)
                {
                    massage masse = new massage("Connection Error !!");
                    masse.ShowDialog();
                }
            }
            else
            {
                massage masse = new massage("Name Must be Requerd !!");
                masse.ShowDialog();
            }
        }
コード例 #2
0
        public void Refresh(string valu)
        {
            if (valu != "")
            {
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();

                    sqlcon.Open();
                    string     sqlquery = "Select * from Contact where unam = @a And Name like  + @b + '%' ORDER BY Name asc";
                    SqlCommand sqlcmd   = new SqlCommand(sqlquery, sqlcon);
                    sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid;
                    sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value = valu;
                    SqlDataAdapter data_adapter = new SqlDataAdapter(sqlcmd);
                    DataTable      dt           = new DataTable("Contact");
                    data_adapter.Fill(dt);
                    id.ItemsSource = dt.DefaultView;
                    data_adapter.Update(dt);
                    sqlcon.Close();
                }
                catch (Exception)
                {
                    massage mass = new massage("Opps...");
                    mass.ShowDialog();
                }
            }
            else
            {
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();

                    sqlcon.Open();
                    string     sqlquery = "Select * from Contact where unam = @a ORDER BY Name asc";
                    SqlCommand sqlcmd   = new SqlCommand(sqlquery, sqlcon);
                    sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid;
                    SqlDataAdapter data_adapter = new SqlDataAdapter(sqlcmd);
                    DataTable      dt           = new DataTable("Contact");
                    data_adapter.Fill(dt);
                    id.ItemsSource = dt.DefaultView;
                    data_adapter.Update(dt);
                    sqlcon.Close();
                }
                catch (Exception)
                {
                    massage mass = new massage("Opps...");
                    mass.ShowDialog();
                }
            }
        }
コード例 #3
0
        private void s_btn(object sender, RoutedEventArgs e)
        {
            string o_pass = opass.Password;
            string pass1  = npass.Password;
            string pass2  = cpass.Password;

            if (pass1 == pass2)
            {
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();

                    string     commandstring = "update regis set pass=@pre where unam = @a and pass = @b";
                    SqlCommand sqlcmd        = new SqlCommand(commandstring, sqlcon);
                    sqlcmd.Parameters.Add("@pre", SqlDbType.VarChar).Value = pass1;
                    sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value   = uid;
                    sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value   = o_pass;


                    sqlcon.Open();
                    int rows = sqlcmd.ExecuteNonQuery();
                    sqlcon.Close();

                    if (rows == 1)
                    {
                        massage mass = new massage("Password Changed Successfully..");
                        mass.ShowDialog();
                    }
                    else
                    {
                        massage mass = new massage("Password does not Match..");
                        mass.ShowDialog();
                    }
                }
                catch (Exception)
                {
                    massage mass = new massage("User Name And Forgot key does not Match..");
                    mass.ShowDialog();
                }
            }
            else
            {
                massage mass = new massage("Password does not Match !!");
                mass.ShowDialog();
            }
            opass.Password = "";
            npass.Password = "";
            cpass.Password = "";
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string P_name = pname.Text;
            string URL    = url.Text;
            string EMUN   = emun.Text;
            string Passw  = passw.Text;

            if (P_name != "")
            {
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();
                    SqlCommand    cmd    = new SqlCommand("insert into Password values(@a,@b,@c,@d,@e)", sqlcon);

                    cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid;
                    cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = P_name;
                    cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = URL;
                    cmd.Parameters.Add("@d", SqlDbType.VarChar).Value = EMUN;
                    cmd.Parameters.Add("@e", SqlDbType.VarChar).Value = Passw;


                    sqlcon.Open();
                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        massage masse = new massage("Save Successful !!");
                        masse.ShowDialog();
                        pname.Text = "";
                        url.Text   = "";
                        emun.Text  = "";
                        passw.Text = "";
                    }

                    sqlcon.Close();
                }
                catch (Exception)
                {
                    massage masse = new massage("Connection Error !!");
                    masse.ShowDialog();
                }
            }
            else
            {
                massage masse = new massage("Name Must be Requerd !!");
                masse.ShowDialog();
            }
        }
コード例 #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string Bname   = bname.Text;
            string Anumber = anumber.Text;
            string Cnumber = cnumber.Text;
            string Cpass   = cpass.Text;

            if (Bname != "")
            {
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();
                    SqlCommand    cmd    = new SqlCommand("insert into Bank values(@a,@b,@c,@d,@e)", sqlcon);

                    cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid;
                    cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = Bname;
                    cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = Anumber;
                    cmd.Parameters.Add("@d", SqlDbType.VarChar).Value = Cnumber;
                    cmd.Parameters.Add("@e", SqlDbType.VarChar).Value = Cpass;


                    sqlcon.Open();
                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        massage masse = new massage("Save Successful !!");
                        masse.ShowDialog();
                        bname.Text   = "";
                        anumber.Text = "";
                        cnumber.Text = "";
                        cpass.Text   = "";
                    }

                    sqlcon.Close();
                }
                catch (Exception)
                {
                    massage masse = new massage("Connection Error !!");
                    masse.ShowDialog();
                }
            }
            else
            {
                massage masse = new massage("Name Must be Requerd !!");
                masse.ShowDialog();
            }
        }
コード例 #6
0
        private void logbtn(object sender, RoutedEventArgs e)
        {
            string u_nam = uname.Text;
            string pass  = passw.Password;
            int    count = 0;

            try
            {
                config        cn     = new config();
                SqlConnection sqlcon = cn.cunnection();
                sqlcon.Open();
                string     commandstring = "select * from regis where unam = @a and pass = @b";
                SqlCommand sqlcmd        = new SqlCommand(commandstring, sqlcon);
                sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = u_nam;
                sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value = pass;

                SqlDataReader read = sqlcmd.ExecuteReader();
                while (read.Read())
                {
                    count++;

                    if (read["unam"].ToString() == u_nam && read["pass"].ToString() == pass)
                    {
                        massage mass = new massage("Login Successful !!");
                        mass.ShowDialog();
                        main ma = new main(read["unam"].ToString());
                        ma.Show();
                        this.Close();
                    }
                }
                if (count == 0)
                {
                    massage mass = new massage("Invalid Username And Password");
                    mass.ShowDialog();
                }

                sqlcon.Close();
            }
            catch (Exception)
            {
                massage mass = new massage("Invalid Username And Password");
                mass.ShowDialog();
            }
        }
コード例 #7
0
        private void svcl(object sender, RoutedEventArgs e)
        {
            string title = ftit.Text;
            string mass  = nd.Text;

            if (title != "" && mass != "")
            {
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();
                    SqlCommand    cmd    = new SqlCommand("insert into note values(@a,@b,@c)", sqlcon);

                    cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid;
                    cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = title;
                    cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = mass;



                    sqlcon.Open();
                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        massage masse = new massage("Save Successful !!");
                        masse.ShowDialog();
                        ftit.Text = "";
                        nd.Text   = "";
                    }

                    sqlcon.Close();
                }
                catch (Exception)
                {
                    massage masse = new massage("Title And Note Must 200 & 700 !!");
                    masse.ShowDialog();
                }
            }
            else
            {
                massage masse = new massage("Opps input all fields!!");
                masse.ShowDialog();
            }
        }
コード例 #8
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            string tit  = title.Text;
            string mass = note.Text;

            if (tit != "" && mass != "")
            {
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();
                    SqlCommand    cmd    = new SqlCommand("UPDATE note SET title = @b, notes = @c WHERE Id=@a ", sqlcon);

                    cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid;
                    cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = tit;
                    cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = mass;



                    sqlcon.Open();
                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        massage masse = new massage("Save Successful !!");
                        masse.ShowDialog();
                        this.Close();
                    }

                    sqlcon.Close();
                }
                catch (Exception)
                {
                    massage masse = new massage("Title And Note Must 150 & 500 !!");
                    masse.ShowDialog();
                }
            }
            else
            {
                massage masse = new massage("Opps input all fields!!");
                masse.ShowDialog();
            }
        }
コード例 #9
0
        private void delclk(object sender, RoutedEventArgs e)
        {
            var           myValue       = ((Button)sender).Tag;
            config        cn            = new config();
            SqlConnection sqlcon        = cn.cunnection();
            string        commandstring = "delete from Contact where id= @a";
            SqlCommand    sqlcmd        = new SqlCommand(commandstring, sqlcon);

            sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = myValue;
            sqlcon.Open();
            int rows = sqlcmd.ExecuteNonQuery();

            sqlcon.Close();

            if (rows > 0)
            {
                massage mass = new massage("delete successfully...");
                mass.ShowDialog();
                this.Refresh(shbx.Text);
            }
        }
コード例 #10
0
ファイル: today.xaml.cs プロジェクト: MehediHR/Personal-Book
        private void success(object sender, RoutedEventArgs e)
        {
            var           myValue       = ((Button)sender).Tag;
            config        cn            = new config();
            SqlConnection sqlcon        = cn.cunnection();
            string        commandstring = "UPDATE pbplan SET sec=@b where id= @a";
            SqlCommand    sqlcmd        = new SqlCommand(commandstring, sqlcon);

            sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = myValue;
            sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value = "ok";
            sqlcon.Open();
            int rows = sqlcmd.ExecuteNonQuery();

            sqlcon.Close();

            if (rows > 0)
            {
                massage mass = new massage("This Plan Is Successfule...");
                mass.ShowDialog();
                this.Refresh();
            }
        }
コード例 #11
0
        private void regclk(object sender, RoutedEventArgs e)
        {
            string u_nam = unam.Text;
            string name  = nam.Text;
            string f_key = fkey.Text;
            string pass1 = pass.Password;
            string pass2 = cpass.Password;

            if (u_nam == "")
            {
                massage mass = new massage("Input User Name..");
                mass.ShowDialog();
            }
            else if (name == "")
            {
                massage mass = new massage("Input Name..");
                mass.ShowDialog();
            }
            else if (f_key == "")
            {
                massage mass = new massage("Input Forgot key..");
                mass.ShowDialog();
            }
            else if (pass1 == "")
            {
                massage mass = new massage("Input Password..");
                mass.ShowDialog();
            }
            else if (pass2 == "")
            {
                massage mass = new massage("Input Confirm Password..");
                mass.ShowDialog();
            }
            else
            {
                if (pass1 == pass2)
                {
                    try
                    {
                        config        cn     = new config();
                        SqlConnection sqlcon = cn.cunnection();
                        SqlCommand    cmd    = new SqlCommand("insert into regis values(@a,@b,@c,@d)", sqlcon);

                        cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = u_nam;
                        cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = name;
                        cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = f_key;
                        cmd.Parameters.Add("@d", SqlDbType.VarChar).Value = pass1;


                        sqlcon.Open();
                        int rows = cmd.ExecuteNonQuery();
                        if (rows > 0)
                        {
                            massage mass = new massage("Registration Successful !!");
                            mass.ShowDialog();
                            main mi = new main(u_nam);
                            mi.Show();
                            this.Close();
                        }

                        sqlcon.Close();
                    }
                    catch (Exception)
                    {
                        massage mass = new massage("This User Name is Alrady Used !!");
                        mass.ShowDialog();
                    }
                }
                else
                {
                    massage mass = new massage("Password does not Match !!");
                    mass.ShowDialog();
                }
            }
        }
コード例 #12
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (pdate.Text.Length == 0)
            {
                massage masse = new massage("Set Plan Date !!");
                masse.ShowDialog();
            }
            else if (stime.Text == null)
            {
                massage masse = new massage("Set Plan Start Time !!");
                masse.ShowDialog();
            }
            else if (etime.Text == null)
            {
                massage masse = new massage("Set Plan End Time !!");
                masse.ShowDialog();
            }
            else if (plan.Text == "")
            {
                massage masse = new massage("Set Your Plan Detail !!");
                masse.ShowDialog();
            }
            else
            {
                DateTime P_date = Convert.ToDateTime(string.Format("{0:yyyy-mm-dd}", pdate.Text));
                TimeSpan S_time = DateTime.Parse(string.Format("{0:hh:mm tt}", stime.Text)).TimeOfDay;
                TimeSpan E_time = DateTime.Parse(string.Format("{0:hh:mm tt}", etime.Text)).TimeOfDay;
                string   Pln    = plan.Text;
                try
                {
                    config        cn     = new config();
                    SqlConnection sqlcon = cn.cunnection();
                    SqlCommand    cmd    = new SqlCommand("insert into pbplan (unam, dt, stime, etime, pln, sec) values (@a, @b, @c, @d, @e, @f);", sqlcon);

                    cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid;
                    cmd.Parameters.Add("@b", SqlDbType.Date).Value    = P_date;
                    cmd.Parameters.Add("@c", SqlDbType.Time).Value    = S_time;
                    cmd.Parameters.Add("@d", SqlDbType.Time).Value    = E_time;
                    cmd.Parameters.Add("@e", SqlDbType.VarChar).Value = Pln;
                    cmd.Parameters.Add("@f", SqlDbType.VarChar).Value = "no";

                    sqlcon.Open();
                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        massage mass = new massage("Plan Set Successful !!");
                        mass.ShowDialog();
                        pdate.Text = "";
                        stime.Text = "";
                        etime.Text = "";
                        plan.Text  = "";
                    }

                    sqlcon.Close();
                }
                catch (Exception)
                {
                    massage mass = new massage("Connection Error !!");
                    mass.ShowDialog();
                }
            }
        }