Example #1
0
        public async Task <string> CreatePersonActivity(PersonActivity entity)
        {
            var query = @"
                INSERT INTO [PersonActivity]
                    ([Id]
                    ,[BiographyId]
                    ,[DateCreated]
                    ,[DateModified]
                    ,[IsActive]
                    ,[Activity]
                    ,[ActivityType]
                    ,[HasBegun]
                    ,[DateBegin]
                    ,[HasEnded]
                    ,[DateEnd])
                OUTPUT INSERTED.Id
                VALUES
                    (@Id
                    ,@BiographyId
                    ,@DateCreated
                    ,@DateModified
                    ,@IsActive
                    ,@Activity
                    ,@ActivityType
                    ,@HasBegun
                    ,@DateBegin
                    ,@HasEnded
                    ,@DateEnd)";

            return(await QueryFoD <string>(query, new DynamicParameters(entity)));
        }
Example #2
0
        public async Task <bool> SavePersonActivity(string personId, string bioId, PersonActivity newact)
        {
            var bio = await _mgrFcc.GetPersonBiographyByPersonId(personId);

            if (bio == null)
            {
                bioId = await _mgrFcc.SetPersonBiography(new PersonBiography()
                {
                    Id            = bioId,
                    PersonId      = personId,
                    BiographyText = null
                });
            }

            var dbRec = await _mgrFcc.GetPersonActivity(newact.Id);

            if (dbRec == null)
            {
                newact.Id           = Guid.NewGuid().ToString();
                newact.IsActive     = true;
                newact.DateCreated  = DateTime.Now;
                newact.BiographyId  = bioId;
                newact.DateModified = DateTime.Now;
                return(!string.IsNullOrWhiteSpace(await _mgrFcc.SetPersonActivity(newact)));
            }

            dbRec.DateBegin    = newact.DateBegin;
            dbRec.HasBegun     = newact.HasBegun;
            dbRec.HasEnded     = newact.HasEnded;
            dbRec.DateEnd      = newact.DateEnd;
            dbRec.Activity     = newact.Activity;
            dbRec.ActivityType = newact.ActivityType;
            dbRec.DateModified = DateTime.Now;
            return(await _mgrFcc.UpdatePersonActivity(dbRec));
        }
Example #3
0
        public void Save(PersonActivity obj)
        {
            List <Expression <Func <PersonActivity, bool> > > conditions = new List <Expression <Func <PersonActivity, bool> > >();

            conditions.Add(x => x._id == obj._id);

            context.ReplaceOne(conditions, obj);
        }
Example #4
0
        public void Save(PersonActivity data)
        {
            var release = repository.FindBy(data._id);

            if (release == null)
            {
                repository.Add(data);
            }
            else
            {
                repository.Save(data);
            }
        }
Example #5
0
        public async Task <bool> UpdatePersonActivity(PersonActivity entity)
        {
            var query = @"
                UPDATE [PersonActivity]
                SET [BiographyId] = @BiographyId
                    ,[DateCreated] = @DateCreated
                    ,[DateModified] = @DateModified
                    ,[IsActive] = @IsActive
                    ,[Activity] = @Activity
                    ,[ActivityType] = @ActivityType
                    ,[HasBegun] = @HasBegun
                    ,[DateBegin] = @DateBegin
                    ,[HasEnded] = @HasEnded
                    ,[DateEnd] = @DateEnd
                 WHERE Id = @Id";

            return(await Execute(query, new DynamicParameters(entity)) > 0);
        }
Example #6
0
        public async Task <PartialViewResult> PersonActivityEdit(string activityId)
        {
            PersonActivity vm;

            if (!string.IsNullOrWhiteSpace(activityId))
            {
                vm = await _vwbFcc.GetPersonActivity(activityId);
            }
            else
            {
                vm = new PersonActivity()
                {
                    HasBegun = true, DateBegin = DateTime.Now
                }
            };

            return(PartialView("Person/_PersonActivityEditBlock", vm));
        }
 private void SaveIntoRepository(PersonActivity personActivity)
 {
     ActivityDataService.Save(personActivity);
 }
        private static void SaveIntoFile(string currentSprintActivityDataFile, PersonActivity personActivity)
        {
            var data = JsonConvert.SerializeObject(personActivity);

            File.WriteAllText(currentSprintActivityDataFile, data, Encoding.UTF8);
        }
Example #9
0
 public async Task SavePersonActivity(string personId, string bioId, PersonActivity newact)
 {
     await _vwbFcc.SavePersonActivity(personId, bioId, newact);
 }
Example #10
0
 public void Remove(PersonActivity obj)
 {
     throw new NotImplementedException();
 }
Example #11
0
 public void Add(PersonActivity Obj)
 {
     context.Insert(Obj);
 }
Example #12
0
 public async Task <bool> UpdatePersonActivity(PersonActivity entity)
 {
     return(await _repo.UpdatePersonActivity(entity));
 }
Example #13
0
 public async Task <string> SetPersonActivity(PersonActivity entity)
 {
     return(await _repo.CreatePersonActivity(entity));
 }