Exemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            // עדכון דוח
            try
            {
                connection.Open();
                OleDbCommand command = connection.CreateCommand();
                command.Connection = connection;

                string quary = "update reports set date_event='" + dateTimePicker1.Text + "',strat_time='" + textBox2.Text + "',end_time='" + textBox3.Text + "',event_description='" + richTextBox2.Text + "',purpose_event='" + richTextBox3.Text + "',expect_people='" + textBox4.Text + "',event_requires='" + richTextBox1.Text + "',how_to_do_it='" + richTextBox5.Text + "',officials='" + richTextBox4.Text + "',Conclusions='" + richTextBox6.Text + "' where name_report='" + textBox1.Text + "' and year1='" + textBox5.Text + "' ; ";
                command.CommandText = quary;
                command.ExecuteNonQuery();

                MessageBox.Show("Data Edit seccessful");

                Refresh db = new Refresh(table);
                dataGridView1.DataSource = db.refreshdata1();

                connection.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                connection.Close();
            }
        }
Exemplo n.º 2
0
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                connection.Open();
                OleDbCommand command = connection.CreateCommand();
                command.Connection = connection;
                DialogResult result = MessageBox.Show("Do you want to delelet?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    string quary = "delete from reports where name_report='" + textBox1.Text + "' and year1='" + textBox5.Text + "'; ";

                    command.CommandText = quary;
                    command.ExecuteNonQuery();
                    MessageBox.Show("Delete seccessful");

                    Refresh db = new Refresh(table);
                    dataGridView1.DataSource = db.refreshdata1();

                    connection.Close();
                }
                else
                {
                    MessageBox.Show("Not deleled", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    connection.Close();
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                connection.Close();
            }
        }
Exemplo n.º 3
0
        private void button_delete_Click(object sender, EventArgs e)
        {
            try
            {
                connection.Open();
                OleDbCommand command = connection.CreateCommand();
                command.Connection = connection;
                DialogResult result = MessageBox.Show("Do you want to delelet?", "alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    string quary = "delete from students where id=" + int.Parse(textBox_edit.Text) + "; ";
                    //MessageBox.Show(quary);
                    command.CommandText = quary;
                    command.ExecuteNonQuery();
                    MessageBox.Show("Delete seccessful");

                    Refresh db = new Refresh(table);
                    dataGridView1.DataSource = db.refreshdata1();

                    connection.Close();
                }
                else
                {
                    MessageBox.Show("Not deleled", "alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    connection.Close();
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                connection.Close();
            }
        }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            //הוספת סטודנט
            try
            {
                connection.Open();

                OleDbCommand command = connection.CreateCommand();
                command.Connection = connection;

                command.CommandText = "insert into students (id,fname,lname,tel,email,trands,year1,gander,picture,gift,how_pay) values('" + double.Parse(txtID.Text) + "','" + txtFirstName.Text + "','" + txtLastName.Text + "','" + txtTel.Text + "','" + txtEmail.Text + "', '" + trand_comboBox.Text + "','" + year_comboBox.Text + "','" + gender + "','" + textBoximage_path.Text + "','" + gift + "','" + comboBox_cash.Text + "')";
                command.ExecuteNonQuery();

                //בדיקה מה התקבל במתנה וגריעה מהמלאי
                if (flag == 1)
                {
                    command.CommandText = "update gift set bag= " + countgift.ToString() + ";";
                    command.ExecuteNonQuery();
                    label3.Text = countgift.ToString();
                    flag        = 2;
                }
                else if (flag == 0)
                {
                    command.CommandText = "update gift set speaker= " + countgift.ToString() + ";";
                    command.ExecuteNonQuery();
                    label4.Text = countgift.ToString();
                    flag        = 2;
                }

                MessageBox.Show("Data save");

                Refresh db = new Refresh(table);
                dataGridView1.DataSource = db.refreshdata1();

                //מחיקת תאים
                txtID.Clear();
                txtFirstName.Clear();
                txtLastName.Clear();
                txtTel.Clear();
                txtEmail.Clear();
                male_radioButton.Checked = false;
                radioButton1.Checked     = false;
                radioButton3.Checked     = false;
                radioButton4.Checked     = false;
                radioButton5.Checked     = false;
                textBox_edit.Clear();
                textBoximage_path.Clear();
                pictureBox1.Visible          = false;
                year_comboBox.SelectedIndex  = -1;
                trand_comboBox.SelectedIndex = -1;

                connection.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                connection.Close();
            }
        }
Exemplo n.º 5
0
        private void button_edit_Click(object sender, EventArgs e)
        {
            try
            {
                connection.Open();
                OleDbCommand command = connection.CreateCommand();
                command.Connection = connection;
                if (label5.Text == "kobi")
                {
                    string quary = "update students set id='" + txtID.Text + "',fname='" + txtFirstName.Text + "',lname='" + txtLastName.Text + "',tel='" + txtTel.Text + "',email='" + txtEmail.Text + "',trands='" + trand_comboBox.Text + "',year1='" + year_comboBox.Text + "',how_pay='" + comboBox_cash.Text + "',gander='" + gender + "',picture='" + textBoximage_path.Text + "',gift='" + gift + "' where id=" + int.Parse(textBox_edit.Text) + "; ";
                    command.CommandText = quary;
                }
                else
                {
                    string quary = "update students set fname='" + txtFirstName.Text + "',lname='" + txtLastName.Text + "',tel='" + txtTel.Text + "',email='" + txtEmail.Text + "' where id=" + int.Parse(textBox_edit.Text) + "; ";
                    command.CommandText = quary;
                }

                command.ExecuteNonQuery();
                MessageBox.Show("Data Edit seccessful");

                Refresh db = new Refresh(table);
                dataGridView1.DataSource = db.refreshdata1();

                txtID.Clear();
                txtFirstName.Clear();
                txtLastName.Clear();
                txtTel.Clear();
                txtEmail.Clear();
                male_radioButton.Checked = false;
                radioButton1.Checked     = false;
                radioButton3.Checked     = false;
                radioButton4.Checked     = false;
                radioButton5.Checked     = false;
                textBox_edit.Clear();
                year_comboBox.SelectedIndex  = -1;
                trand_comboBox.SelectedIndex = -1;
                pictureBox1.Visible          = false;
                textBoximage_path.Clear();
                connection.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                connection.Close();
            }
        }
Exemplo n.º 6
0
        private void button_edituser_Click(object sender, EventArgs e)
        {
            try
            {
                connection.Open();
                OleDbCommand command = connection.CreateCommand();
                command.Connection  = connection;
                command.CommandText = "update login set username1='" + textBox1.Text + "', password1='" + textBox2.Text + "' where username1='" + textBox3.Text + "'; ";
                command.ExecuteNonQuery();
                MessageBox.Show("Data Edit seccessful");

                Refresh db = new Refresh(table);
                dataGridView1.DataSource = db.refreshdata1();

                connection.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                connection.Close();
            }
        }
Exemplo n.º 7
0
        private void button_adduser_Click(object sender, EventArgs e)
        {
            try
            {
                connection.Open();
                OleDbCommand command = connection.CreateCommand();
                command.Connection  = connection;
                command.CommandText = "insert into login (username1,password1) values('" + textBox1.Text + "','" + textBox2.Text + "')";
                command.ExecuteNonQuery();
                MessageBox.Show("Data Save");

                Refresh db = new Refresh(table);
                dataGridView1.DataSource = db.refreshdata1();

                connection.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                connection.Close();
            }
        }