예제 #1
0
        private void del_b_Click(object sender, RoutedEventArgs e)
        {
            doc ts = dg.SelectedItem as doc;

            if (ts == null)
            {
                return;
            }
            admin.doc.Remove(ts);
            admin.SaveChanges();
            datag();
        }
예제 #2
0
        public DocWindow()
        {
            string name, surname, lastname;

            InitializeComponent();
            doc b = admin.doc.Where(c => c.id_doc == Get.doc_id).SingleOrDefault();

            name        = b.name;
            surname     = b.surname;
            lastname    = b.last_name;
            doc_tb.Text = ($"{surname} {name} {lastname}");

            list_dg(dg);
        }
예제 #3
0
        private void dg_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            doc a = dg.SelectedItem as doc;

            if (a == null)
            {
                return;
            }

            name_tb.Text      = a.name;
            surname_tb.Text   = a.surname;
            last_name_tb.Text = a.last_name;
            num_tb.Text       = a.p_num;
            log_tb.Text       = a.login;
            pass_tb.Text      = a.password;
        }
예제 #4
0
        private void add_b_Click(object sender, RoutedEventArgs e)
        {
            doc a = new doc
            {
                name        = name_tb.Text,
                surname     = surname_tb.Text,
                last_name   = last_name_tb.Text,
                p_num       = num_tb.Text,
                id_position = pos_cb.SelectedIndex + 1,
                login       = log_tb.Text,
                password    = pass_tb.Text
            };

            admin.doc.Add(a);
            admin.SaveChanges();
            datag();
        }
예제 #5
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            doc a = dg.SelectedItem as doc;

            if (a == null)
            {
                return;
            }

            a.name      = name_tb.Text;
            a.surname   = surname_tb.Text;
            a.last_name = last_name_tb.Text;
            a.p_num     = num_tb.Text;
            a.login     = log_tb.Text;
            a.password  = pass_tb.Text;

            admin.SaveChanges();
            datag();
        }
예제 #6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            doc b = a.doc.Where(c => c.login == login_tb.Text && c.password == password_tb.Text).SingleOrDefault();

            try
            {
                Get.doc_id = b.id_doc;
            }
            catch (System.NullReferenceException)
            {
                Get.doc_id = 1;
            }

            if (b == null)
            {
                MessageBox.Show("Ошибка, повторите введение логина и пароля");
            }
            else if (b.login == "admin" && b.password == "admin")
            {
                Get.admin = 1;
                ReceptionWindow a = new ReceptionWindow();
                a.Show();
                this.Close();
            }
            else if (b.id_position == 1)
            {
                ReceptionWindow a = new ReceptionWindow();
                a.Show();
                this.Close();
            }
            else
            {
                DocWindow a = new DocWindow();
                a.Show();
                this.Close();
            }
        }
예제 #7
0
        private void doc_dg_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            doc a = doc_dg.SelectedItem as doc;

            Get.doc_id = a.id_doc;
        }