Exemplo n.º 1
0
        public override PlayerSeason Save(PlayerSeason itemToSave)
        {
            if (itemToSave != null && itemToSave.Programs != null)
            {
                DTO.PlayerSeason dtoItem = this.GetDTOById(itemToSave.Id);

                if (dtoItem != null)
                {
                    foreach (Program domainProgram in itemToSave.Programs)
                    {
                        if (dtoItem.Programs.FirstOrDefault(t => t.Id == domainProgram.Id) == null)
                        {
                            ICriteria criteria = this.UnitOfWork.CurrentSession.CreateCriteria <DTO.Program>();
                            criteria.Add(Expression.Eq("Id", domainProgram.Id));
                            DTO.Program existsTest = criteria.UniqueResult <DTO.Program>();

                            if (existsTest != null)
                            {
                                dtoItem.Programs.Add(existsTest);
                            }
                        }
                    }

                    foreach (Payment domainPayment in itemToSave.Payments)
                    {
                        if (dtoItem.Programs.FirstOrDefault(t => t.Id == domainPayment.Id) == null)
                        {
                            ICriteria criteria = this.UnitOfWork.CurrentSession.CreateCriteria <DTO.Payment>();
                            criteria.Add(Expression.Eq("Id", domainPayment.Id));
                            DTO.Payment existsTest = criteria.UniqueResult <DTO.Payment>();

                            if (existsTest != null)
                            {
                                dtoItem.Payments.Add(existsTest);
                            }
                        }
                    }
                }
            }

            return(base.Save(itemToSave));
        }
 public DTO.Program RequestPatientProgramDetail(DTO.IProcessActionRequest request)
 {
     DTO.Program prg = new DTO.Program
     {
         Id                      = "111100000000000000000000",
         Description             = "this is a test program from the stub.",
         AssignDate              = System.DateTime.UtcNow,
         AssignToId              = ObjectId.GenerateNewId().ToString(),
         Client                  = "NG",
         Completed               = false,
         ContractProgramId       = "123456789098765432167846",
         ElementState            = 4,
         Enabled                 = true,
         Name                    = "test stub program",
         ShortName               = "t s p",
         EligibilityRequirements =
             "Individual must be a part of the health plan and have completed HRA and other requirements.",
         EligibilityStartDate = DateTime.UtcNow.AddDays(1),
         EligibilityEndDate   = DateTime.UtcNow.AddDays(20),
         Modules = new List <DTO.Module>()
         {
             new DTO.Module
             {
                 Id           = "999990000000000000000000",
                 Name         = "Test stub module 1",
                 Description  = "BSHSI - Outreach & Enrollment",
                 SourceId     = "532b5585a381168abe00042c",
                 ElementState = 4,
                 Enabled      = false,
                 Actions      = new List <DTO.Actions>()
                 {
                     new DTO.Actions
                     {
                         Id            = "9999977dfe7a59112c364123",
                         ElementState  = 4,
                         Name          = "test action from stub",
                         Description   = "action Description",
                         Text          = "test action 1",
                         AttrEndDate   = DateTime.UtcNow.AddDays(10),
                         AttrStartDate = DateTime.UtcNow,
                         AssignDate    = System.DateTime.UtcNow,
                         Enabled       = true,
                         SpawnElement  =
                             new List <DTO.SpawnElement>
                         {
                             new DTO.SpawnElement {
                                 ElementId = "111116789012345678901234", ElementType = 3
                             }
                         }
                     },
                     new DTO.Actions
                     {
                         Id            = "999996789012345678904567",
                         ElementState  = 4,
                         Name          = "test action from stub",
                         Description   = "action Description",
                         Text          = "test action 1",
                         AttrEndDate   = DateTime.UtcNow.AddDays(10),
                         AttrStartDate = DateTime.UtcNow,
                         AssignDate    = System.DateTime.UtcNow,
                         Enabled       = true
                     }
                 }
             },
             new DTO.Module
             {
                 Id           = "123450000000000000000000",
                 Name         = "Test stub module 1",
                 Description  = "BSHSI - Outreach & Enrollment",
                 SourceId     = "532b5585a381168abe00042c",
                 ElementState = 4,
                 Enabled      = true,
                 Actions      = new List <DTO.Actions>()
                 {
                     new DTO.Actions
                     {
                         Id            = "538ca77dfe7a59112c3649e4",
                         ElementState  = 4,
                         Name          = "test action from stub",
                         Description   = "action Description",
                         Text          = "test action 1",
                         AttrEndDate   = DateTime.UtcNow.AddDays(10),
                         AttrStartDate = DateTime.UtcNow,
                         AssignDate    = System.DateTime.UtcNow,
                         Enabled       = true,
                         SpawnElement  =
                             new List <DTO.SpawnElement>
                         {
                             new DTO.SpawnElement {
                                 ElementId = "111116789012345678901234", ElementType = 3
                             }
                         }
                     },
                     new DTO.Actions
                     {
                         Id            = "111116789012345678901234",
                         ElementState  = 4,
                         Name          = "test action from stub",
                         Description   = "action Description",
                         Text          = "test action 1",
                         AttrEndDate   = DateTime.UtcNow.AddDays(10),
                         AttrStartDate = DateTime.UtcNow,
                         AssignDate    = System.DateTime.UtcNow,
                         Enabled       = true
                     }
                 }
             }
         },
         Text       = "This is a sample patient program for the request patient details summary test stub",
         Attributes = new DTO.ProgramAttribute
         {
             //AssignedBy = "me",
             //AssignedOn = System.DateTime.UtcNow,
             Id            = "000000000000000000000000",
             PlanElementId = "000000000000000000000000"
         }
     };
     return(prg);
 }
 public DataDomain.Program.DTO.ProgramDetail SaveAction(DTO.IProcessActionRequest request, string actionId, DTO.Program p, bool repeat)
 {
     return(new ProgramDetail());
 }