示例#1
0
 private void BtnGiris_Click(object sender, EventArgs e)
 {
     if (appUserRepository.Any(x => x.UserName == txtUserName.Text &&
                               x.Password == txtPassword.Text &&
                               x.Role == MODEL.Enums.UserRole.Admin))
     {
         AdminForm adminForm = new AdminForm(appUserRepository.FirstOrDefault(x => x.UserName == txtUserName.Text &&
                                                                              x.Password == txtPassword.Text &&
                                                                              x.Role == MODEL.Enums.UserRole.Admin));
         this.Hide();
         adminForm.Show();
     }
     else if (appUserRepository.Any(x => x.UserName == txtUserName.Text &&
                                    x.Password == txtPassword.Text &&
                                    x.Role == MODEL.Enums.UserRole.Employee))
     {
         EmployeeForm employeeForm = new EmployeeForm(appUserRepository.FirstOrDefault(x => x.UserName == txtUserName.Text &&
                                                                                       x.Password == txtPassword.Text &&
                                                                                       x.Role == MODEL.Enums.UserRole.Employee));
         this.Hide();
         employeeForm.Show();
     }
     else
     {
         MessageBox.Show("Unidentified User!");
     }
 }
示例#2
0
        private void rb_new_Click(object sender, EventArgs e)
        {
            var form = new EmployeeForm();

            form.Show();
            Hide();
        }
示例#3
0
        private void ribbonOrbMenuItem2_Click(object sender, EventArgs e)
        {
            var emp = new EmployeeForm();

            emp.Show();
            this.Hide();
        }
示例#4
0
        private void pictureBox9_Click(object sender, EventArgs e)
        {
            Hide();
            var form = new EmployeeForm();

            form.Show();
        }
示例#5
0
        private void linkLabel9_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Hide();
            var form = new EmployeeForm();

            form.Show();
        }
示例#6
0
        private void btnreturn_Click(object sender, EventArgs e)
        {
            EmployeeForm emp = new EmployeeForm(currentUser);

            this.Hide();
            emp.Show();
        }
示例#7
0
        private void btn_load_pid_Click(object sender, EventArgs e)
        {
            var empfrm = new EmployeeForm();

            empfrm.Show();
            this.Hide();
        }
示例#8
0
        private void employeesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var ef = new EmployeeForm {
                MdiParent = this, WindowState = FormWindowState.Maximized, IsUser = IsUser, SCompanyName = OCompany.CompanyName
            };

            ef.Show();
        }
 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     BeginInvoke(new Action(() =>
     {
         var frm = new EmployeeForm();
         frm.Show();
     }));
 }
示例#10
0
 void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     BeginInvoke(new Action(() =>
     {
         var emp = new EmployeeForm(e_id, "View");
         emp.Show();
     }));
 }
示例#11
0
        private void loginBtn_Click(object sender, EventArgs e)
        {
            //string username = userTxt.Text;
            //User test = new User();
            //test.username = "******";
            //test.firstname = "alex";
            //test.lastname = "vid";
            //test.password = "******";
            //test.type = 1;

            //HttpClient client = new HttpClient();
            //client.BaseAddress = new Uri("http://localhost:58069/");

            //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            //HttpResponseMessage response = client.PostAsJsonAsync("api/addUser", test).Result;
            //MessageBox.Show(response.ToString());
            //if (response.IsSuccessStatusCode)
            //{
            //    MessageBox.Show("Operation succeded");
            //}
            //else
            //{
            //    MessageBox.Show("Operation failed");
            //}

            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:58069/");

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage response = client.GetAsync("api/Login?data=" + userTxt.Text + "&data=" + passTxt.Text).Result;
            User user = new User();

            //MessageBox.Show(response.ToString());
            if (response.IsSuccessStatusCode)
            {
                user = response.Content.ReadAsAsync <User>().Result;

                if (user != null)
                {
                    if (user.type == 1)
                    {
                        AdminForm adminForm = new AdminForm();
                        adminForm.Show();
                    }
                    else if (user.type == 2)
                    {
                        EmployeeForm empl = new EmployeeForm();
                        empl.Show();
                    }
                }
            }
            else
            {
                MessageBox.Show("operation failed");
            }
        }
示例#12
0
        private void btnEmployees_Click(object sender, EventArgs e)
        {
            this.deleteSubs();
            EmployeeForm employeeForm = new EmployeeForm();

            employeeForm.MdiParent = (Form1)this.MdiParent;
            employeeForm.Anchor    = AnchorStyles.Top | AnchorStyles.Right;
            employeeForm.Dock      = DockStyle.Fill;
            employeeForm.Show();
        }
示例#13
0
        /// <summary>
        /// Обработчик события нажатия на кнопку авторизации
        /// </summary>
        private async void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBox1.Text) || string.IsNullOrWhiteSpace(textBox2.Text))
            {
                MessageBox.Show("Заполните все поля для прохождения авторизации!", "Предупреждение",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Form frm = null;

            try
            {
                if (!await _ctx.Login(textBox1.Text, textBox2.Text))
                {
                    MessageBox.Show("Неверный логин и/или пароль", "Неверные данные", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }


                switch (Context.CurrentUser.RightsLevel.Name)
                {
                case "Директор":
                    frm = new DirectorForm();
                    break;

                case "Системный администратор":
                    frm = new SysAdminForm();
                    break;

                case "Сотрудник":
                    frm = new EmployeeForm();
                    break;

                default:
                    throw new Exception();
                }

                textBox1.Text = textBox2.Text = string.Empty;

                frm.Owner = this;
                frm.Show();
                Hide();
            }
            catch
            {
                frm?.Dispose();
                this.Show();
                MessageBox.Show("Произошла ошибка во время авторизации!", "Ошибка", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
示例#14
0
 private void btn_load_Click(object sender, EventArgs e)
 {
     if (txt_pid.Text != "")
     {
         var emp = new EmployeeForm(txt_pid.Text);
         emp.Show();
         this.Hide();
     }
     else
     {
         var emp = new EmployeeForm();
         emp.Show();
         this.Hide();
     }
 }
示例#15
0
 private void rb_new_Click(object sender, EventArgs e)
 {
     try
     {
         var emp = new EmployeeForm();
         emp.Show();
         this.Hide();
     }
     catch (Exception ex)
     {
         MessageBox.Show(
             string.Format("An error has occured: {0}", ex.Message), "Nffv C# Sample",
             MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#16
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == BUTTON_EDIT_COLUMN_INDEX && e.RowIndex >= 0)
     {
         if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
         {
             if (dataGridView1.Rows[e.RowIndex].Cells[3].Value != null)
             {
                 var emp_id = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
                 e_id = emp_id;
                 var emp = new EmployeeForm(e_id, "Edit");
                 emp.Show();
                 this.Hide();
             }
         }
     }
     else if (e.ColumnIndex == BUTTON_PRINT_COLUMN_INDEX && e.RowIndex >= 0)
     {
         if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
         {
             if (dataGridView1.Rows[e.RowIndex].Cells[3].Value != null)
             {
                 var emp_id = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
                 var form   = new ReportEmployee(emp_id);
                 form.Show();
                 this.Hide();
             }
         }
     }
     else if ((e.ColumnIndex == 2 && e.RowIndex >= 0) || (e.ColumnIndex == 3 && e.RowIndex >= 0) || (e.ColumnIndex == 4 && e.RowIndex >= 0) || (e.ColumnIndex == 5 && e.RowIndex >= 0) || (e.ColumnIndex == 6 && e.RowIndex >= 0) || (e.ColumnIndex == 7 && e.RowIndex >= 0))
     {
         if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
         {
             if (dataGridView1.Rows[e.RowIndex].Cells[3].Value != null)
             {
                 var emp_id  = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
                 var profile = ProfileImageDataService.GetByEmployeeID(emp_id);
                 if (profile != null)
                 {
                     pic_emp.Image = GetImage(profile.PHOTO, 190, 170);
                 }
             }
         }
     }
 }
示例#17
0
 /// <summary>
 /// Launches the Employee infomration path of the system
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void employeeButton_Click(object sender, EventArgs e)
 {
     EmployeeForm elist = new EmployeeForm();
     elist.Show();
 }
示例#18
0
        private void employeeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EmployeeForm eForm = new EmployeeForm();

            eForm.Show();
        }
示例#19
0
        private void MenuItems_ItemClicked(object sender, EventArgs e)
        {
            EmployeeForm emp = new EmployeeForm();

            emp.Show();
        }