Example #1
0
        private void buttonSavePassword_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                DialogResult res = MessageBox.Show("Введите старый пароль",
                                                   "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Person CUser = ParentF.db.Participants.FirstOrDefault(u => u.Id == ParentF.Login.Id);

            if (textBox1.Text != CUser.Password)
            {
                DialogResult res = MessageBox.Show("Старый пароль неверен",
                                                   "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (textBox2.Text == "")
            {
                DialogResult res = MessageBox.Show("Введите новый пароль",
                                                   "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            CUser.Password = textBox2.Text;
            ParentF.db.SaveChanges();
            ParentF.UpdateLogin();
        }
Example #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (ParentF.db.Results.FirstOrDefault(r => r.Id == ParentF.Login.ResultId) == null)
     {
         DialogResult res = MessageBox.Show("Ваши результаты еще не опубликованны",
                                            "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     ParentF.GoPage(Page.MyResults);
 }
Example #3
0
 void BaseControl_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == ' ')
     {
         if (ParentF != null)
         {
             if (ParentF.InvokeRequired)
             {
                 ParentF.Invoke(new EventHandler(delegate { ParentF.OnKeyPressP(true); }));
             }
             else
             {
                 ParentF.OnKeyPressP(true);
             }
         }
     }
 }
Example #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.Draw);
 }
Example #5
0
 private void button3_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.MyResultsCoor);
 }
Example #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.EditSponsor);
 }
Example #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.EditVolunteer);
 }
 private void button2_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.EditParticipant);
 }
Example #9
0
 private void buttonFileLoad_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.LoadVolunteer);
 }
        private void buttonLoginGo_Click(object sender, EventArgs e)
        {
            if (textBoxLoginId.Text == "")
            {
                DialogResult res = MessageBox.Show("Заполните поле ID",
                                                   "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (textBoxLoginPassword.Text == "")
            {
                DialogResult res = MessageBox.Show("Введите пароль",
                                                   "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (comboBoxPersonType.SelectedIndex == -1)
            {
                DialogResult res = MessageBox.Show("Выберите вашу позицию",
                                                   "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            int IdLog;

            if (!int.TryParse(textBoxLoginId.Text, out IdLog))
            {
                DialogResult res = MessageBox.Show("Введенное ID - не число",
                                                   "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            switch (comboBoxPersonType.SelectedIndex)
            {
            case 0:
                ParentF.Login = ParentF.db.Participants.FirstOrDefault(p =>
                                                                       p.Id == IdLog && p.Password == textBoxLoginPassword.Text);
                ParentF.LoginType = 1;
                break;

            case 1:
                ParentF.Login = ParentF.db.Coordinators.FirstOrDefault(p =>
                                                                       p.Id == IdLog && p.Password == textBoxLoginPassword.Text);
                ParentF.LoginType = 2;
                break;

            case 2:
                ParentF.Login = ParentF.db.Experts.FirstOrDefault(p =>
                                                                  p.Id == IdLog && p.Password == textBoxLoginPassword.Text);
                ParentF.LoginType = 3;
                break;

            case 3:
                ParentF.Login = ParentF.db.Administrators.FirstOrDefault(p =>
                                                                         p.Id == IdLog && p.Password == textBoxLoginPassword.Text);
                ParentF.LoginType = 4;
                break;
            }
            if (ParentF.Login == null)
            {
                DialogResult res = MessageBox.Show("Неправильный Id или пароль",
                                                   "Не так надо", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ParentF.LoginType = 0;
                return;
            }
            if (checkBoxRemember.Checked == true)
            {
                try
                {
                    string[] lines = { ParentF.Login.Id.ToString(),
                                       ParentF.Login.Password, ParentF.LoginType.ToString() };
                    File.WriteAllLines(Path.Combine(Directory.GetCurrentDirectory(),
                                                    "login.txt"), lines);
                }
                finally { }
            }
            switch (comboBoxPersonType.SelectedIndex)
            {
            case 0:
                ParentF.GoPage(Page.Participant);
                break;

            case 1:
                ParentF.GoPage(Page.Coordinator);
                break;

            case 2:
                ParentF.GoPage(Page.Expert);
                break;

            case 3:
                ParentF.GoPage(Page.Administrator);
                break;
            }
        }
 private void buttonCancelLogin_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.Title);
 }
Example #12
0
 private void button3_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.Championships);
 }
Example #13
0
 private void button1_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.HistoryWS);
 }
Example #14
0
 private void button2_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.Rating);
 }
Example #15
0
 private void buttonMyProfile_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.MyProfile);
 }
Example #16
0
 private void button3_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.CheckResults);
 }
Example #17
0
 private void button2_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.MyCompetention);
 }
Example #18
0
 private void buttonDistribute_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.DistributeVolunteer);
 }
 private void button1_Click(object sender, EventArgs e)
 {
     ParentF.GoPage(Page.EditChampionship);
 }