Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String        commandText = "UPDATE AddressSet SET Street=@street, City=@city, Territory=@territory, Country=@country, ZipCode=@zipcode WHERE AddressID=@param";
            string        sConnection = Properties.Settings.Default.BD2ConnectionString;
            SqlConnection conn        = new SqlConnection();

            conn.ConnectionString = sConnection;
            conn.Open();
            try
            {
                SqlCommand command = new SqlCommand(commandText, conn);
                command.Parameters.AddWithValue("@street", textBox1.Text.ToString());
                command.Parameters.AddWithValue("@city", textBox2.Text.ToString());
                command.Parameters.AddWithValue("@territory", comboBox1.Text.ToString());
                command.Parameters.AddWithValue("@country", comboBox2.Text.ToString());
                command.Parameters.AddWithValue("@zipcode", Int32.Parse(textBox3.Text.ToString()));
                command.Parameters.AddWithValue("@param", DBMonitor.pomoc);
                command.ExecuteNonQuery();
                conn.Close();
                DBMonitor powrot = new DBMonitor();
                powrot.Show();
                this.Hide();
            }
            catch (SqlException er)
            {
                String text = "There was an error reported by SQL Server, " + er.Message;
                MessageBox.Show(text, "ERROR");
            }
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            String        commandText = "UPDATE HCOSet SET Name=@Name, Range=@Range, Level=@Level, SpecialType=@SpecialType, Beds=@Beds, Employees=@Employees, PhoneNumber=@PhoneNumber, Email=@Email, Website=@Website, AddressID=@AddressID WHERE HCOID=@param";
            string        sConnection = Properties.Settings.Default.BD2ConnectionString;
            SqlConnection conn        = new SqlConnection();

            conn.ConnectionString = sConnection;
            conn.Open();
            try
            {
                SqlCommand command = new SqlCommand(commandText, conn);
                command.Parameters.AddWithValue("@Name", namebox1.Text.ToString());
                command.Parameters.AddWithValue("@Range", comboBox1.Text.ToString());
                command.Parameters.AddWithValue("@Level", Convert.ToInt16(comboBox2.Text.ToString()));
                command.Parameters.AddWithValue("@SpecialType", comboBox3.Text.ToString());
                command.Parameters.AddWithValue("@Beds", bedsbox1.Text.ToString());
                command.Parameters.AddWithValue("@Employees", textBox1.Text.ToString());
                command.Parameters.AddWithValue("@PhoneNumber", Int32.Parse(textBox2.Text.ToString()));
                command.Parameters.AddWithValue("@Email", textBox3.Text.ToString());
                command.Parameters.AddWithValue("@Website", textBox4.Text.ToString());
                command.Parameters.AddWithValue("@AddressID", Int32.Parse(label13.Text.ToString()));
                command.Parameters.AddWithValue("@param", DBMonitor.pomoc);
                command.ExecuteNonQuery();
                conn.Close();
                DBMonitor powrot = new DBMonitor();
                powrot.Show();
                this.Hide();
            }
            catch (SqlException er)
            {
                String text = "There was an error reported by SQL Server, " + er.Message;
                MessageBox.Show(text, "ERROR");
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            DBMonitor powrot = new DBMonitor();

            powrot.Show();
        }
Exemplo n.º 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            String        commandText = "UPDATE HCPSet SET FirstName=@firstname, MiddleName=@middlename, LastName=@lastname, Gender=@gender, AcademicTitle=@academictitle, Birthdate=@birthdate, PhoneNumber=@phonenumber, Email=@email, KOL=@kol, Specialty=@specialty, AddressID=@addressid, HCOID=@hcoid WHERE HCPID=@param";
            string        sConnection = Properties.Settings.Default.BD2ConnectionString;
            SqlConnection conn        = new SqlConnection();

            conn.ConnectionString = sConnection;
            conn.Open();
            try
            {
                SqlCommand command = new SqlCommand(commandText, conn);
                command.Parameters.AddWithValue("@param", DBMonitor.pomoc);
                command.Parameters.AddWithValue("@firstname", textBox1.Text);
                command.Parameters.AddWithValue("@middlename", textBox2.Text);
                command.Parameters.AddWithValue("@lastname", textBox3.Text);
                command.Parameters.AddWithValue("@gender", comboBox1.Text);
                command.Parameters.AddWithValue("@academictitle", comboBox2.Text);
                command.Parameters.AddWithValue("@birthdate", dateTimePicker1.Value.Date);
                maskedTextBox1.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
                command.Parameters.AddWithValue("@phonenumber", Convert.ToInt32(maskedTextBox1.Text.ToString()));
                command.Parameters.AddWithValue("@email", textBox4.Text);
                if (checkBox1.Checked)
                {
                    command.Parameters.AddWithValue("@kol", true);
                }
                else
                {
                    command.Parameters.AddWithValue("@kol", false);
                }
                command.Parameters.AddWithValue("@specialty", comboBox3.Text);
                command.Parameters.AddWithValue("@addressid", label12.Text);
                command.Parameters.AddWithValue("@hcoid", label11.Text);
                command.ExecuteNonQuery();
                conn.Close();
                DBMonitor powrot = new DBMonitor();
                powrot.Show();
                this.Hide();
            }
            catch (SqlException er)
            {
                String text = "There was an error reported by SQL Server, " + er.Message;
                MessageBox.Show(text, "ERROR");
            }
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            String street    = textBox1.Text.ToString();
            String city      = textBox2.Text.ToString();
            String territory = comboBox1.Text.ToString();
            String country   = comboBox2.Text.ToString();
            Int32  zipcode   = Int32.Parse(textBox3.Text.ToString());
            var    adres     = new Address {
                Street = street, City = city, Territory = territory, Country = country, ZipCode = zipcode
            };

            using (var context = new MedDBContainer())
            {
                context.AddressSet.Add(adres);
                context.SaveChanges();
            }
            this.Hide();
            DBMonitor nowy = new DBMonitor();

            nowy.Show();
        }
Exemplo n.º 6
0
        private void button2_Click(object sender, EventArgs e)
        {
            String        commandText = "INSERT INTO HCPSet VALUES(@firstname, @middlename, @lastname, @gender, @academictitle, @birthdate, @phonenumber, @email, @kol, @specialty, @addressid, @hcoid)";
            string        sConnection = Properties.Settings.Default.BD2ConnectionString;
            SqlConnection conn        = new SqlConnection();

            conn.ConnectionString = sConnection;
            conn.Open();
            try
            {
                SqlCommand command = new SqlCommand(commandText, conn);
                command.Parameters.AddWithValue("@firstname", textBox1.Text.ToString());
                command.Parameters.AddWithValue("@middlename", textBox2.Text.ToString());
                command.Parameters.AddWithValue("@lastname", textBox3.Text.ToString());
                command.Parameters.AddWithValue("@gender", comboBox1.Text.ToString());
                command.Parameters.AddWithValue("@academictitle", comboBox2.Text.ToString());
                command.Parameters.Add("@birthdate", SqlDbType.Date).Value = dateTimePicker1.Value.Date;
                maskedTextBox1.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
                command.Parameters.AddWithValue("@phonenumber", Convert.ToInt32(maskedTextBox1.Text.ToString()));
                command.Parameters.AddWithValue("@email", textBox4.Text.ToString());
                command.Parameters.AddWithValue("@kol", Convert.ToBoolean(checkBox1.Checked.ToString()));
                command.Parameters.AddWithValue("@specialty", comboBox3.Text.ToString());
                command.Parameters.AddWithValue("@addressid", Convert.ToInt32(label12.Text.ToString()));
                command.Parameters.AddWithValue("@hcoid", Convert.ToInt32(label11.Text.ToString()));
                command.ExecuteNonQuery();
                conn.Close();
                DBMonitor powrot = new DBMonitor();
                powrot.Show();
                this.Hide();
            }
            catch (SqlException er)
            {
                String text = "There was an error reported by SQL Server, " + er.Message;
                MessageBox.Show(text, "ERROR");
            }
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            DBMonitor nowymonitor = new DBMonitor();

            nowymonitor.Show();
        }