Пример #1
0
 public MainFormClient(clients_table client)
 {
     InitializeComponent();
     user = client;
     AboutMeTextSetter();
     DebtNotifierShow();
     FillDataGrid3();
     FillComboBox2();
 }
Пример #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            clients_table client = new clients_table();

            var countOfRows = db.clients_table.Count();
            var lastRow     = db.clients_table.OrderBy(c => 1 == 1).Skip(countOfRows - 1).FirstOrDefault();

            client.client_id      = lastRow.client_id + 1;
            client.name           = textBox2.Text.Trim();
            client.phone_number   = int.Parse(textBox3.Text.Trim());
            client.street         = textBox4.Text.Trim();
            client.flat           = textBox5.Text.Trim();
            client.house          = textBox6.Text.Trim();
            client.persons        = int.Parse(textBox7.Text.Trim());
            client.dwelling_space = double.Parse(textBox8.Text.Trim());
            db.clients_table.Add(client);
            db.SaveChanges();

            dataGridView2.DataSource = db.clients_table.ToList();
        }
Пример #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            //sumbit
            using (PSEntity db = new PSEntity())
            {
                var clients    = db.client_acc_table;
                var clientInfo = db.clients_table;
                var workerInfo = db.worker_table;
                var workers    = db.staff_acc_table;

                foreach (client_acc_table item in clients)
                {
                    if (LoginText.Text.Trim() == item.username && PasswordText.Text.Trim() == item.password)
                    {
                        foreach (clients_table cli3nt in clientInfo)
                        {
                            if (item.client_id == cli3nt.client_id)
                            {
                                client = cli3nt;
                            }
                        }

                        MessageService.SuccsesfulLogin();

                        MainFormClient mainFormClient = new MainFormClient(client);
                        this.Hide();
                        mainFormClient.Show();
                    }
                }

                foreach (staff_acc_table item in workers)
                {
                    if (LoginText.Text.Trim() == item.username && PasswordText.Text.Trim() == item.password)
                    {
                        foreach (worker_table work3r in workerInfo)
                        {
                            if (work3r.worker_id == item.worker_id)
                            {
                                switch (item.role_id)
                                {
                                case 1:
                                {
                                    MessageService.SuccsesfulLogin();
                                    this.Hide();
                                    MainFormDir MainFormEconom = new MainFormDir(work3r);
                                    MainFormEconom.Show();
                                    break;
                                }

                                case 2:
                                {
                                    MessageService.SuccsesfulLogin();
                                    this.Hide();
                                    MainFormEconom MainFormEconom = new MainFormEconom(work3r);
                                    MainFormEconom.Show();
                                    break;
                                }

                                case 3:
                                {
                                    MessageService.SuccsesfulLogin();
                                    this.Hide();
                                    MainFormHH MainFormEconom = new MainFormHH(work3r);
                                    MainFormEconom.Show();
                                    break;
                                }

                                case 4:
                                {
                                    MessageService.SuccsesfulLogin();
                                    this.Hide();
                                    MainFormAcc mainForm = new MainFormAcc(work3r);
                                    this.Hide();
                                    mainForm.Show();
                                    break;
                                }
                                }
                            }
                        }
                    }
                }

                if (client == null && worker == null)
                {
                    MessageService.FailedLogin();
                    Login.Text = PasswordText.Text = "";
                }
            }
        }