Exemplo n.º 1
0
        private void TheMainView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage           = { Text = Properties.Resources.WantToQuit + "?", Foreground = Brushes.Black },
                TxtTitle             = { Text = Properties.Resources.Exit, Foreground = Brushes.White },
                BtnOk                = { Content = Properties.Resources.Yes },
                BtnCancel            = { Content = Properties.Resources.No },
                MainContentControl   = { Background = Brushes.White },
                TitleBackgroundPanel = { Background = Brushes.BlueViolet },

                BorderBrush = Brushes.BlueViolet
            };

            msg.Show();
            var results = msg.Result;

            if (results.ToString() == "OK")
            {
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }
Exemplo n.º 2
0
        private void btCalculate_Click(object sender, RoutedEventArgs e)
        {
            Check();

            if (fine == true)
            {
                double total   = Total(Price(), Days(), Extras());
                var    message = new CustomMaterialMessageBox
                {
                    Width      = 360,
                    Height     = 280,
                    TxtTitle   = { Text = "Total Rent Costs", Foreground = Brushes.White },
                    TxtMessage = { Text = "Customer: " + cbCustomer.Text + "\nSelected Vehicle: " + cbVehicle.Text + "     " + Price() + " € cost per day\nTotal Days: " + Days() + "\nNumber of Extras: " + Extras() + " x 10 € each" +
                                          "\nInsurance: " + cbInsurance.Text + "€ \n\nTOTAL= " + total + " €" },
                    BtnOk                = { Background = Brushes.Crimson, Content = "Rent" },
                    BtnCancel            = { Background = Brushes.BlueViolet, Content = "Cancel" },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                message.Show();
                string result = Convert.ToString(message.Result);
                if (result == "OK")
                {
                    ADD(total);
                    this.Close();
                }
            }
        }
Exemplo n.º 3
0
        private void ShowCustomMessageBox_OnClick(object sender, RoutedEventArgs e)
        {
            //With this option
            //You should add a reference to the mahApps.Metro available at http://mahapps.com/
            //You can create this as a static class and reuse it all over your app


            CustomMaterialMessageBox msg = new CustomMaterialMessageBox
            {
                Title                = "This is too cool",
                TxtMessage           = { Text = "Do you like white wine?", Foreground = Brushes.White },
                TxtTitle             = { Text = "This is too cool", Foreground = Brushes.White },
                BtnOk                = { Content = "Yes" },
                BtnCancel            = { Content = "Noooo" },
                MainContentControl   = { Background = Brushes.MediumVioletRed },
                TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                BorderBrush          = Brushes.BlueViolet,
                BtnCopyMessage       = { Visibility = Visibility.Hidden },
            };

            msg.Show();
            MessageBoxResult results = msg.Result;

            TxtResult.Text = $"Message Box Result is: {results}";
        }
Exemplo n.º 4
0
        private void btIzmeniZap_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                izmeni = true;
                Zaposleni zaposleni = new Zaposleni();
                konekcija.Open();
                DataRowView dataRowView = (DataRowView)dgAdmin.SelectedItems[0];
                forma = dataRowView;
                string        select  = "select Name,[Last Name],[Birth Date],[Phone],[e-mail],Gender,City,[Job Title],[Employment Type] from Employee where Employee_ID = " + dataRowView["ID"];
                SqlCommand    command = new SqlCommand(select, konekcija);
                SqlDataReader reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    zaposleni.txtName.Text   = reader["Name"].ToString();
                    zaposleni.txtSecond.Text = reader["Last Name"].ToString();
                    zaposleni.dataBirth.Text = reader["Birth Date"].ToString();
                    zaposleni.txtPhone.Text  = reader["Phone"].ToString();
                    zaposleni.txtEmail.Text  = reader["e-mail"].ToString();
                    zaposleni.cbCity.Text    = reader["City"].ToString();
                    zaposleni.cbTitle.Text   = reader["Job Title"].ToString();
                    zaposleni.cbType.Text    = reader["Employment Type"].ToString();
                    if (reader["Gender"].ToString() == "Male")
                    {
                        zaposleni.rbMale.IsChecked = true;
                    }
                    else
                    {
                        zaposleni.rbFemale.IsChecked = true;
                    }
                }
                zaposleni.ShowDialog();
            }
            catch (ArgumentOutOfRangeException)
            {
                var msg = new CustomMaterialMessageBox
                {
                    Width                = 300,
                    Height               = 150,
                    TxtMessage           = { Text = "You didnt select a row.", Foreground = Brushes.BlueViolet },
                    TxtTitle             = { Text = "Employee", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                    BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                    BtnCancel            = { Width = 0, Height = 0, Content = null },
                    BtnOk                = { Background = Brushes.BlueViolet, },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                msg.Show();
            }
            finally
            {
                if (konekcija != null)
                {
                    konekcija.Close();
                }
                btZaposleni_Click(sender, e);
                izmeni = false;
            }
        }
Exemplo n.º 5
0
        private CustomMaterialMessageBox CreateMessageBox(string wiadomosc,
                                                          string tytul          = "Uwaga",
                                                          string btnOk          = "Tak",
                                                          string btnCancel      = "Nie",
                                                          Visibility visibility = Visibility.Visible)
        {
            CustomMaterialMessageBox msgBox;
            Brush titleBackgroundColor  = (SolidColorBrush)(new BrushConverter().ConvertFrom("#3f51b5"));
            Brush buttonBackgroundColor = (SolidColorBrush)(new BrushConverter().ConvertFrom("#3f51b5"));

            msgBox = new CustomMaterialMessageBox
            {
                TxtMessage = { Text = wiadomosc },
                TxtTitle   = { Text = tytul },

                TitleBackgroundPanel = { Background = titleBackgroundColor },
                BorderBrush          = Brushes.DarkGray,

                BtnOk     = { Content = btnOk, Background = buttonBackgroundColor, BorderBrush = Brushes.Gray },
                BtnCancel = { Content = btnCancel, Background = buttonBackgroundColor, BorderBrush = Brushes.Gray, Visibility = visibility },

                Background = Brushes.LightGray,
                Foreground = Brushes.White,
            };

            return(msgBox);
        }
Exemplo n.º 6
0
        /// <summary>
        /// retourne la popup normale, avec un message et le bouton Ok
        /// </summary>
        /// <param name="text"></param>
        /// <param name="title"></param>
        /// <param name="textButtonOk"></param>
        /// <returns></returns>
        private static CustomMaterialMessageBox NormalMessageBox(string text, string title, string textButtonOk)
        {
            CustomMaterialMessageBox messageBox = MessageBox(text, title, textButtonOk);

            messageBox.BtnCancel.Visibility = Visibility.Collapsed;
            return(messageBox);
        }
Exemplo n.º 7
0
 private void btAdd_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         konekcija.Open();
         if (AdminMain.izmeni)
         {
             DataRowView row  = (DataRowView)AdminMain.forma;
             string      upit = @"Update Insurance Set Type ='" + txtType.Text + "' , Price = '" + txtCost.Text + "' Where Insurance_ID=" + row["ID"];
             SqlCommand  cmd  = new SqlCommand(upit, konekcija);
             cmd.ExecuteNonQuery();
             AdminMain.forma = null;
         }
         else
         {
             string     insert = @"insert into Insurance(Type,Price)
                 values ('" + txtType.Text + "','" + txtCost.Text + "');";
             SqlCommand sql    = new SqlCommand(insert, konekcija);
             sql.ExecuteNonQuery();
             var msg = new CustomMaterialMessageBox
             {
                 Width                = 300,
                 Height               = 150,
                 TxtMessage           = { Text = "New insurance is added to the database.", Foreground = Brushes.BlueViolet },
                 TxtTitle             = { Text = "Insurance", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                 BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                 BtnCancel            = { Width = 0, Height = 0, Content = null },
                 BtnOk                = { Background = Brushes.BlueViolet, },
                 TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                 BorderBrush          = Brushes.BlueViolet
             };
             msg.Show();
         }
     }
     catch (SqlException)
     {
         var msg = new CustomMaterialMessageBox
         {
             Width                = 300,
             Height               = 150,
             TxtMessage           = { Text = "Something went wrong.", Foreground = Brushes.BlueViolet },
             TxtTitle             = { Text = "Insurance", Foreground = Brushes.White, Background = Brushes.BlueViolet },
             BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
             BtnCancel            = { Width = 0, Height = 0, Content = null },
             BtnOk                = { Background = Brushes.BlueViolet, },
             TitleBackgroundPanel = { Background = Brushes.BlueViolet },
             BorderBrush          = Brushes.BlueViolet
         };
         msg.Show();
     }
     finally
     {
         if (konekcija != null)
         {
             konekcija.Close();
         }
         this.Close();
     }
 }
Exemplo n.º 8
0
        public Rezervacija()
        {
            InitializeComponent();
            try
            {
                konekcija.Open();
                string         backCustomers = "select Customer_ID,Name+' '+[Last Name] as Customer from Customer";
                DataTable      data          = new DataTable();
                SqlDataAdapter sql           = new SqlDataAdapter(backCustomers, konekcija);
                sql.Fill(data);
                cbCustomer.ItemsSource = data.DefaultView;

                string         backEmployee = "select Employee_ID,Name+' '+[Last Name] as Employee from Employee";
                DataTable      dataEmp      = new DataTable();
                SqlDataAdapter sqlEmp       = new SqlDataAdapter(backEmployee, konekcija);
                sqlEmp.Fill(dataEmp);
                cbEmployee.ItemsSource = dataEmp.DefaultView;

                string         backVehicle = "select Vehicle_ID,Make+' '+ Model as Vehicle from Vehicle";
                DataTable      dataVeh     = new DataTable();
                SqlDataAdapter sqlVeh      = new SqlDataAdapter(backVehicle, konekcija);
                sqlVeh.Fill(dataVeh);
                cbVehicle.ItemsSource = dataVeh.DefaultView;

                string         backInsurance = "select Insurance_ID,Type+' '+Cast(Price as nvarchar(10)) as Insurance from Insurance";
                DataTable      dataIns       = new DataTable();
                SqlDataAdapter sqlIns        = new SqlDataAdapter(backInsurance, konekcija);
                sqlIns.Fill(dataIns);
                cbInsurance.ItemsSource = dataIns.DefaultView;
            }
            catch (SqlException)
            {
                var msg = new CustomMaterialMessageBox
                {
                    Width                = 300,
                    Height               = 150,
                    TxtMessage           = { Text = "Something went wrong.", Foreground = Brushes.BlueViolet },
                    TxtTitle             = { Text = "Reservation", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                    BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                    BtnCancel            = { Width = 0, Height = 0, Content = null },
                    BtnOk                = { Background = Brushes.BlueViolet, },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                msg.Show();
            }
            finally
            {
                if (konekcija != null)
                {
                    konekcija.Close();
                }
            }
        }
Exemplo n.º 9
0
        public int Price()
        {
            string result = "0";

            try
            {
                int        index = Convert.ToInt32(cbVehicle.SelectedValue);
                string     price = "select Price from Vehicle where Vehicle_ID=" + index;
                SqlCommand cmd   = new SqlCommand(price, konekcija);
                konekcija.Open();
                string getValue = cmd.ExecuteScalar().ToString();
                if (getValue != null)
                {
                    result = getValue.ToString();
                }
                konekcija.Close();
                return(Convert.ToInt32(result));
            }
            catch (System.NullReferenceException)
            {
                var msg = new CustomMaterialMessageBox
                {
                    Width                = 300,
                    Height               = 150,
                    TxtMessage           = { Text = "Something went wrong.", Foreground = Brushes.BlueViolet },
                    TxtTitle             = { Text = "Reservation", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                    BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                    BtnCancel            = { Width = 0, Height = 0, Content = null },
                    BtnOk                = { Background = Brushes.BlueViolet, },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                msg.Show();
                return(0);
            }
            catch (InvalidOperationException)
            {
                var msg = new CustomMaterialMessageBox
                {
                    Width                = 300,
                    Height               = 150,
                    TxtMessage           = { Text = "Something went wrong.", Foreground = Brushes.BlueViolet },
                    TxtTitle             = { Text = "Reservation", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                    BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                    BtnCancel            = { Width = 0, Height = 0, Content = null },
                    BtnOk                = { Background = Brushes.BlueViolet, },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                msg.Show();
                return(0);
            }
        }
        public void ShowError_BtnOK(string wiadomosc, string tytul = "Błąd")
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage           = { Text = wiadomosc },
                TxtTitle             = { Text = tytul },
                BtnOk                = { Content = "OK", Background = Brushes.Gray, BorderBrush = Brushes.Gray },
                BtnCancel            = { Visibility = System.Windows.Visibility.Collapsed },
                TitleBackgroundPanel = { Background = Brushes.Red },
                BorderBrush          = Brushes.Red
            };

            msg.Show();
        }
Exemplo n.º 11
0
        public Error(Exception error)
        {
            var msgerror = new CustomMaterialMessageBox
            {
                TxtMessage           = { Text = "ERROR : " + error, Foreground = Brushes.White },
                TxtTitle             = { Text = "ERROR", Foreground = Brushes.White },
                BtnCancel            = { Content = "OK", Background = Brushes.Red, BorderBrush = Brushes.Gray },
                BtnOk                = { Visibility = Visibility.Hidden },
                MainContentControl   = { Background = Brushes.Gray },
                TitleBackgroundPanel = { Background = Brushes.Red },
                BorderBrush          = Brushes.Red
            };

            msgerror.Show();
        }
        public MessageBoxResult ShowQuestion_BtnOkCancel(string wiadomosc, string tytul = "Uwaga", string btnOk = "Tak", string btnCancel = "Nie")
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage           = { Text = wiadomosc },
                TxtTitle             = { Text = tytul },
                BtnOk                = { Content = btnOk, Background = Brushes.Gray, BorderBrush = Brushes.Gray },
                BtnCancel            = { Content = btnCancel, Background = Brushes.Gray, BorderBrush = Brushes.Gray },
                TitleBackgroundPanel = { Background = Brushes.OrangeRed },
                BorderBrush          = Brushes.OrangeRed
            };

            msg.Show();
            return(msg.Result);
        }
Exemplo n.º 13
0
        private void btIzmeniOsi_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                izmeni = true;
                Osiguranje osiguranje = new Osiguranje();
                konekcija.Open();
                DataRowView dataRowView = (DataRowView)dgAdmin.SelectedItems[0];
                forma = dataRowView;
                string        select  = "select Type,Price from Insurance where Insurance_ID = " + dataRowView["ID"];
                SqlCommand    command = new SqlCommand(select, konekcija);
                SqlDataReader reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    osiguranje.txtType.Text = reader["Type"].ToString();
                    osiguranje.txtCost.Text = reader["Price"].ToString();
                }
                osiguranje.ShowDialog();
            }
            catch (ArgumentOutOfRangeException)
            {
                var msg = new CustomMaterialMessageBox
                {
                    Width                = 300,
                    Height               = 150,
                    TxtMessage           = { Text = "You didnt select a row.", Foreground = Brushes.BlueViolet },
                    TxtTitle             = { Text = "Insurance", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                    BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                    BtnCancel            = { Width = 0, Height = 0, Content = null },
                    BtnOk                = { Background = Brushes.BlueViolet, },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                msg.Show();
            }
            finally
            {
                if (konekcija != null)
                {
                    konekcija.Close();
                }
                btOsiguranje_Click(sender, e);
                izmeni = false;
            }
        }
        private void ShowCustomMessageBox_OnClick(object sender, RoutedEventArgs e)
        {
            //You can create this as a static class and reuse it all over your app
            //Don't forget to specify the BorderThickness if needed
            CustomMaterialMessageBox customMaterialMessageBox = new CustomMaterialMessageBox
            {
                MessageTextBlock = { Text = "Do you like white wine?", Foreground = Brushes.White },
                OkButton         = { Content = "Yes" },
                CancelButton     = { Content = "Noooo" },
                MainGrid         = { Background = Brushes.Red },
                BorderBrush      = Brushes.BlueViolet,
                BorderThickness  = new Thickness(4, 4, 4, 4)
            };

            customMaterialMessageBox.Show();
            TxtResult.Text = $"Message Box Result is: {customMaterialMessageBox.Result}";
        }
Exemplo n.º 15
0
        private void btUser_Click(object sender, RoutedEventArgs e)
        {
            var msg = new CustomMaterialMessageBox
            {
                Width                = 300,
                Height               = 150,
                TxtMessage           = { Text = "Please select admin.", Foreground = Brushes.BlueViolet },
                TxtTitle             = { Text = "User", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                BtnCancel            = { Width = 0, Height = 0, Content = null },
                BtnOk                = { Background = Brushes.BlueViolet, },
                TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                BorderBrush          = Brushes.BlueViolet
            };

            msg.Show();
        }
Exemplo n.º 16
0
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage         = { Text = "Da li ste sigurni da želite da učitate novu datoteku? Sve nesnimnjene promene će biti izgubljene.", Background = FindResource("PrimaryHueMidForegroundBrush") as Brush },
                TxtTitle           = { Text = "Potvrda učitavanja nove datoteke" },
                BtnOk              = { Content = "Da" },
                BtnCancel          = { Content = "Ne" },
                MainContentControl = { Background = FindResource("PrimaryHueMidForegroundBrush") as Brush },
            };

            msg.Show();

            if (msg.Result == MessageBoxResult.OK)
            {
                // Configure open file dialog box
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName    = "Document";                           // Default file name
                dlg.DefaultExt  = ".es";                                // Default file extension
                dlg.Title       = "Učitaj fajl";
                dlg.Filter      = "Endangered species maps (.es)|*.es"; // Filter files by extension
                dlg.Multiselect = false;

                // Show open file dialog box
                bool?result = dlg.ShowDialog();
                if (result.HasValue && result.Value)
                {
                    string novaPutanja = dlg.FileName;

                    if (!novaPutanja.Equals(Putanja))
                    {
                        try
                        {
                            Putanja         = novaPutanja;
                            GlavniKontejner = Loader.Deserijalizuj(Putanja);
                            LoadMap(GlavniKontejner.Mape[AktivnaMapa]);
                            MyCustomMessageQueue.Enqueue("Izabrana datoteka je uspešno učitana");
                        }
                        catch
                        {
                            MyCustomMessageQueue.Enqueue("Izabrana datoteka nije podržana");
                        }
                    }
                }
            }
        }
Exemplo n.º 17
0
        private void btAdd_Click(object sender, RoutedEventArgs e)
        {
            var msg = new CustomMaterialMessageBox
            {
                Width                = 300,
                Height               = 150,
                TxtMessage           = { Text = "New Optional Extras is added to the database.", Foreground = Brushes.BlueViolet },
                TxtTitle             = { Text = "Optional Extras", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                BtnCancel            = { Width = 0, Height = 0, Content = null },
                BtnOk                = { Background = Brushes.BlueViolet, },
                TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                BorderBrush          = Brushes.BlueViolet
            };

            msg.Show();
            this.Close();
        }
Exemplo n.º 18
0
        }//Show

        //--------------------------------------------------------------------------------------------------//

        /// <summary>
        /// Show message without cancel button
        /// </summary>
        /// <param name="message">What you want to say</param>
        /// <param name="title">Title</param>
        /// <param name="canCopy">Is there a copy button</param>
        public static MessageBoxResult ShowOk(string title, string message, bool canCopy = true)
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage =
                {
                    Text       = message,
                    Foreground = Brushes.Black
                },
                TxtTitle =
                {
                    Text       = title,
                    Foreground = Brushes.White
                },
                BtnOk =
                {
                    Content     = "Ok",
                    Background  = (Brush)Application.Current.Resources["BrushPrimaryDark"],
                    BorderBrush = (Brush)Application.Current.Resources["BrushPrimaryDark"]
                },

                ShowCloseButton = true,

                ResizeMode = ResizeMode.CanResizeWithGrip,

                MainContentControl   = { Background = (Brush)Application.Current.Resources["BrushPrimaryLight"] },
                TitleBackgroundPanel = { Background = (Brush)Application.Current.Resources["BrushPrimaryDark"] },
                BorderBrush          = (Brush)Application.Current.Resources["BrushPrimaryDark"]
            };


            msg.BtnCancel.Visibility = Visibility.Collapsed;


            if (!canCopy)
            {
                msg.BtnCopyMessage.Visibility = Visibility.Collapsed;
            }

            msg.Show();

            return(msg.Result);
        } //Show
Exemplo n.º 19
0
 public void Check()
 {
     if (Days() > 0)
     {
         if (cbCustomer.SelectedValue == null || cbEmployee.SelectedValue == null || cbInsurance.SelectedValue == null ||
             cbPickupLoc.SelectedValue == null || cbReturnLoc.SelectedValue == null || cbVehicle.SelectedValue == null)
         {
             var msg = new CustomMaterialMessageBox
             {
                 Width                = 300,
                 Height               = 150,
                 TxtMessage           = { Text = "Please complete all fields!", Foreground = Brushes.BlueViolet },
                 TxtTitle             = { Text = "Reservation", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                 BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                 BtnCancel            = { Width = 0, Height = 0, Content = null },
                 BtnOk                = { Background = Brushes.BlueViolet, },
                 TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                 BorderBrush          = Brushes.BlueViolet
             };
             msg.Show();
         }
         else
         {
             fine = true;
         }
     }
     else
     {
         var msg = new CustomMaterialMessageBox
         {
             Width                = 300,
             Height               = 150,
             TxtMessage           = { Text = "Select correct dates!", Foreground = Brushes.BlueViolet },
             TxtTitle             = { Text = "Reservation", Foreground = Brushes.White, Background = Brushes.BlueViolet },
             BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
             BtnCancel            = { Width = 0, Height = 0, Content = null },
             BtnOk                = { Background = Brushes.BlueViolet, },
             TitleBackgroundPanel = { Background = Brushes.BlueViolet },
             BorderBrush          = Brushes.BlueViolet
         };
         msg.Show();
     }
 }
Exemplo n.º 20
0
        public bool ShowYesNo(string text, string title = "Your answer")
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage           = { Text = text, Foreground = Brushes.Black },
                TxtTitle             = { Text = title, Foreground = Brushes.White },
                BtnOk                = { Content = "OK" },
                MainContentControl   = { Background = Brushes.White },
                TitleBackgroundPanel = { Background = Brushes.BlueViolet },

                BorderBrush = Brushes.BlueViolet
            };

            msg.Show();

            var result = msg.Result;

            return(result == MessageBoxResult.OK);
        }
Exemplo n.º 21
0
        private void Button_Click_8(object sender, RoutedEventArgs e)
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage         = { Text = "Da li ste sigurni da želite da napravite novu datoteku? Sve nesnimnjene promene će biti izgubljene.", Background = FindResource("PrimaryHueMidForegroundBrush") as Brush },
                TxtTitle           = { Text = "Potvrda kreiranja nove datoteke" },
                BtnOk              = { Content = "Da" },
                BtnCancel          = { Content = "Ne" },
                MainContentControl = { Background = FindResource("PrimaryHueMidForegroundBrush") as Brush },
            };

            msg.Show();

            if (msg.Result == MessageBoxResult.OK)
            {
                Putanja         = null;
                GlavniKontejner = new GlavniKontejner();
                LoadMap(GlavniKontejner.Mape[AktivnaMapa]);
                MyCustomMessageQueue.Enqueue("Nova datoteka uspešno kreirana");
            }
        }
Exemplo n.º 22
0
        private void btLogOut_Click(object sender, RoutedEventArgs e)
        {
            var message = new CustomMaterialMessageBox
            {
                Width                = 310, Height = 180,
                TxtTitle             = { Text = "Confirm Logout", Foreground = Brushes.White },
                TxtMessage           = { Text = "Are you sure you want to Logout?" },
                BtnOk                = { Background = Brushes.Crimson, Content = "Yes" },
                BtnCancel            = { Background = Brushes.BlueViolet, Content = "No" },
                TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                BorderBrush          = Brushes.BlueViolet
            };

            message.Show();
            string result = Convert.ToString(message.Result);

            if (result == "OK")
            {
                this.Close();
            }
        }
        public bool ShowQuestionCustomButtonBoolResult(string wiadomosc, string tytul = "Uwaga", string btnOk = "Tak", string btnCancel = "Nie")
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage           = { Text = wiadomosc },
                TxtTitle             = { Text = tytul },
                BtnOk                = { Content = btnOk, Background = Brushes.Gray, BorderBrush = Brushes.Gray },
                BtnCancel            = { Content = btnCancel, Background = Brushes.Gray, BorderBrush = Brushes.Gray },
                TitleBackgroundPanel = { Background = Brushes.OrangeRed },
                BorderBrush          = Brushes.OrangeRed
            };

            msg.Show();
            if (msg.Result == MessageBoxResult.OK)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 24
0
        private void Usun_Click(object sender, RoutedEventArgs e)
        {
            DataRowView row = IdDekretacjiDG.SelectedItem as DataRowView;
            var         id  = row.Row.ItemArray[0].ToString();
            var         msg = new CustomMaterialMessageBox
            {
                TxtMessage           = { Text = "CZY NA PEWNO CHCESZ USUNĄĆ REKORD O ID " + id + " Z BAZY DANYCH ? ", Foreground = Brushes.White },
                TxtTitle             = { Text = "USUWANIE", Foreground = Brushes.White },
                BtnOk                = { Content = "TAK", Background = Brushes.Orange, BorderBrush = Brushes.DimGray },
                BtnCancel            = { Content = "NIE", Background = Brushes.Orange, BorderBrush = Brushes.DimGray },
                MainContentControl   = { Background = Brushes.Gray },
                TitleBackgroundPanel = { Background = Brushes.Orange },
                BorderBrush          = Brushes.Orange
            };

            msg.Show();
            var results = msg.Result;

            if (results.ToString() == "OK")
            {
                try
                {
                    using (var sc = new SqlConnection(connectionString))
                        using (var cmd = sc.CreateCommand())
                        {
                            sc.Open();
                            cmd.CommandText = "DELETE FROM tblIdentyfikatoryAutodekretacji WHERE IdAutodekretacji = @id";
                            cmd.Parameters.AddWithValue("@id", row.Row.ItemArray[0]);
                            cmd.ExecuteNonQuery();
                        }
                }
                catch (Exception error)
                {
                    Error komunikat = new Error(error);
                }

                pobierzIDdekretacji();
            }
        }
Exemplo n.º 25
0
        private void CheckFiles()
        {
            string pathToCAE   = Path.Combine(_FilesFolderPath, _PathAAEDLL, _PathASDLL, _PathCAEEXE, _PathCAECONF, _PathCAECDLL, _PathCAGDLL, _PathCSRCDLL, _PathHCENCDLL, _PathHCENCLITEDLL, _PathVSTDLL);
            bool   bNoCAEFiles = !File.Exists(pathToCAE);

            if (bNoCAEFiles)
            {
                var msg = new CustomMaterialMessageBox
                {
                    TxtMessage           = { Text = "You are missing one or more of the following files.\nAsyncAudioEncoder.dll\nAudioStream.dll\ncriatomencd.exe\ncriatomencd.exe.config\nCriAtomEncoderComponent.dll\nCriAtomGears.dll\nCriSamplingRateConverter.dll\nhcaenc.dll\nhcaenc_lite.dll\nvsthost.dll\n \nRemember these files must be inside the files folder.", Foreground = Brushes.Black },
                    TxtTitle             = { Text = "Error", Foreground = Brushes.White },
                    BtnOk                = { Content = "Ok" },
                    MainContentControl   = { Background = Brushes.White },
                    TitleBackgroundPanel = { Background = Brushes.Red },

                    BorderBrush = Brushes.Red
                };

                msg.Show();
                _CanRun = false;
                Environment.Exit(exitCode: 1);
            }
        }
Exemplo n.º 26
0
        private void print_but_Click(object sender, RoutedEventArgs e)
        {
            var msg = new CustomMaterialMessageBox
            {
                TxtMessage = { Text = "are you sure ? ", Foreground = Brushes.Black },
                TxtTitle   = { Text = "PURCHASE ORDER", Foreground = Brushes.Black },
                BtnOk      = { Content = "Yes" },
                BtnCancel  = { Content = "No" },
                // MainContentControl = { Background = Brushes.MediumVioletRed },
                TitleBackgroundPanel = { Background = Brushes.Yellow },

                BorderBrush = Brushes.Yellow
            };

            msg.Show();
            var results = msg.Result;

            if (results == MessageBoxResult.OK)
            {
                Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.FileName   = "purchase order";            // Default file name
                dlg.DefaultExt = ".pdf";                      // Default file extension
                dlg.Filter     = "PDF document (.pdf)|*.pdf"; // Filter files by extension
                // Show save file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process save file dialog box results
                if (result == true)
                {
                    string    filename = dlg.FileName;
                    Document  document = new Document(PageSize.A4, 10, 10, 10, 10);
                    PdfWriter writer   = PdfWriter.GetInstance(document, new FileStream(filename, FileMode.Create));
                    File.SetAttributes(filename, FileAttributes.Normal);
                    document.Open();
                    string h1 = "\n\n\n\n\n\n\n\n\n\nPURCHASE ORDER\n\n\n";
                    iTextSharp.text.Paragraph p1 = new iTextSharp.text.Paragraph();
                    p1.Alignment = Element.ALIGN_CENTER;
                    p1.Font      = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 20f, BaseColor.BLACK);
                    p1.Add(h1);
                    document.Add(p1);
                    iTextSharp.text.Paragraph p3 = new iTextSharp.text.Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLACK, Element.ALIGN_LEFT, 1)));
                    document.Add(p3);
                    iTextSharp.text.Paragraph p4 = new iTextSharp.text.Paragraph("\n\n\n");
                    document.Add(p4);
                    PdfPTable table1 = new PdfPTable(2);
                    table1.AddCell("ITEM");
                    table1.AddCell("QUANTITY");
                    try
                    {
                        DataTable ds = new DataTable(typeof(Item).Name);

                        //Get all the properties
                        PropertyInfo[] Props = typeof(Item).GetProperties(BindingFlags.Public | BindingFlags.Instance);
                        foreach (PropertyInfo prop in Props)
                        {
                            //Defining type of data column gives proper data table
                            var type = (prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition() == typeof(Nullable <>) ? Nullable.GetUnderlyingType(prop.PropertyType) : prop.PropertyType);
                            //Setting column names as Property names
                            ds.Columns.Add(prop.Name, type);
                        }
                        foreach (Item item in inventory_table.ItemsSource)
                        {
                            var values = new object[Props.Length];
                            for (int i = 0; i < Props.Length; i++)
                            {
                                //inserting property values to datatable rows
                                values[i] = Props[i].GetValue(item, null);
                            }
                            ds.Rows.Add(values);
                        }
                        for (int i = 0; i < ds.Rows.Count; i++)
                        {
                            object o = ds.Rows[i][5];
                            string a = o.ToString();
                            if (o != DBNull.Value)
                            {
                                if (ds.Rows[i][6].ToString() != "0")
                                {
                                    double quantity = Convert.ToDouble(ds.Rows[i][4]) + Convert.ToDouble(ds.Rows[i][6]);
                                    if (quantity >= 0)
                                    {
                                        bool success = dbhandler.purchase_update(ds.Rows[i][1].ToString(), quantity.ToString());
                                        if (success)
                                        {
                                            //log += "ITEM:" + ds.Rows[i][0].ToString() + " PREVIOUS ORDER:" + ds.Rows[i][3].ToString() + " RECENT ORDER:" + ds.Rows[i][5].ToString() + " STATUS: ordered" + " ENTRY :" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                                            table1.AddCell(ds.Rows[i][1].ToString());
                                            table1.AddCell(ds.Rows[i][6].ToString());
                                        }

                                        else
                                        {
                                            MessageBox.Show("FAIL");
                                        }
                                    }

                                    else
                                    {
                                        MessageBox.Show(ds.Rows[i][0].ToString() + ": VALUE CAN'T BE LESS THAN ZERO", "WARNING");
                                    }
                                }
                            }
                        }



                        document.Add(table1);
                        document.Close();
                    }
                    catch (Exception m)
                    {
                        MessageBox.Show(m.Message);
                    }

                    MaterialMessageBox.Show(@"Purchase order generated in " + filename);
                    // dbhandler.log_update(dbhandler.Storelog, log);
                    Items.Clear();
                    table_update();
                }
            }
        }
Exemplo n.º 27
0
        private void btIzmeniVoz_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                izmeni = true;
                Vozilo vozilo = new Vozilo();
                konekcija.Open();
                DataRowView dataRowView = (DataRowView)dgAdmin.SelectedItems[0];
                forma = dataRowView;
                string        select  = "select * from Vehicle where Vehicle_ID = " + dataRowView["ID"];
                SqlCommand    command = new SqlCommand(select, konekcija);
                SqlDataReader reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    vozilo.cbMake.Text         = reader["Make"].ToString();
                    vozilo.txtModel.Text       = reader["Model"].ToString();
                    vozilo.chAir.IsChecked     = Convert.ToBoolean(reader["Air"]);
                    vozilo.cbType.Text         = reader["Type"].ToString();
                    vozilo.cbTransmission.Text = reader["GearBox"].ToString();
                    vozilo.txtFuel.Text        = reader["Consum"].ToString();
                    vozilo.txtPrice.Text       = reader["Price"].ToString();
                    if (reader["Seats"].ToString() == "2")
                    {
                        vozilo.rbSeats2.IsChecked = true;
                    }
                    else if (reader["Seats"].ToString() == "4")
                    {
                        vozilo.rbSeats4.IsChecked = true;
                    }
                    else
                    {
                        vozilo.rbSeats5.IsChecked = true;
                    }
                }
                vozilo.ShowDialog();
            }
            catch (ArgumentOutOfRangeException)
            {
                var msg = new CustomMaterialMessageBox
                {
                    Width                = 300,
                    Height               = 150,
                    TxtMessage           = { Text = "You didnt select a row.", Foreground = Brushes.BlueViolet },
                    TxtTitle             = { Text = "Vehicle", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                    BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                    BtnCancel            = { Width = 0, Height = 0, Content = null },
                    BtnOk                = { Background = Brushes.BlueViolet, },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                msg.Show();
            }
            finally
            {
                if (konekcija != null)
                {
                    konekcija.Close();
                }
                btVozila_Click(sender, e);
                izmeni = false;
            }
        }
Exemplo n.º 28
0
 private void btIzbrisiZap_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         konekcija.Open();
         DataRowView row     = (DataRowView)dgAdmin.SelectedItems[0];
         string      delete  = @"Delete from Employee Where Employee_ID=" + row["ID"];
         var         message = new CustomMaterialMessageBox
         {
             Width                = 310,
             Height               = 180,
             TxtTitle             = { Text = "Confirm Delete", Foreground = Brushes.White },
             TxtMessage           = { Text = "Are you sure?\nThis action cannot be undone. " },
             BtnOk                = { Width = 125, Background = Brushes.Crimson, Content = "Yes,Delete It" },
             BtnCancel            = { Width = 90, Background = Brushes.BlueViolet, Content = "Cancel" },
             TitleBackgroundPanel = { Background = Brushes.BlueViolet },
             BorderBrush          = Brushes.BlueViolet
         };
         message.Show();
         string result = Convert.ToString(message.Result);
         if (result == "OK")
         {
             SqlCommand sql = new SqlCommand(delete, konekcija);
             sql.ExecuteNonQuery();
         }
     }
     catch (ArgumentOutOfRangeException)
     {
         var msg = new CustomMaterialMessageBox
         {
             Width                = 300,
             Height               = 150,
             TxtMessage           = { Text = "You didnt select a row.", Foreground = Brushes.BlueViolet },
             TxtTitle             = { Text = "Employee", Foreground = Brushes.White, Background = Brushes.BlueViolet },
             BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
             BtnCancel            = { Width = 0, Height = 0, Content = null },
             BtnOk                = { Background = Brushes.BlueViolet, },
             TitleBackgroundPanel = { Background = Brushes.BlueViolet },
             BorderBrush          = Brushes.BlueViolet
         };
         msg.Show();
     }
     catch (SqlException)
     {
         var msg = new CustomMaterialMessageBox
         {
             Width                = 300,
             Height               = 150,
             TxtMessage           = { Text = "There is a relationship with other tables.", Foreground = Brushes.BlueViolet },
             TxtTitle             = { Text = "Employee", Foreground = Brushes.White, Background = Brushes.BlueViolet },
             BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
             BtnCancel            = { Width = 0, Height = 0, Content = null },
             BtnOk                = { Background = Brushes.BlueViolet, },
             TitleBackgroundPanel = { Background = Brushes.BlueViolet },
             BorderBrush          = Brushes.BlueViolet
         };
         msg.Show();
     }
     finally
     {
         if (konekcija != null)
         {
             konekcija.Close();
         }
         btZaposleni_Click(sender, e);
     }
 }
Exemplo n.º 29
0
        private void ADD(double total)
        {
            try
            {
                konekcija.Open();
                if (AdminMain.izmeni)
                {
                    DataRowView   row      = (DataRowView)AdminMain.forma;
                    string        select   = "select Extras_ID from Reservation where Reservation_ID=" + row["ID"];
                    SqlCommand    command  = new SqlCommand(select, konekcija);
                    SqlDataReader reader   = command.ExecuteReader();
                    string        idextras = "";
                    while (reader.Read())
                    {
                        idextras = reader[0].ToString();
                    }
                    reader.Close();

                    string     extras    = @"Update Extras set Wifi='" + Convert.ToString(chWiFi.IsChecked.Value) + "',RoofBox='" + Convert.ToString(chRoof.IsChecked.Value) + "',Booster='" + Convert.ToString(chBooster.IsChecked.Value) + "',GPS='" + Convert.ToString(chGPS.IsChecked.Value) + "',BikeRack='" + Convert.ToString(chBike.IsChecked.Value) + "',Fuel='" + Convert.ToString(chFuel.IsChecked.Value) + "',Phone='" + Convert.ToString(chPhone.IsChecked.Value) + "',BabySeat='" + Convert.ToString(chBaby.IsChecked.Value) + "',Winter='" + Convert.ToString(chWinter.IsChecked.Value) + "' where Extras_ID=" + idextras;
                    SqlCommand sqlextras = new SqlCommand(extras, konekcija);
                    sqlextras.ExecuteNonQuery();
                    string upit = @"Update Reservation Set [Pick Date]='" + dpPickTime.Text + "' , [Pick Location] = '" + cbPickupLoc.Text + "', [Return Date] = '" + dpReturnTime.Text +
                                  "', [Return Location]='" + cbReturnLoc.Text + "' , Price ='" + Convert.ToString(total) + "',Customer_ID='" + cbCustomer.SelectedValue + "', Employee_ID='" + cbEmployee.SelectedValue + "',Vehicle_ID='" + cbVehicle.SelectedValue + "',Insurance_ID='" + cbInsurance.SelectedValue + "' Where Reservation_ID=" + row["ID"];
                    SqlCommand cmd = new SqlCommand(upit, konekcija);
                    cmd.ExecuteNonQuery();
                    AdminMain.forma = null;
                }
                else
                {
                    string     extras    = @"insert into Extras(WiFi,RoofBox,Booster,GPS,BikeRack,Fuel,Phone,BabySeat,Winter)
                        values ('" + Convert.ToString(chBaby.IsChecked.Value) + "','" + Convert.ToString(chWiFi.IsChecked.Value) + "','" + Convert.ToString(chFuel.IsChecked.Value) + "','" + Convert.ToString(chBike.IsChecked.Value) + "','" + Convert.ToString(chGPS.IsChecked.Value) + "','" + Convert.ToString(chWinter.IsChecked.Value) + "','" + Convert.ToString(chBooster.IsChecked.Value) + "','" + Convert.ToString(chRoof.IsChecked.Value) + "','" + Convert.ToString(chPhone.IsChecked.Value) + "');";
                    SqlCommand sqlextras = new SqlCommand(extras, konekcija);
                    sqlextras.ExecuteNonQuery();

                    string        select  = "select IDENT_CURRENT('Extras')";
                    SqlCommand    command = new SqlCommand(select, konekcija);
                    SqlDataReader reader  = command.ExecuteReader();
                    string        id      = "";
                    while (reader.Read())
                    {
                        id = reader[0].ToString();
                    }
                    reader.Close();
                    string     insert = @"insert into Reservation([Pick Date],[Pick Location],[Return Date],[Return Location],Customer_ID,Employee_ID,Vehicle_ID,Insurance_ID,Price,Extras_ID)
                        values ('" + dpPickTime.Text + "','" + cbPickupLoc.Text + "','" + dpReturnTime.Text + "','" + cbReturnLoc.Text + "'," + cbCustomer.SelectedValue + "," + cbEmployee.SelectedValue + "," + cbVehicle.SelectedValue + "," + cbInsurance.SelectedValue + "," + Convert.ToString(total) + "," + id + ");";
                    SqlCommand sql    = new SqlCommand(insert, konekcija);
                    sql.ExecuteNonQuery();

                    var msg = new CustomMaterialMessageBox
                    {
                        Width                = 300,
                        Height               = 150,
                        TxtMessage           = { Text = "New reservation is added to the database.", Foreground = Brushes.BlueViolet },
                        TxtTitle             = { Text = "Reservation", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                        BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                        BtnCancel            = { Width = 0, Height = 0, Content = null },
                        BtnOk                = { Background = Brushes.BlueViolet, },
                        TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                        BorderBrush          = Brushes.BlueViolet
                    };
                    msg.Show();
                }
            }
            catch (SqlException)
            {
                var msg = new CustomMaterialMessageBox
                {
                    Width                = 300,
                    Height               = 150,
                    TxtMessage           = { Text = "Something went wrong.", Foreground = Brushes.BlueViolet },
                    TxtTitle             = { Text = "Reservation", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                    BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                    BtnCancel            = { Width = 0, Height = 0, Content = null },
                    BtnOk                = { Background = Brushes.BlueViolet, },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                msg.Show();
            }
            finally
            {
                if (konekcija != null)
                {
                    konekcija.Close();
                }
                this.Close();
            }
        }
Exemplo n.º 30
0
        private void btAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string gender = RadioButtonGender();
                konekcija.Open();
                if (AdminMain.izmeni)
                {
                    DataRowView row = (DataRowView)AdminMain.forma;

                    string upit = @"Update Employee Set Name ='" + txtName.Text + "' , [Last Name] = '" + txtSecond.Text + "', [Birth Date] = '" + dataBirth.Text +
                                  "', City='" + cbCity.Text + "' , [e-mail] ='" + txtEmail.Text + "',Phone='" + txtPhone.Text + "', Gender='" + gender + "',[Job Title]='" + cbTitle.Text + "',[Employment Type]='" + cbType.Text + "' Where Employee_ID=" + row["ID"];

                    SqlCommand cmd = new SqlCommand(upit, konekcija);
                    cmd.ExecuteNonQuery();
                    AdminMain.forma = null;
                }
                else
                {
                    string     insert = @"insert into Employee(Name,[Last Name],[Birth Date],Gender,Phone,[e-mail],City,[Job Title],[Employment Type])
                                values ('" + txtName.Text + "','" + txtSecond.Text + "','" + dataBirth.Text + "','" + gender + "','" + txtPhone.Text + "','" + txtEmail.Text + "','" + cbCity.Text + "','" + cbTitle.Text + "','" + cbType.Text + "');";
                    SqlCommand sql    = new SqlCommand(insert, konekcija);
                    sql.ExecuteNonQuery();
                    var msg = new CustomMaterialMessageBox
                    {
                        Width                = 300,
                        Height               = 150,
                        TxtMessage           = { Text = "New employee is added to the database.", Foreground = Brushes.BlueViolet },
                        TxtTitle             = { Text = "Employee", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                        BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                        BtnCancel            = { Width = 0, Height = 0, Content = null },
                        BtnOk                = { Background = Brushes.BlueViolet, },
                        TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                        BorderBrush          = Brushes.BlueViolet
                    };
                    msg.Show();
                }
            }
            catch (SqlException)
            {
                var msg = new CustomMaterialMessageBox
                {
                    Width                = 300,
                    Height               = 150,
                    TxtMessage           = { Text = "Something went wrong.", Foreground = Brushes.BlueViolet },
                    TxtTitle             = { Text = "Employee", Foreground = Brushes.White, Background = Brushes.BlueViolet },
                    BtnCopyMessage       = { Width = 0, Height = 0, Content = null },
                    BtnCancel            = { Width = 0, Height = 0, Content = null },
                    BtnOk                = { Background = Brushes.BlueViolet, },
                    TitleBackgroundPanel = { Background = Brushes.BlueViolet },
                    BorderBrush          = Brushes.BlueViolet
                };
                msg.Show();
            }
            finally
            {
                if (konekcija != null)
                {
                    konekcija.Close();
                }
                this.Close();
            }
        }