Exemple #1
0
        private void GuestJoin_Click(object sender, RoutedEventArgs e)
        {
            var gw = new GuestWindow();

            gw.Show();
            Close();
        }
Exemple #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var settings = new ServerMetaDats()
            {
                TypeClassSend = "Users",
                SendMessage   = true,
                GetItem       = true,
                GetType       = 1
            };
            var userSend = new Users()
            {
                UserMail     = Mail.Text,
                UserPassword = Password.Password,
            };

            DataSender.OperationDataSend(JsonSerializer.Serialize(settings));
            DataSender.OperationDataSend(JsonSerializer.Serialize(userSend));
            var userGet = JsonSerializer.Deserialize <Users>(DataSender.Message);

            switch (userGet?.UserRoleId)
            {
            case 1:
                var settings2 = new ServerMetaDats()
                {
                    TypeClassSend = "Employees",
                    SendMessage   = true,
                    GetItem       = true,
                    GetType       = 2
                };
                var admin = string.Empty;

                DataSender.OperationDataSend(JsonSerializer.Serialize(settings2));
                DataSender.OperationDataSend(JsonSerializer.Serialize(admin));

                var adm = (JsonSerializer.Deserialize <List <Employees> >(DataSender.Message))
                          .First(x => x.EmployeesMail == userGet.UserMail);
                var adminWindow = new AdminWindow(userGet, adm);
                adminWindow.Show();
                Close();
                break;

            case 2:
                var userWindow = new UserWindow(userGet);
                userWindow.Show();
                Close();
                break;

            case 3:
                var guestWindow = new GuestWindow();
                guestWindow.Show();
                Close();
                break;

            case 4:
                var settings1 = new ServerMetaDats()
                {
                    TypeClassSend = "Employees",
                    SendMessage   = true,
                    GetItem       = true,
                    GetType       = 2
                };
                var curator = string.Empty;

                DataSender.OperationDataSend(JsonSerializer.Serialize(settings1));
                DataSender.OperationDataSend(JsonSerializer.Serialize(curator));

                var eml = (JsonSerializer.Deserialize <List <Employees> >(DataSender.Message))
                          .First(x => x.EmployeesMail == userGet.UserMail);

                var employeesWindow = new EmployeeWindow(userGet, eml);
                employeesWindow.Show();
                Close();
                break;
            }
        }