예제 #1
0
파일: MainForm.cs 프로젝트: yon28/VAV
        private void EditSelectedEmployee()
        {
            if (dgvEmployees.SelectedCells.Count > 0)
            {
                Employee     employee = (Employee)dgvEmployees.SelectedCells[0].OwningRow.DataBoundItem;
                EmployeeForm form     = new EmployeeForm(employee);

                for (int i = 0; i < dgvRewards.RowCount; i++)
                {
                    bool b = true;
                    if (employee.Rewards == null)
                    {
                        b = false;
                    }
                    else
                    {
                        if (!employee.Rewards.Contains(dgvRewards[0, i].Value.ToString()))
                        {
                            b = false;
                        }
                    }
                    form.chRewards.Items.Add(dgvRewards[0, i].Value, b);
                }
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    employee.LastName  = form.LastName;
                    employee.FirstName = form.FirstName;
                    employee.Birth     = form.Birth;
                    employee.Rewards   = Ch(form);
                    DisplayEmployee();
                }
            }
        }
예제 #2
0
파일: MainForm.cs 프로젝트: yon28/VAV
        private void RegisterNewEmployee()
        {
            EmployeeForm form = new EmployeeForm(null, rewards);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                employees.Add(form.LastName, form.FirstName, form.Birth, Checked(form));
                DisplayEmployee();
            }
        }
예제 #3
0
파일: MainForm.cs 프로젝트: yon28/VAV
        private string Ch(EmployeeForm form)
        {
            string text = "";

            for (int i = 0; i < form.chRewards.CheckedItems.Count; i++)
            {
                text = text + " " + form.chRewards.CheckedItems[i].ToString();
            }
            return(text);
        }
예제 #4
0
파일: MainForm.cs 프로젝트: yon28/VAV
        //
        private void RegisterNewEmployee()
        {
            EmployeeForm form = new EmployeeForm();

            for (int i = 0; i < dgvRewards.RowCount; i++)
            {
                form.chRewards.Items.Add(dgvRewards[0, i].Value);
            }
            if (form.ShowDialog(this) == DialogResult.OK)
            {
                employees.Add(form.LastName, form.FirstName, form.Birth, Ch(form));///////
                DisplayEmployee();
            }
        }
예제 #5
0
파일: MainForm.cs 프로젝트: yon28/VAV
 private void EditSelectedEmployee()
 {
     if (dgvEmployees.SelectedCells.Count > 0)
     {
         Employee     employee = (Employee)dgvEmployees.SelectedCells[0].OwningRow.DataBoundItem;
         EmployeeForm form     = new EmployeeForm(employee, rewards);
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             employee.LastName  = form.LastName;
             employee.FirstName = form.FirstName;
             employee.Birth     = form.Birth;
             employee.Rewards   = Checked(form);
             employees.Edit(employee);
             DisplayEmployee();
         }
     }
 }
예제 #6
0
파일: MainForm.cs 프로젝트: yon28/VAV
        private List <Reward> Checked(EmployeeForm form)
        {
            var allRewards = rewards.GetList();//
            var rewards_   = new List <Reward> {
            };

            if (form.chRewards.CheckedItems.Count != 0)
            {
                for (int i = 0; i < form.chRewards.CheckedItems.Count; i++)
                {
                    string checkedItem = (string)form.chRewards.CheckedItems[i];
                    Reward reward      = rewards.GetList().FirstOrDefault(it => it.Title == checkedItem);
                    rewards_.Add(reward);
                }
            }
            return(rewards_);
        }