Exemplo n.º 1
0
        public void UpdateJob(DT.Job jobDto)
        {
            RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
            AuthorizationManager.AuthorizeForJob(jobDto.Id, DT.Permission.Full);
            var pm = PersistenceManager;

            using (new PerformanceLogger("UpdateJob")) {
                bool exists = true;
                var  jobDao = pm.JobDao;
                pm.UseTransaction(() => {
                    var job = jobDao.GetById(jobDto.Id);
                    if (job == null)
                    {
                        exists = false;
                        job    = new DA.Job();
                    }
                    jobDto.CopyToEntity(job);
                    if (!exists)
                    {
                        jobDao.Save(job);
                    }
                    pm.SubmitChanges();
                });
            }
        }
Exemplo n.º 2
0
        public static DA.Job ToEntity(this DT.Job source)
        {
            if (source == null)
            {
                return(null);
            }
            var result = new DA.Job();

            source.CopyToEntity(result);
            return(result);
        }