Exemple #1
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            List <WorkingTime> workingTimes    = new List <WorkingTime>();
            WorkingLocation    workingLocation = (WorkingLocation)cmb_location.SelectedItem;

            if (lbx_employee.CheckedItems.Count == 0)
            {
                MessageBox.Show("Lütfen en az bir çalışan seçiniz.");
            }
            else
            {
                foreach (Employee employee in lbx_employee.CheckedItems)
                {
                    var startDate = monthCalendar1.SelectionRange.Start;
                    var endDate   = monthCalendar1.SelectionRange.End;
                    for (DateTime start = startDate; start <= endDate; start = start.AddDays(1.0))
                    {
                        WorkingTime workingTime = new WorkingTime
                        {
                            EmployeeID        = employee.ID,
                            WorkingDate       = start,
                            WorkingHours      = (int)txt_hour.Value,
                            WorkingLocationID = workingLocation.ID
                        };
                        workingTimes.Add(workingTime);
                    }
                }
            }
            string result = _workingTimeService.AddRange(workingTimes);

            MessageBox.Show(result);
        }
Exemple #2
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            var location = new WorkingLocation {
                Name = txt_name.Text
            };
            var result = _workingLocationService.Add(location);

            if (result >= 0)
            {
                MessageBox.Show("İşlem Başarılı.");
                FillLocations();
            }
            else
            {
                MessageBox.Show("İşlem Başarısız.");
            }
        }
 public int Remove(WorkingLocation workingLocation)
 {
     _repository.Remove(workingLocation);
     return(_unitOfWork.SaveChanges());
 }
 public int Add(WorkingLocation workingLocation)
 {
     _repository.Add(workingLocation);
     return(_unitOfWork.SaveChanges());
 }