private async Task Get_Time()
        {
            IEnumerable <ResultParticipant> resultParticipations = await resultParticipationServise.Get();

            IEnumerable <Participation> participations = await participationService.Get();

            IEnumerable <Distantion> distantions = await distantionsServise.Get();

            IEnumerable <Competentions> competentions = await competentionsServise.Get();

            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            var info = from r in resultParticipations
                       join p in participations on r.IdParticipation equals p.IdParticipation
                       join c in competentions on p.IdCompetentions equals c.IdCompetentions
                       join d in distantions on c.IdDistantion equals d.IdDistantion
                       join i in infoUsers on p.IdUser equals i.IdUsers
                       select new
            {
                r.ResultTime,
                r.Mesto,
                d.NameDistantion,
                i.Login,
                r.IdResultParticipation
            };

            var res = info.ToList();

            if (counts < res.Count || counts > res.Count)
            {
                lstData.ItemsSource = res;
                counts = res.Count;
            }
        }
        private async Task Get_Time()
        {
            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            IEnumerable <CategoriYars> categoriYars = await categoriYarsServise.Get();

            IEnumerable <Participation> participations = await participationService.Get();

            IEnumerable <Distantion> distantions = await distantionsServise.Get();

            IEnumerable <Competentions> competentions = await competentionsServise.Get();

            var info = from p in participations
                       join k in competentions on p.IdCompetentions equals k.IdCompetentions
                       join d in distantions on k.IdDistantion equals d.IdDistantion
                       join i in infoUsers on p.IdUser equals i.IdUsers
                       select new
            {
                p.IdUser,
                i.Login,
                k.Date,
                p.IdStatusVerification,
                d.NameDistantion,
            };
            var res = info.ToList();

            if (counts < res.Count || counts > res.Count)
            {
                lstData.ItemsSource = res;
                counts = res.Count;
            }
        }
Example #3
0
        private async Task Poisk(string filtr)
        {
            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            switch (filtr)
            {
            case "PoiskLogin": infoUsers = infoUsers.Where(p => p.Login == PoiskLogin.Text || p.Login.StartsWith(PoiskLogin.Text)); break;

            case "PoiskName": infoUsers = infoUsers.Where(p => p.Name == PoiskName.Text || p.Name.StartsWith(PoiskName.Text)); break;

            case "PoiskFam": infoUsers = infoUsers.Where(p => p.Fam == PoiskFam.Text || p.Fam.StartsWith(PoiskFam.Text)); break;
            }
            var res = infoUsers.ToList();

            if (res.Count != 0)
            {
                lstData.ItemsSource = res;
                YesRecords.Height   = new GridLength(1, GridUnitType.Star);
                NoRecords.Height    = 0;
            }
            else
            {
                lstData.ItemsSource = res;
                YesRecords.Height   = 0;
                NoRecords.Height    = new GridLength(1, GridUnitType.Star);
            }
        }
Example #4
0
        private async Task Poisk(string filtr)
        {
            InfoUser loginUsers = await loginUsersService.Get(App.Current.Properties["token"].ToString());

            IEnumerable <ResultParticipant> resultParticipations = await resultParticipationServise.Get();

            IEnumerable <Participation> participations = await participationService.Get();

            IEnumerable <Distantion> distantions = await distantionsServise.Get();

            IEnumerable <Competentions> competentions = await competentionsServise.Get();

            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            var info = from r in resultParticipations
                       join p in participations on r.IdParticipation equals p.IdParticipation
                       join c in competentions on p.IdCompetentions equals c.IdCompetentions
                       join d in distantions on c.IdDistantion equals d.IdDistantion
                       join i in infoUsers on p.IdUser equals i.IdUsers
                       select new
            {
                r.ResultTime,
                r.Mesto,
                d.NameDistantion,
                c.Date,
                i.IdUsers,
                p.IdStatusVerification,
                r.IdResultParticipation,
            };

            info = info.Where(x => x.IdUsers == loginUsers.IdUsers);
            switch (filtr)
            {
            case "PoiskNameDistans": info = info.Where(p => p.NameDistantion == PoiskNameDistans.Text || p.NameDistantion.StartsWith(PoiskNameDistans.Text)); break;

            case "PoiskDate": info = info.Where(p => p.Date == ID_Time); break;
            }
            var res = info.ToList();

            if (res.Count != 0)
            {
                lstData.ItemsSource = res;
                YesRecords.Height   = new GridLength(1, GridUnitType.Star);
                NoRecords.Height    = 0;
            }
            else
            {
                lstData.ItemsSource = res;
                YesRecords.Height   = 0;
                NoRecords.Height    = new GridLength(1, GridUnitType.Star);
            }
        }
        private async Task GetInfomationAsync()
        {
            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            IEnumerable <CategoriYars> categoriYars = await categoriYarsServise.Get();

            IEnumerable <Participation> participations = await participationService.Get();

            IEnumerable <Distantion> distantions = await distantionsServise.Get();

            IEnumerable <Competentions> competentions = await competentionsServise.Get();

            var info = from p in participations
                       join k in competentions on p.IdCompetentions equals k.IdCompetentions
                       join d in distantions on k.IdDistantion equals d.IdDistantion
                       join i in infoUsers on p.IdUser equals i.IdUsers
                       select new
            {
                p.IdUser,
                i.Login,
                k.Date,
                p.IdStatusVerification,
                d.NameDistantion,
            };
            var res = info.ToList();
        }
Example #6
0
        public async Task <string> GetClient(int ID)
        {
            RegistrationUsersService registrationUsersService = new RegistrationUsersService();
            IEnumerable <InfoUser>   infoUsers = await registrationUsersService.Get_user();

            var user = infoUsers.FirstOrDefault(x => x.IdUsers == ID);

            return(user.Email);
        }
Example #7
0
        private async Task Get()
        {
            IEnumerable <ResultParticipant> resultParticipations = await resultParticipationServise.Get();

            IEnumerable <Participation> participations = await participationService.Get();

            IEnumerable <Distantion> distantions = await distantionsServise.Get();

            IEnumerable <Competentions> competentions = await competentionsServise.Get();

            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            var info = from r in resultParticipations
                       join p in participations on r.IdParticipation equals p.IdParticipation
                       join c in competentions on p.IdCompetentions equals c.IdCompetentions
                       join d in distantions on c.IdDistantion equals d.IdDistantion
                       join i in infoUsers on p.IdUser equals i.IdUsers
                       select new
            {
                d.NameDistantion,
                i.Login,
                r.IdResultParticipation
            };

            var groups = from p in info
                         group p by p.NameDistantion into g
                         select new
            {
                g.Key,
                Count = g.Count()
            };

            List <Entry> entries = new List <Entry>(groups.Count());

            int k = 0;

            string[] color = new string[] { "#dbf720", "#42d62b", "#cf2934", "#f20acb", "#9090e8", "#183bed", "#926eae", "#FF1943", "#ab5b68", "#0af2bc", "#cac4b0", "#fa0f0f", "#18ed54" };
            foreach (var item in groups)
            {
                if (color.Length == k++)
                {
                    k = 0;
                }
                entries.Add(new Entry(item.Count)
                {
                    Color      = SKColor.Parse(color[k]),
                    Label      = item.Key,
                    ValueLabel = item.Count.ToString()
                });
            }
            Chart2.Chart = new LineChart()
            {
                Entries = entries
            };
            // Chart4.Chart = new BarChart() { Entries = entries };
        }
Example #8
0
        public async Task <string> GetClient()
        {
            RegistrationUsersService registrationUsersService = new RegistrationUsersService();
            IEnumerable <InfoUser>   infoUsers = await registrationUsersService.Get_user();

            var    user = infoUsers.FirstOrDefault(x => x.Login == Login_Entry.Text);
            string ID   = user.IdUsers.ToString();

            return(ID);
        }
        private async Task Criate_LoginPicer(bool status)
        {
            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            LoginPicer = new Picker {
                Margin = new Thickness(10, -10, 10, 5)
            };
            if (status)
            {
                infoUsers = infoUsers.Where(p => p.Login == PoiskLogin.Text || p.Login.StartsWith(PoiskLogin.Text));
            }
            foreach (var item in infoUsers)
            {
                LoginPicer.Items.Add(item.Login);
            }

            LoginPicer.SelectedIndexChanged += async(s, e) =>
            {
                IEnumerable <UserHelth> userHelths = await registrationUsersService.get_hels_status();

                var picker_list      = infoUsers.FirstOrDefault(x => x.Login == LoginPicer.Items[LoginPicer.SelectedIndex].ToString());
                var picker_list_Hels = userHelths.FirstOrDefault(x => x.IdHealth == picker_list.IdHelth);
                IDUser            = picker_list.IdUsers;
                Info_Editor.Text  = "";
                Info_Editor.Text  = "Login: "******"\r\n";
                Info_Editor.Text += "E-mail: " + picker_list.Email + "\r\n";
                Info_Editor.Text += "ФИО: " + picker_list.Fam + " " + picker_list.Name + " " + picker_list.Patronimic + "\r\n";
                Info_Editor.Text += "Возраст: " + picker_list.Years + "\r\n";
                Info_Editor.Text += "Статус здоровья: " + picker_list_Hels.NameHealth + "\r\n";
                if (picker_list.Isman == true)
                {
                    Info_Editor.Text += "Пол: Мужской" + "\r\n";
                }
                else
                {
                    Info_Editor.Text += "Пол: Женский" + "\r\n";
                }
            };

            GridMain.Children.Add(LoginPicer, 1, 2);
            // LoginPicer.SelectedIndex = 1;
        }
Example #10
0
        public async Task Criate()
        {
            InfoUser loginUsers = await loginUsersService.Get(App.Current.Properties["token"].ToString());

            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            IEnumerable <Participation> participations = await participationService.Get();

            IEnumerable <Distantion> distantions = await distantionsServise.Get();

            IEnumerable <Competentions> competentions = await competentionsServise.Get();

            var info = from p in participations
                       join k in competentions on p.IdCompetentions equals k.IdCompetentions
                       join d in distantions on k.IdDistantion equals d.IdDistantion
                       join i in infoUsers on p.IdUser equals i.IdUsers
                       select new
            {
                p.IdUser,
                i.Login,
                k.Date,
                p.IdStatusVerification,
                d.NameDistantion,
            };
            DateTime selectd_date = Convert.ToDateTime(SelectDate.Items[SelectDate.SelectedIndex]);
            var      picker_list  = info.FirstOrDefault(x => x.IdUser == loginUsers.IdUsers &&
                                                        x.NameDistantion == CompetentionsPicer.Items[CompetentionsPicer.SelectedIndex] && x.Date == selectd_date);

            if (picker_list == null)
            {
                if (await Date_TestAsync())
                {
                    if (IDUser != 0 && IDCompitention != 0)
                    {
                        Participation participation = new Participation
                        {
                            IdCompetentions      = IDCompitention,
                            IdUser               = IDUser,
                            IdStatusVerification = true
                        };

                        await participationService.Add(participation);
                        await DownloadBage();

                        await Navigation.PopModalAsync();
                    }
                    else
                    {
                        if (!await DisplayAlert("Ошибка", "Вы заполнили не все поля", "Заполнить", "Выйти"))
                        {
                            await Navigation.PopModalAsync();
                        }
                    }
                }
            }
            else
            {
                if (!await DisplayAlert("Предупреждение", "Вы уже зарегистрированы на эту дисциплину", "Зарегистрироваться на другую", "Выйти"))
                {
                    await Navigation.PopModalAsync();
                }
            }
        }
        public AddUsersPage(int id, string status_form)
        {
            InitializeComponent();

            if (!connectClass.CheckConnection())
            {
                Connect_ErrorAsync();
            }                                                             //Проверка интернета при загрузке формы
            CrossConnectivity.Current.ConnectivityChanged += (s, e) => { if (!connectClass.CheckConnection())
                                                                         {
                                                                             Connect_ErrorAsync();
                                                                         }
            };
            get_users(id);
            GetPicerAsync();

            if (id == 0 && status_form == "MainPage" || status_form == "Redacting")
            {
                Rol_Picker.IsEnabled = false;
                RolUser = "******";
            }

            Pol_Picer.SelectedIndex  = 1;
            Rol_Picker.SelectedIndex = 1;
            pol = true;

            User_Image.Source = ImageSource.FromResource(picture_lincs.LinksResourse() + "nophotouser.png");
            image_fon.Source  = ImageSource.FromResource(picture_lincs.GetFon());
            //Users_Fon_Images.Source = ImageSource.FromResource(picture_lincs.LinksResourse() + "UserFon.png");
            password_status_image.Source   = ImageSource.FromResource(picture_lincs.LinksResourse() + "anvisible_password.png");//Инициализация статуса пароля
            password_status_image.Clicked += (s, e) => { Password_IsVisible(); };

            Pol_Picer.SelectedIndexChanged += (s, e) =>
            {
                if (Pol_Picer.Items[Pol_Picer.SelectedIndex].ToString() == "Мужской")
                {
                    pol = true;
                }
                else
                {
                    pol = false;
                }
            };
            Rol_Picker.SelectedIndexChanged += (s, e) =>
            {
                if (Rol_Picker.Items[Rol_Picker.SelectedIndex].ToString() == "Администратор")
                {
                    RolUser = "******";
                }
                else
                {
                    RolUser = "******";
                }
            };

            Registrations_Button.Clicked += async(s, e) =>
            {
                if (id == 0)
                {
                    await reg_userAsync(status_form);
                }
                else
                {
                    await update_userAsync(id);
                }
            };

            Save_Picture_Button.Clicked += async(s, e) =>
            {
                if (Device.RuntimePlatform == Device.Android)
                {
                    await getPhotoingaleriAsync();
                }
                else
                {
                    if (await DisplayAlert("", "Сделать снимок ?", "Да", "Нет"))
                    {
                        await takePhotoAsync();
                    }
                    else
                    {
                        await getPhotoingaleriAsync();
                    }
                }
            };

            Back_Button.Clicked += async(s, e) =>
            {
                //animations.Animations_Button(Back_Button);
                //await Task.Delay(1000);
                await Navigation.PopModalAsync();//Переход назад
            };
            Generate_Password_CheckBox.CheckedChanged += (s, e) =>
            {
                if (!Generate_Password_CheckBox.IsChecked)
                {
                    Password_Entry.Text        = "";
                    Password_Replay_Entry.Text = "";
                }
                else
                {
                    string password = get_Password.GetPassword();
                    Password_Entry.Text        = password;
                    Password_Replay_Entry.Text = password;
                }
            };
            Login_Entry.TextChanged += async(s, e) =>
            {
                if (Login_Entry.Text.Length == 17 && id == 0)
                {
                    IEnumerable <InfoUser> info = await registrationUsersService.Get_user();

                    var get = info.FirstOrDefault(x => x.Login == Login_Entry.Text);
                    if (get != null)
                    {
                        Error_Login_RowDefinition.Height = 40;
                        Error_Login_Lable.Text           = "Пользоватьль с таким логином уже существует";
                    }
                    else
                    {
                        Error_Login_RowDefinition.Height = 0;
                        Error_Login_Lable.Text           = "";
                    }
                }
            };
            Fam_Entry.TextChanged += (s, e) =>
            {
                if (Fam_Entry.Text != null && Fam_Entry.Text.Length == 1)
                {
                    Fam_Entry.Text = Fam_Entry.Text.Substring(0, 1).ToUpper() + Fam_Entry.Text.Substring(1);
                }
            };
            Name_Entry.TextChanged += (s, e) =>
            {
                if (Name_Entry.Text != null && Name_Entry.Text.Length == 1)
                {
                    Name_Entry.Text = Name_Entry.Text.Substring(0, 1).ToUpper() + Name_Entry.Text.Substring(1);
                }
            };
            Patronymic_Entry.TextChanged += (s, e) =>
            {
                if (Patronymic_Entry.Text != null && Patronymic_Entry.Text.Length == 1)
                {
                    Patronymic_Entry.Text = Patronymic_Entry.Text.Substring(0, 1).ToUpper() + Patronymic_Entry.Text.Substring(1);
                }
            };
            Yars_Entry.TextChanged += (s, e) =>
            {
                if (!Int32.TryParse(Yars_Entry.Text, out int num))
                {
                    Yars_Entry.Text = "";
                }
            };
            Password_Entry.TextChanged += (s, e) =>
            {
            };
            Password_Replay_Entry.TextChanged += (s, e) =>
            {
            };
        }
Example #12
0
        private async Task Criate_LoginPicer(bool status)
        {
            IEnumerable <Participation> participations = await participationService.Get();

            IEnumerable <InfoUser> infoUsers = await registrationUsersService.Get_user();

            IEnumerable <Competentions> competentions = await competentionsServise.Get();

            var info = from p in participations
                       join i in infoUsers on p.IdUser equals i.IdUsers
                       join c in competentions on p.IdCompetentions equals c.IdCompetentions
                       select new
            {
                i.Login,
                i.Name,
                i.Fam,
                i.Patronimic,
                i.Email,
                i.Years,
                i.Isman,
                i.IdHelth,
                p.IdParticipation,
                c.Date
            };

            LoginPicer = new Picker {
                Margin = new Thickness(10, -10, 10, 5)
            };
            if (status)
            {
                info = info.Where(p => p.Login == PoiskLogin.Text || p.Login.StartsWith(PoiskLogin.Text));
            }
            foreach (var item in info)
            {
                DateTime today = DateTime.Now;
                DateTime start = item.Date;
                if (today <= start && today.AddMonths(3) >= start)
                {
                    LoginPicer.Items.Add(item.Login);
                }
            }

            LoginPicer.SelectedIndexChanged += async(s, e) =>
            {
                IEnumerable <UserHelth> userHelths = await registrationUsersService.get_hels_status();

                var picker_list      = info.FirstOrDefault(x => x.Login == LoginPicer.Items[LoginPicer.SelectedIndex].ToString());
                var picker_list_Hels = userHelths.FirstOrDefault(x => x.IdHealth == picker_list.IdHelth);
                Criate_SelectCompitentions(true, true);
                Info_Editor.Text  = "";
                Info_Editor.Text  = "Login: "******"\r\n";
                Info_Editor.Text += "E-mail: " + picker_list.Email + "\r\n";
                Info_Editor.Text += "ФИО: " + picker_list.Fam + " " + picker_list.Name + " " + picker_list.Patronimic + "\r\n";
                Info_Editor.Text += "Возраст: " + picker_list.Years + "\r\n";
                Info_Editor.Text += "Статус здоровья: " + picker_list_Hels.NameHealth + "\r\n";
                if (picker_list.Isman == true)
                {
                    Info_Editor.Text += "Пол: Мужской" + "\r\n";
                }
                else
                {
                    Info_Editor.Text += "Пол: Женский" + "\r\n";
                }
            };

            GridMain.Children.Add(LoginPicer, 1, 2);
        }