Exemple #1
0
 private void programList_ProgramRemove(object sender, ProgramListItemEventArgs e)
 {
     if (e.Item.Id == SelectedProgram.Id)
     {
         ProgramView.SetProgram(null);
     }
 }
Exemple #2
0
        private void SaveView(Program program)
        {
            var viewEvent = new ProgramView()
            {
                When    = DateTime.Now,
                Ip      = HttpContext.Request.UserHostAddress,
                Browser = HttpContext.Request.Browser.Browser,
                User    = HttpContext.Request.IsAuthenticated ? LoggedInUser.Email : ""
            };

            program.PlanViews.Add(viewEvent);
            RavenSession.SaveChanges();
        }
    public void InstantiateProgramModeMVC()
    {
        //Model
        programModel = new ProgramModel();
        programModel.SetProgramInstructions();

        //Controller
        programController.SetBoardController(boardController);

        //View
        programView = new ProgramView();
        programView.SetProgramModel(programModel);
    }
Exemple #4
0
        public ActionResult CreateProgram(ProgramView ProgramView)
        {
            if (ModelState.IsValid)
            {
                if (TempData["Users"] != null)
                {
                    ProgramViewList = (List <ProgramView>)TempData.Peek("Users");
                }

                this.ProgramViewList.Add(ProgramView);
                TempData["Users"] = this.ProgramViewList;
            }

            return(View(ProgramViewList));
        }
Exemple #5
0
 public ProgramController(InputValidation inputValidation, ProgramView view, DateController dateController, string[] args)
 {
     _inputValidation = inputValidation;
     _view            = view;
     _dateController  = dateController;
     if (args.Length >= (int)ArgsLegth.lenghtOfArgsWithOutCulture)
     {
         _firstDateString  = args[(int)Index.firstDate];
         _secondDateString = args[(int)Index.secondDate];
     }
     if (args.Length == (int)ArgsLegth.lenghtOfArgsWithCulture)
     {
         _culture = args[(int)Index.culture];
     }
 }
        public AssistanceViewModel GetFromProgram(ProgramView program)
        {
            DateTime creationDate = DateTime.MinValue;

            DateTime.TryParse(program.PublishedDate, out creationDate);

            var creationDateLabel = creationDate == DateTime.MinValue ? null : creationDate.ToShortDateString();

            return(new AssistanceViewModel
            {
                AssistanceOrigin = StaticData.AssistanceOrigins[AssistanceOrigin.SamGov],
                AssistanceID = program.ProgramNumber,
                AssistanceType = program.TypesOfAssistance_060.LimitLengthTo(20, true),
                Title = program.PopularName_020.Cleanup(),
                CreationDateLabel = creationDateLabel,
                CloseDate = program.ExtractedDeadline,
                CloseDateLabel = program.ExtractedDeadline?.ToShortDateString() ?? "N/A",
                DescriptionLong = program.Objectives_050.Cleanup(),
                DescriptionShort = program.Objectives_050.LimitLengthTo(250, addDots: true).Cleanup()
            });
        }
Exemple #7
0
        static void Main(string[] args)
        {
            //Debug args parameters
            if (args[0] == "debug")
            {
                args = new string[] { "01.01.2000", "01.02.2000" };
            }

            //views initialization
            var dateView    = new DateView();
            var programView = new ProgramView();

            DateValidation dateValidation;
            //models initialization
            var inputValidation = new InputValidation(args);

            if (args.Length == 3)
            {
                dateValidation = new DateValidation(args[2]);
            }
            else
            {
                dateValidation = new DateValidation();
            }

            var dateParser         = new DateParser();
            var calculateDateRange = new CalculateDateRange();

            //controller initialization
            var dateController    = new DateController(dateValidation, dateParser, calculateDateRange, dateView);
            var programController = new ProgramController(inputValidation, programView, dateController, args);


            //Program turn on
            programController.RunProgram();
        }
Exemple #8
0
 private void programList_ProgramSelect(object sender, ProgramListItemEventArgs e)
 {
     SelectedProgram = ProgramService.GetProgram(e.Item.Id);
     ProgramView.SetProgram(SelectedProgram);
 }
Exemple #9
0
 public void SetProgramView(ProgramView view)
 {
     this.view = view;
 }
Exemple #10
0
        private void startButton_Click(object sender, EventArgs e)
        {
            Form programView = new ProgramView(collection);

            programView.ShowDialog();
        }
        public async Task <IProgramResponse> GetAllProgramAsync(int profileId)
        {
            try
            {
                logger.Info($"{ GetType().Name}  {  ExtensionUtility.GetCurrentMethod() }  userId: {profileId} UserIPAddress: {  _userIPAddress.GetUserIP().Result }");
                var programs = await _appDbContext.Programmes.Include(m => m.ProgrammeTypeItem).Include(k => k.Batches).ToListAsync();

                var programBatchViews = new List <ProgramView>();

                var programViews = _mapper.Map <List <ProgramView> >(programs);

                foreach (var item in programViews)
                {
                    var batchList = item.Batches.ToList();
                    foreach (var item2 in batchList)
                    {
                        // Type myTypeB = typeof(ProgramView);
                        //PropertyInfo fieldInfo = ProgramView..GetProperty("BatchView");


                        ProgramView progView = new ProgramView()
                        {
                            Id                    = item.Id,
                            TitleEn               = item.TitleEn,
                            TitleAr               = item.TitleAr,
                            DescriptionEn         = item.DescriptionEn,
                            DescriptionAr         = item.DescriptionAr,
                            Order                 = item.Order,
                            Fees                  = item.Fees,
                            Duration              = item.Duration,
                            IsHidden              = item.IsHidden,
                            ShortTitleEn          = item.ShortTitleEn,
                            ShortTitleAr          = item.ShortTitleAr,
                            ProgrammeTypeItemId   = item.ProgrammeTypeItemId,
                            ImageId               = item.ImageId,
                            DescriptionHtmlEn     = item.DescriptionHtmlEn,
                            DescriptionHtmlAr     = item.DescriptionHtmlAr,
                            SubDescriptionHtmlEn  = item.SubDescriptionHtmlEn,
                            SubDescriptionHtmlAr  = item.SubDescriptionHtmlAr,
                            ProgrammeTypeItem     = item.ProgrammeTypeItem,
                            isReminderSet         = item.isReminderSet,
                            Batches               = item.Batches,
                            Applications          = item.Applications,
                            Application_reference = item.Application_reference,
                            CompletedUsersList    = item.CompletedUsersList,
                            BatchView             = item2,
                        };

                        programBatchViews.Add(progView);
                    }
                }



                var applications = _mapper.Map <List <ApplicationView> >(await _appDbContext.Applications
                                                                         .Include(k => k.StatusItem).Include(k => k.ReviewStatusItem).Include(k => k.AssessmentItem)
                                                                         .Include(k => k.SecurityItem).Include(k => k.VideoAssessmentStatus)
                                                                         .Where(k => k.ProfileId == profileId).ToListAsync());

                programBatchViews.ForEach(k => k.Applications = applications);


                foreach (var programView in programBatchViews)
                {
                    programView.CompletedUsersList =
                        await GetProgramCompletedUserDetailsAsync(profileId, programView.BatchId ?? 0);

                    var reminder = await _appDbContext.Reminders.Where(x => x.UserID == profileId && x.ActivityId == programView.BatchId && x.ApplicationId == 1).FirstOrDefaultAsync();

                    programView.isReminderSet = reminder != null ? true : false;

                    List <ApplicationReference> _ref = new List <ApplicationReference>();
                    foreach (var item in programView.Applications)
                    {
                        _ref.Add(new ApplicationReference()
                        {
                            ApplicationId   = item.Id,
                            ReferenceNumber = _appDbContext.ParticipationReferences.FirstOrDefault(a => a.ApplicationID != null && a.ApplicationID == item.Id && a.ProfileID == item.ProfileId)?.ReferenceNumber ?? ""
                        });
                        programView.Application_reference = _ref;
                        //item.ReferenceNumber = _appDbContext.ParticipationReferences.FirstOrDefault(a => a.ApplicationID != null && a.ApplicationID == item.Id && a.ProfileID == item.ProfileId).ReferenceNumber ?? "";
                    }
                }

                return(new ProgramResponse(programBatchViews));
            }
            catch (Exception e)
            {
                logger.Error(e);
                return(new ProgramResponse(e.Message, HttpStatusCode.InternalServerError));
            }
        }
        public async Task <IProgramResponse> GetBatchsDetailAsync(int profileId, int batchId)
        {
            try
            {
                var programs = await _appDbContext.Programmes.Include(m => m.ProgrammeTypeItem).Include(k => k.Batches).ToListAsync();

                var programViews      = _mapper.Map <List <ProgramView> >(programs);
                var programBatchViews = new List <ProgramView>();

                foreach (var item in programViews)
                {
                    var batchList = item.Batches.ToList();
                    foreach (var item2 in batchList)
                    {
                        // Type myTypeB = typeof(ProgramView);
                        //PropertyInfo fieldInfo = ProgramView..GetProperty("BatchView");


                        ProgramView progView = new ProgramView()
                        {
                            Id                    = item.Id,
                            TitleEn               = item.TitleEn,
                            TitleAr               = item.TitleAr,
                            DescriptionEn         = item.DescriptionEn,
                            DescriptionAr         = item.DescriptionAr,
                            Order                 = item.Order,
                            Fees                  = item.Fees,
                            Duration              = item.Duration,
                            IsHidden              = item.IsHidden,
                            ShortTitleEn          = item.ShortTitleEn,
                            ShortTitleAr          = item.ShortTitleAr,
                            ProgrammeTypeItemId   = item.ProgrammeTypeItemId,
                            ImageId               = item.ImageId,
                            DescriptionHtmlEn     = item.DescriptionHtmlEn,
                            DescriptionHtmlAr     = item.DescriptionHtmlAr,
                            SubDescriptionHtmlEn  = item.SubDescriptionHtmlEn,
                            SubDescriptionHtmlAr  = item.SubDescriptionHtmlAr,
                            ProgrammeTypeItem     = item.ProgrammeTypeItem,
                            isReminderSet         = item.isReminderSet,
                            Batches               = item.Batches,
                            Applications          = item.Applications,
                            Application_reference = item.Application_reference,
                            CompletedUsersList    = item.CompletedUsersList,
                            BatchView             = item2
                        };

                        programBatchViews.Add(progView);
                    }
                }
                var applications = _mapper.Map <List <ApplicationView> >(await _appDbContext.Applications
                                                                         .Include(k => k.StatusItem).Include(k => k.ReviewStatusItem).Include(k => k.AssessmentItem)
                                                                         .Include(k => k.SecurityItem).Include(k => k.VideoAssessmentStatus)
                                                                         .Where(k => k.ProfileId == profileId).ToListAsync());

                programBatchViews.ForEach(k => k.Applications = applications);


                var programView = programBatchViews.FirstOrDefault(k => k.BatchId == batchId);
                if (programView != null)
                {
                    programView.CompletedUsersList =
                        await GetProgramCompletedUserDetailsAsync(profileId, programView.BatchId ?? 0);
                }

                var profileCompleted = await _applicationProgressService.GetProgramCompletedDetailsAsync(profileId, batchId);

                profileCompleted.Program = programView;

                var isProgramOpen = await _appDbContext.Batches.Where(k => k.Id == batchId && !k.IsClosed && k.DateRegFrom <= DateTime.Now.Date && k.DateRegTo >= DateTime.Now.Date).FirstOrDefaultAsync();

                profileCompleted.isProgramOpen = isProgramOpen != null ? true : false;

                return(new ProgramResponse(profileCompleted));
            }
            catch (Exception e)
            {
                return(new ProgramResponse(e.Message, HttpStatusCode.InternalServerError));
            }
        }
Exemple #13
0
 public ProgramResponse(ProgramView programView) : this(true, string.Empty, programView)
 {
 }
Exemple #14
0
 private ProgramResponse(bool success, string message, ProgramView programView) : base(success, message)
 {
     ProgramView = programView;
 }