Exemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Eleot.EleotDataSet eleotDataSet = ((EleotDataSet)(FindResource("eleotDataSet")));
            // Загрузить данные в таблицу Personal. Можно изменить этот код как требуется.
            EleotDataSetTableAdapters.PersonalTableAdapter eleotDataSetPersonalTableAdapter =
                new EleotDataSetTableAdapters.PersonalTableAdapter();
            eleotDataSetPersonalTableAdapter.Fill(eleotDataSet.Personal);
            personalViewSource = ((CollectionViewSource)(FindResource("personalViewSource")));
            personalViewSource.View.MoveCurrentToFirst();
            _currentPosition = personalViewSource.View.CurrentPosition;

            sql = "select id_person,firstName,secondName,data_birth," +
                  "isMale,adress,salary,position,phone from personal";
            SqlConnection conn = new SqlConnection(cs);

            da  = new SqlDataAdapter(sql, conn);
            cmd = new SqlCommandBuilder(da);
            set = new DataSet();
            da.Fill(set, "myPersonalDate");
            StringBuilder sb = new StringBuilder();

            Gr1.ItemsSource = set.Tables["myPersonalDate"].DefaultView;
            Gr1.TabIndex    = 0;
            KeyboardNavigation.SetTabNavigation(Gr1, KeyboardNavigationMode.Cycle);
            KeyboardNavigation.SetDirectionalNavigation(Gr1, KeyboardNavigationMode.Cycle);

            //Gr1.SelectedIndex = 0;
            Gr1.Focus();
            //SelectRowByIndex(Gr1, _currentPosition);

            //IInputElement focusedElement = FocusManager.GetFocusedElement(Gr1);
            //FocusManager.SetFocusedElement(Gr1, focusedElement);
            //DataGridCell cell = GetCell(Gr1, (DataGridRow)Gr1.SelectedItems[0], 0);
            //cell.Focus();
        }
Exemplo n.º 2
0
        private void Gen_zam_Click(object sender, EventArgs e)
        {
            if (Wys1 <= 800 && Wys1 >= 350)
            {
                RAPORT_Click(sender, e);



                StreamWriter EXP = new StreamWriter(Filename2, true);
                EXP.Write("\nUwagi AVENTOS HS");

                if (WHITE.Checked)
                {
                    EXP.Write(" biały");
                }
                else if (GREY.Checked)
                {
                    EXP.Write(" szary");
                }
                else if (ANTRACYT.Checked)
                {
                    EXP.Write(" antracytowy");
                }
                if (SERVO.Checked)
                {
                    EXP.Write(" z SERVO-DRIVE");
                }
                EXP.Write(":\n");

                EXP.WriteLine("Do szafek w ilości: " + Ilosci.Text);

                if (Drew.Checked)
                {
                    EXP.WriteLine("Front Drewniany:");
                }
                else if (Drew_ramka.Checked)
                {
                    EXP.WriteLine("Ramka drewniana:");
                }
                else if (Ram_ale_was.Checked)
                {
                    EXP.WriteLine("Rama aluminiowa wąska:");
                }
                else if (Ram_alu_sze.Checked)
                {
                    EXP.WriteLine("Rama aluminiowa szeroka:");
                }

                EXP.WriteLine("Wysokość: " + Wys1.ToString() + " mm");
                EXP.WriteLine("Szerokość: " + Sz1.ToString() + " mm");
                EXP.WriteLine("Grubość: " + Gr1.ToString() + " mm");
                EXP.WriteLine("Waga: " + Masa.ToString() + " Kg.");
                if (Drew.Checked || Drew_ramka.Checked)
                {
                    string pom = "Front z ";
                    if (material_wood.SelectedIndex == 0)
                    {
                        pom += "MDF";
                        pom += " o wadze: " + Waga_FR.Text;
                        EXP.WriteLine(pom);
                    }
                    else if (material_wood.SelectedIndex == 1)
                    {
                        pom += "płyty wiórowej";
                        pom += " o wadze: " + Waga_FR.Text;
                        EXP.WriteLine(pom);
                    }
                    else if (material_wood.SelectedIndex == 2)
                    {
                        pom += "innego materiału";
                        pom += " o wadze: " + Waga_FR.Text;
                        EXP.WriteLine(pom);
                    }
                    else
                    {
                        EXP.WriteLine("Front o wadze: " + Waga_FR.Text);
                    }
                }
                else
                {
                    EXP.WriteLine("Front o wadze: " + Waga_FR.Text);
                }
                EXP.WriteLine("\n" + textBox1.Text);
                EXP.Close();

                Ilosci.Text   = "";
                textBox1.Text = "";

                WHITE.Checked    = false;
                GREY.Checked     = false;
                ANTRACYT.Checked = false;

                Drew.Checked        = false;
                Drew_ramka.Checked  = false;
                Ram_alu_sze.Checked = false;
                Ram_ale_was.Checked = false;

                wy_fr.Text        = "";
                wys_com.Visible   = false;
                sz_fr.Text        = "";
                sz_com.Visible    = false;
                Gr_fr.Text        = "";
                gr_fr_com.Visible = false;
                sz_ram.Text       = "";
                ram_com.Visible   = false;
                gr_szk.Text       = "";
                szklo_com.Visible = false;
                wp_szk.Text       = "";
                wp_com.Visible    = false;
                MessageBox.Show("Dodano pozycje do zamówienia", "Dodano", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Minimalna wysokość frontu do użytku z siłownikiem HS wynosi 350mm\nnatomiast maksymalna dopuszczalna wysokość to 800mm.", "Przekroczono wysokość", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }