Exemple #1
0
        public void changeDeptCp(Department department, int cpId)
        {
            List <DisbursementList> list = disbursementService.GetDisbursementByDeptId(department.DepartmentId);
            var q = (from x in list
                     where x.DeliveryDate == DateTime.Today &&
                     x.Status != "Completed"
                     select x).ToList();

            if (q.Count() == 0)
            {
                int id = department.DepartmentId;
                db.Departments.Single(model => model.DepartmentId == id).CollectionPointId = cpId;
                db.SaveChanges();

                notify.CollectionPointChanged(id);
            }
            else
            {
                throw new ChangeCollectionPointException("You have a collection due today. Please try again tomorrow.");
            }
        }