private void Actor(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Validator.ValidTextBoxes(this.Name.Text, this.Surname.Text, this.Country.Text, this.Age.Text))
                {
                    if (imageName != "")
                    {
                        //Initialize a file stream to read the image file
                        FileStream fs = new FileStream(imageName, FileMode.Open, FileAccess.Read);

                        //Initialize a byte array with size of stream
                        byte[] imgByteArr = new byte[fs.Length];

                        //Read data from the file stream and put into the byte array
                        fs.Read(imgByteArr, 0, Convert.ToInt32(fs.Length));

                        //Close a file stream
                        fs.Close();

                        using (SqlConnection cn = Connector.GetConnection())
                        {
                            cn.Open();

                            SqlCommand cmd = new SqlCommand("InsertActor", cn);
                            cmd.CommandType = System.Data.CommandType.StoredProcedure;

                            SqlParameter name = new SqlParameter();
                            name.ParameterName = "@name";
                            name.Value         = this.Name.Text;

                            SqlParameter surname = new SqlParameter();
                            surname.ParameterName = "@surname";
                            surname.Value         = this.Surname.Text;

                            SqlParameter country = new SqlParameter();
                            country.ParameterName = "@country";
                            country.Value         = this.Country.Text;

                            SqlParameter age = new SqlParameter();
                            age.ParameterName = "@age";
                            age.Value         = this.Age.Text;

                            cmd.Parameters.Add(name);
                            cmd.Parameters.Add(surname);
                            cmd.Parameters.Add(country);
                            cmd.Parameters.Add(age);
                            cmd.Parameters.Add(new SqlParameter("image", imgByteArr));

                            SqlParameter rc = new SqlParameter();
                            rc.ParameterName = "@rc";
                            rc.SqlDbType     = System.Data.SqlDbType.Bit;
                            rc.Direction     = System.Data.ParameterDirection.Output;
                            cmd.Parameters.Add(rc);

                            cmd.ExecuteNonQuery();

                            cn.Close();

                            if ((bool)cmd.Parameters["@rc"].Value)
                            {
                                MessageBox.Show("Добавление произошло успешно!");
                                MainWindow mainWnd = new MainWindow();
                                mainWnd.Show();
                                this.Close();
                            }
                            else
                            {
                                MessageBox.Show("Ошибка добавления!");
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Введите данные!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void PackIcon_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     this.Close();
     main.Show();
 }