public override void Validate()
        {
            Validated = false;

            foreach (var conversation in mConversations.ToList())
            {
                ApplicationStatus.SetProgress(0);
                ApplicationStatus.SetStatus(String.Format("Validating conversation: {0}", conversation.Name));
                conversation.Validate();
                ApplicationStatus.SetProgress(100);

                if (conversation.IsEmpty)
                {
                    mConversations.Remove(conversation);
                }

                if (null != OnConversationValidated)
                {
                    OnConversationValidated(this, new ElementEventArgs(mConversations.IndexOf(conversation)));
                }
            }

            Validated = true;

            if (null != OnConversationListValidated)
            {
                OnConversationListValidated(this, new EventArgs());
            }
        }
Beispiel #2
0
        private async Task SendApplicationsList(ApplicationStatus status, int?limit, bool sortByDescending)
        {
            var pendingApps = await _mediator.Send(new GetByStatus.Query
            {
                Status = status, Limit = limit, SortByDescending = sortByDescending
            });

            var statusText = status.ToString().ToLower();

            if (pendingApps.IsEmpty())
            {
                await Context.Channel.SendMessageAsync($"There are no {statusText} applications at the moment.");

                return;
            }

            var embed = new EmbedBuilder()
                        .WithTitle(sortByDescending
                    ? $"Last {statusText} applications"
                    : $"{statusText.First().ToString().ToUpper() + statusText.Substring(1)} applications")
                        .WithColor(Color.Blue)
                        .WithMmccLogo()
                        .WithApplicationFields(pendingApps)
                        .Build();

            await Context.Channel.SendEmbedAsync(embed);
        }
        public async Task <IActionResult> PutApplicationStatus(int id, ApplicationStatus applicationStatus)
        {
            if (id != applicationStatus.ID)
            {
                return(BadRequest());
            }

            _context.Entry(applicationStatus).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApplicationStatusExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        /// <summary>
        /// Gets status type.
        /// </summary>
        /// <param name="statusName"> A string with status.</param>
        /// <returns> a status Enum type member.</returns>
        public ApplicationStatus GetStatus(string statusName)
        {
            ApplicationStatus status = ApplicationStatus.Approved;

            switch (statusName)
            {
            case "Applied":
                status = ApplicationStatus.Applied;
                break;

            case "Approved":
                status = ApplicationStatus.Approved;
                break;

            case "Rejected":
                status = ApplicationStatus.Rejected;
                break;

            case "Cancelled":
                status = ApplicationStatus.Cancelled;
                break;

            default:
                status = ApplicationStatus.Cancelled;
                break;
            }

            return(status);
        }
Beispiel #5
0
        public bool EditStatus(int statusId, ApplicationStatus status)
        {
            var timestamp = _context.ApplicationStatus
                            .AsNoTracking()
                            .SingleOrDefault(s => s.Id == statusId)
                            .Timestamp;

            if (status.Timestamp != timestamp)
            {
                return(false);
            }

            _context.Entry(status).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                //TODO: Log
                return(false);
            }

            return(true);
        }
Beispiel #6
0
        public async Task <ApplicationStatus> GetAppStatusAsync(long id)
        {
            if (UnitOfWork == null)
            {
                throw new InvalidOleVariantTypeException("Unit of work is not provided.");
            }

            var          result = new ApplicationStatus();
            const string getAppByIdSprocName = "GetAppStatus";

            using (DbConnection connection = UnitOfWork.Connection)
            {
                await connection.OpenAsync();

                var command = connection.CreateCommand() as SqlCommand;
                if (command != null)
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = getAppByIdSprocName;
                    command.Parameters.AddWithValue("@AppId", id);

                    using (SqlDataReader reader = await command.ExecuteReaderAsync())
                    {
                        if (reader.HasRows && await reader.ReadAsync())
                        {
                            result = Mapper.Map(reader, result);
                        }
                    }
                }
            }
            return(result);
        }
        private static ApplicationStatus GetStatus(string value)
        {
            string            status    = (value ?? "new").ToLowerInvariant();
            ApplicationStatus appStatus = ApplicationStatus.New;

            switch (status)
            {
            case "new":
                appStatus = ApplicationStatus.New;
                break;

            case "approved":
                appStatus = ApplicationStatus.Approved;
                break;

            case "archived":
                appStatus = ApplicationStatus.Archived;
                break;

            case "inconsideration":
                appStatus = ApplicationStatus.InConsideration;
                break;

            case "prescreened":
                appStatus = ApplicationStatus.Prescreened;
                break;

            case "rejected":
                appStatus = ApplicationStatus.Rejected;
                break;
            }

            return(appStatus);
        }
Beispiel #8
0
        /// <summary>Handles the <see cref="GridView.RowDataBound"/> event of the <see cref="StatusesGrid"/> control.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewRowEventArgs"/> instance containing the event data.</param>
        private void StatusesGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow)
            {
                return;
            }

            var row = e.Row;

            if (row == null)
            {
                return;
            }

            var deleteButton = (Button)row.FindControl("DeleteButton");

            if (deleteButton == null)
            {
                return;
            }

            var statusId = GetStatusId(row);

            if (statusId.HasValue && ApplicationStatus.IsStatusUsed(statusId.Value))
            {
                deleteButton.Enabled = false;
                return;
            }

            deleteButton.Attributes["data-confirm-click"] = this.Localize("DeleteConfirm");
            Dnn.Utility.RequestEmbeddedScript(this.Page, "confirmClick.js");
        }
Beispiel #9
0
    public static List <AllotementApplication> GetPendingApplications(ApplicationStatus status, long categoryId)
    {
        DataClassesDataContext dataContext = new DataClassesDataContext();
        var applications = (from application in dataContext.tbAllotmentApplications
                            where application.Status == Convert.ToInt32(status) && application.QuarterCategory == categoryId
                            select application).OrderBy(x => x.DateOfjoining).ThenBy(x => x.DateOfBirth);
        List <AllotementApplication> allotements = new List <AllotementApplication>();

        foreach (var application in applications)
        {
            AllotementApplication obj = new AllotementApplication();
            obj.Id     = application.ID;
            obj.Status = (ApplicationStatus)application.Status;
            obj.AAN    = application.tblUser.AAN;
            obj.Dept   = application.tblOffice.Name;
            obj.AlreadyAllottedQuarter = application.OtherQuarterNumber == "-1" ? "N/A" : application.OtherQuarterNumber;
            obj.GradePay        = GradePay.GetPayGradesById(Convert.ToInt64(application.GradePay));
            obj.Designation     = application.tblDesignation.Name;
            obj.UserName        = application.tblUser.fullName;
            obj.QuarterType     = application.tblQuarterCategory.Name;
            obj.Cast            = application.Cast == "-select--" ? "N/A" : application.Cast;
            obj.QuarterNumber   = application.QuarterNumber;
            obj.MedicalCategory = application.MedicalCategory.HasValue && application.MedicalCategory.Value >= 0 ? true : false;
            if (application.tblUser.DateOfJoining.HasValue)
            {
                obj.dateOfJoining = application.tblUser.DateOfJoining.Value;
            }
            allotements.Add(obj);
        }
        return(allotements);
    }
Beispiel #10
0
 internal static void SetError(ApplicationStatus status)
 {
     resultInfo = new ResultInfo(false, "Заявка еще не обработана")
     {
         Status = status
     };
 }
Beispiel #11
0
    public static List <AllotementApplication> GetAllotedUsers(ApplicationStatus status, long categoryId)
    {
        DataClassesDataContext dataContext = new DataClassesDataContext();
        var applications = dataContext.uspGetAllotedUsers(Convert.ToInt32(status), Convert.ToInt32(categoryId));
        List <AllotementApplication> allotements = new List <AllotementApplication>();

        foreach (var application in applications)
        {
            AllotementApplication obj = new AllotementApplication();
            obj.Id     = application.ID;
            obj.Status = (ApplicationStatus)application.Status;
            obj.AAN    = application.AAN;
            obj.Dept   = application.OfficeName;
            obj.AlreadyAllottedQuarter = application.OtherQuarterNumber;
            obj.GradePay         = GradePay.GetPayGradesById(Convert.ToInt64(application.GradePay));
            obj.Designation      = application.DesignationName;
            obj.UserName         = application.fullName;
            obj.QuarterType      = application.QuarterCategoryName;
            obj.Cast             = application.Cast;
            obj.QuarterNumber    = application.QuarterNumber;
            obj.DateOfAllottment = application.DateOfAllotement.HasValue ? application.DateOfAllotement.Value : DateTime.Now;
            if (application.DateOfjoining.HasValue)
            {
                obj.dateOfJoining = application.DateOfjoining.Value;
            }
            allotements.Add(obj);
        }
        return(allotements);
    }
        public async Task <ActionResult> Create([Bind(Include = "Id,StudentId,DepartmentId,AboutYou")] ApplicationForm applicationForm)
        {
            applicationForm.StudentId = 0;
            if (ModelState.IsValid)
            {
                var userId = User.Identity.GetUserId();
                applicationForm.StudentId =
                    db.Students.FirstOrDefault(f => f.ApplicationUserId == userId).Id;
                var app   = db.ApplicationForms.Add(applicationForm);
                var value = await db.SaveChangesAsync();

                if (value > 0)
                {
                    ApplicationStatus applicationStatus = new ApplicationStatus
                    {
                        ApplicationFormId = app.Id,
                        IsAccepted        = null,
                        TeacherId         = null
                    };

                    db.ApplicationStatuses.Add(applicationStatus);
                    await db.SaveChangesAsync();
                }

                return(RedirectToAction("Profile", "Students"));
            }

            ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", applicationForm.DepartmentId);
            ViewBag.StudentId    = new SelectList(db.Students, "Id", "Name", applicationForm.StudentId);
            return(View(applicationForm));
        }
        /// <summary>
        /// 更改申请书状态
        /// </summary>
        /// <param name="applicationId">申请书ID</param>
        /// <param name="from">修改前的状态</param>
        /// <param name="to">修改后的状态</param>
        /// <param name="privilege">修改权限</param>
        /// <param name="logDTO">操作日志</param>
        /// <returns></returns>
        public void ChangeApplicationStatus(string applicationId, ApplicationStatus from, ApplicationStatus to, Func <Application, bool> privilege, AddApplicationLogDTO logDTO = null)
        {
            using (var ctx = new AspodesDB())
            {
                //取出申请书
                var application = ctx.Applications.FirstOrDefault(a => a.ApplicationId == applicationId);
                if (null == application)
                {
                    throw new NotFoundException("未找到申请书");
                }
                //验证权限
                if (!privilege(application))
                {
                    throw new OtherException("您没有权限或操作时间有误");
                }
                //修改状态
                if (application.Status != from)
                {
                    throw new OtherException("申请书状态错误");
                }

                application.Status = to;

                //添加日志
                if (logDTO != null)
                {
                    ApplicationLogRepository.AddApplicationLog(ctx, logDTO);
                }

                ctx.SaveChanges();
            }
        }
        public async Task ChangeStatusAsync(string applictionId, ApplicationStatus newStatus, string operatorUsername)
        {
            var application = await _context.Applications
                              .FirstOrDefaultAsync(ap => ap.Id.ToString() == applictionId)
                              .ConfigureAwait(false);

            var userId = await _userService.GetUserIdAsync(operatorUsername);

            var user = await _userService.FindUserAsync(operatorUsername);

            bool currentStatus = application.Status == ApplicationStatus.Rejected || application.Status == ApplicationStatus.Approved;
            bool wantedStatus  = newStatus == ApplicationStatus.Rejected || newStatus == ApplicationStatus.Approved;

            if (currentStatus && wantedStatus)
            {
                throw new ArgumentException("Someone did it before you do");
            }

            if (application.UserId != userId)
            {
                application.UserId = userId;
            }

            application.Status = newStatus;

            await _context.SaveChangesAsync();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationListing"/> class.
 /// </summary>
 public ApplicationListing()
 {
     this.userStatuses        = UserStatus.LoadStatuses(this.PortalId);
     this.applicationStatuses = ApplicationStatus.GetStatuses(this.PortalId);
     this.leadsList           = (new ListController()).GetListEntryInfoCollection(Employment.Utility.LeadListName, Null.NullString, this.PortalId).Cast <ListEntryInfo>().ToDictionary(entry => entry.EntryID);
     this.locations           = Location.LoadLocations(null, this.PortalId);
 }
Beispiel #16
0
        public override void Validate()
        {
            ValidationStatus = ValidationStatus.Pending;

            var notValidatedList = mRequestResponseList.Where(item => ValidationStatus.Pending == item.ValidationStatus).ToList();

            for (int i = 0; i < notValidatedList.Count; ++i)
            {
                ApplicationStatus.SetProgress(i * 100 / notValidatedList.Count);

                notValidatedList[i].Validate();

                if (null != OnPairValidated)
                {
                    int exactIndex = mRequestResponseList.IndexOf(notValidatedList[i]);
                    OnPairValidated(this, new ElementEventArgs(exactIndex));
                }
            }

            RemoveDeviceSpecificCommands();

            ValidationStatus = (mRequestResponseList.All(item => ValidationStatus.Passed == item.ValidationStatus))
                           ? ValidationStatus.Passed
                           : ValidationStatus.Failed;
            Validated = true;
        }
Beispiel #17
0
        public ProcessInfo(uint processId, DateTime startTime, string applicationName, string serviceShortName, ApplicationType appType, ApplicationStatus appStatus, uint sessionId, bool restartable)
        {
            if (string.IsNullOrWhiteSpace(applicationName))
            {
                throw new ArgumentNullException(nameof(applicationName));
            }

            if (!appType.IsValid())
            {
                throw new ArgumentException($"The { nameof(ApplicationType) } provided must be a valid enum.", nameof(appType));
            }
            if (!appStatus.IsValid())
            {
                throw new ArgumentException($"The { nameof(ApplicationStatus) } provided must be a valid enum.", nameof(appStatus));
            }

            ProcessId                 = processId;
            StartTime                 = startTime;
            ApplicationName           = applicationName;
            ServiceShortName          = serviceShortName;
            ApplicationType           = appType;
            ApplicationStatus         = appStatus;
            TerminalServicesSessionId = sessionId;
            Restartable               = restartable;
        }
        public async Task <ActionResult <ApplicationStatus> > PostApplicationStatus(ApplicationStatus applicationStatus)
        {
            _context.ApplicationStatus.Add(applicationStatus);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetApplicationStatus", new { id = applicationStatus.ID }, applicationStatus));
        }
Beispiel #19
0
        private void mainTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (_isProcessing)
            {
                return;
            }
            _isProcessing = true;

            // Check database for new items to fetch
            try
            {
                //check for shutdown flag.
                if (ShutdownHasBeenSignalled())
                {
                    if (_adHocQueueController.GlobalListOfOutstandingAdHocRequests.Count == 0)
                    {
                        NLogger.Instance.Info("No pending adhoc requests...Deleting signal file and shutting down process");
                        File.Delete(ShutdownSignalFile());
                        Application.Exit();
                    }
                    else
                    {
                        NLogger.Instance.Info("{0} pending adhoc request(s)... cannot shutdown. Will retry as long as shutdown signal exists.");
                        return;
                    }
                }

                RaiseMessageEvent(string.Format("Checking at {0}", DateTime.Now.ToString("HH:mm:ss")));

                // All items from DB

                ProcessDataRequests(Db.GetTickerItemsToProcess("EXEC GetBloombergDataRequestItems"), false);

                if (DateTime.Now > _setStatusTime)
                {
                    ApplicationStatus.SetStatus(Application.ProductName, "OK", "", 1);
                    _setStatusTime = DateTime.Now.AddSeconds(59);
                }
                else
                {
                    RaiseMessageEvent(string.Format("Next Status set {0}", _setStatusTime.ToString("dd MMM yy HH:mm:ss")));
                }
            }
            catch (SqlException ex)
            {
                NLogger.Instance.Error("Sql server error: Exiting program. Error: {0}", ex.ToString());
                Application.Exit();
            }
            catch (Exception ex)
            {
                NLogger.Instance.Fatal(ex.ToString(), ex);
                RaiseMessageEvent(string.Format("Error: {0}", ex));
                Static.EmailException("BB Field Value Retriever Error", ex.ToString(), ex);
            }
            finally
            {
                _isProcessing = false;
            }
        }
 public void StartExecution()
 {
     appStatus = ApplicationStatus.Running;
     while (DataManager.HasPendingMessages())
     {
         ProcessMessage(DataManager.GetNextMessage());
     }
 }
Beispiel #21
0
        public ActionResult DeleteConfirmed(int id)
        {
            ApplicationStatus applicationStatus = db.ApplicationStatus1.Find(id);

            db.ApplicationStatus1.Remove(applicationStatus);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// Gets the name of the status with the given ID.
        /// </summary>
        /// <param name="statusId">The ID of the status.</param>
        /// <returns>The name of the status</returns>
        protected static string GetApplicationStatusName(int?statusId)
        {
            if (statusId.HasValue)
            {
                return(ApplicationStatus.GetStatusName(statusId.Value));
            }

            return(null);
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ApplicationStatus applicationStatus = await db.ApplicationStatus.FindAsync(id);

            db.ApplicationStatus.Remove(applicationStatus);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        //
        // GET: /ApplicationStatus/Edit/5

        public ActionResult Edit(int id = 0)
        {
            ApplicationStatus applicationstatus = db.ApplicationStatus.Find(id);

            if (applicationstatus == null)
            {
                return(HttpNotFound());
            }
            return(View(applicationstatus));
        }
 /// <summary>
 /// 获取属于某种状态的申请书Id列表
 /// </summary>
 /// <param name="status"></param>
 /// <returns></returns>
 internal List <string> GetAppIdListByStatus(ApplicationStatus status)
 {
     using (var _context = new AspodesDB())
     {
         return(_context.Applications
                .Where(a => a.Status == status)
                .Where(a => a.CurrentYear == SystemConfig.ApplicationStartYear)
                .Select(a => a.ApplicationId).ToList());
     }
 }
Beispiel #26
0
        public SwiftImportManager()
        {
            ApplicationStatus.SetStatus("SwiftImporter", "OK", "Started", statusCheckMins);
            Timer timer = new Timer(statusCheckMins * 60000);

            timer.Elapsed += timer_Elapsed;
#if !DEBUG
            timer.Start();
#endif
        }
Beispiel #27
0
 public ActionResult Edit([Bind(Include = "ApplicationStatusId,StatusName,StatusDescription")] ApplicationStatus applicationStatus)
 {
     if (ModelState.IsValid)
     {
         db.Entry(applicationStatus).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(applicationStatus));
 }
Beispiel #28
0
        public void Dispatch(ApplicationStatus status)
        {
            switch (status)
            {
            case ApplicationStatus.Banned:
            {
                HostedWindows.ForEach((element) => element.Banned());

                break;
            }

            case ApplicationStatus.Blocked:
            {
                HostedWindows.ForEach((element) => element.Blocked());

                break;
            }

            case ApplicationStatus.Connected:
            {
                HostedWindows.ForEach((element) => element.Connected());

                break;
            }

            case ApplicationStatus.Disconnected:
            {
                HostedWindows.ForEach((element) => element.Disconnect());

                break;
            }

            case ApplicationStatus.Loading:
            {
                HostedWindows.ForEach((element) => element.Loading());

                break;
            }

            case ApplicationStatus.Normal:
            {
                HostedWindows.ForEach((element) => element.Normal());

                break;
            }

            default:
            {
                ArgumentException ex = new ArgumentException($"Incorrect appstatus '{status.ToString()}' for changing.");
                ex.ToLog(Components.LogLevel.Error);

                throw ex;
            }
            }
        }
Beispiel #29
0
 public RentalApplication(int propertyId, RentalApplicant rentalApplicant, ApplicationStatus status,
                          /*int notificationPreference,*/ DateTime created, DateTime updated)//, Reference rentlReference)
 {
     RentalPropertyId = propertyId;
     RentalApplicant  = rentalApplicant;
     //RentalReference = rentlReference;
     Status = status;
     //NotificationPreference = notificationPreference;
     Created  = created;
     Modified = updated;
 }
Beispiel #30
0
        private async Task HandleAsync(LeaseFinalizedEvent @event)
        {
            // Handle lease finalize event - update property status
            //

            //var listing = _context.PropertyListing.FirstOrDefault(l => l.RentalPropertyId == @event.RentalPropertyId);

            //var pId = listing.RentalPropertyId;



            var rentalProperty = _context.RentalProperty.FirstOrDefault(p => p.OriginalId == @event.RentalPropertyId);

            if (rentalProperty != null)
            {
                var listing = _context.PropertyListing.FirstOrDefault(l => l.RentalPropertyId == rentalProperty.Id);



                var applicaton = _context.RentalApplication.FirstOrDefault(a => a.RentalPropertyId == rentalProperty.Id);

                ApplicationStatus appStatus = (ApplicationStatus)Enum.Parse(typeof(ApplicationStatus), "Finalized");

                applicaton.StatusUpdate(applicaton, appStatus);
                ListingStatus status = (ListingStatus)Enum.Parse(typeof(ListingStatus), "rented", true);

                if (listing != null)
                {
                    listing.DeActivate(listing);
                }

                rentalProperty.StatusUpdate(status);

                _context.PropertyListing.Update(listing);
                _context.RentalProperty.Update(rentalProperty);
                _context.RentalApplication.Update(applicaton);

                try
                {
                    await _context.SaveChangesAsync();

                    Log.Information("Message  {MessageType} with Id {MessageId} has been handled successfully", @event.MessageType, @event.MessageId);
                }
                catch (Exception ex)
                {
                    //throw ex;
                    Log.Error(ex, "Error while handling {MessageType} message with id {MessageId}.", @event.MessageType, @event.MessageId);
                }
            }



            //throw new NotImplementedException();
        }
Beispiel #31
0
        public void ApplicationThread(DatabaseEntry entry, ApplicationStatus status)
        {
            FormStorage<ApplicationStatus> storage = new FormStorage<ApplicationStatus>(status);
            Application.Run(new ApplicationEditor(entry, storage));

            if(_applicationEditors.ContainsKey(Thread.CurrentThread))
            {
                _applicationEditors.Remove(Thread.CurrentThread);
            }

            SAPS.Instance.Invoke(new ApplicationDelegate(UpdateApplications), new object[] { entry, storage.Value });
        }
 public void ShouldRenderAcceptedMessage()
 {
     var sut = new ApplicationStatus();
     var model = new LoanApplication()
     {
         IsAccepted = true,
     };
     HtmlDocument html = sut.RenderAsHtml(model);
     var isAcceptedMsgRenderd = html.GetElementbyId("acceptedMessage") != null;
     var isDeclinedMsgRenderd = html.GetElementbyId("declinedMessage") != null;
     Assert.That(isAcceptedMsgRenderd, Is.True);
     Assert.That(isDeclinedMsgRenderd, Is.False);
 }
 public void changeUserApplicationStatus(String username, String vacancyNumber, ApplicationStatus appStatus)
 {
     //Literals needs to be put in an internationalization format.
     switch (appStatus)
     {
         case ApplicationStatus.APPLIED:
             changeApplicationStatus(username, vacancyNumber, "APPLIED");
             break;
         case ApplicationStatus.REGRETTED:
             changeApplicationStatus(username, vacancyNumber, "REGRETTED");
             break;
         case ApplicationStatus.SHORTLISTED:
             changeApplicationStatus(username, vacancyNumber, "SHORTLISTED");
             break;
         case ApplicationStatus.INTERVIEW:
             changeApplicationStatus(username, vacancyNumber, "INTERVIEW");
             break;
     }
 }
Beispiel #34
0
 public void Submit()
 {
     Status = ApplicationStatus.Submitted;
 }
Beispiel #35
0
        /// <summary>Sets the application status (typically displayed in a status bar).</summary>
        /// <param name="message">Message that is to be displayed</param>
        /// <param name="status">Application status</param>
        /// <param name="model">Application status view model</param>
        /// <param name="viewName">Name of a custom view to be used by the status.</param>
        /// <param name="controllerType">Type of the controller (used as a context to find views)</param>
        public static void Status(string message = "", ApplicationStatus status = ApplicationStatus.Ready, StatusViewModel model = null, string viewName = "", Type controllerType = null)
        {
            var context = new RequestContext(new RouteData("StatusMessage", new {viewName = string.Empty}));

            // If a controller type was specified, we try to use it, which provides a context to find views
            Controller controller;
            if (controllerType == null) controller = new Controller();
            else controller = Activator.CreateInstance(controllerType) as Controller;
            if (controller == null) controller = new Controller();
            context.ProcessingController = controller;

            context.Result = controller.StatusMessage(viewName, message, status, model);

            ExecuteViewHandlers(context);
        }
Beispiel #36
0
 private void StartApplicationThread(DatabaseEntry entry, ApplicationStatus status)
 {
     if(!_applicationEditors.ContainsValue(entry) || status == ApplicationStatus.Print)
     {
         Thread thread = new Thread(() => ApplicationThread(entry, status));
         _applicationEditors.Add(thread, entry);
         thread.Start();
     }
 }
Beispiel #37
0
        /// <summary>Creates a specific status message</summary>
        /// <param name="viewName">Name of the view.</param>
        /// <param name="message">The message to be displayed.</param>
        /// <param name="status">The general status that is to be set.</param>
        /// <param name="model">A custom view model that is to be used.</param>
        /// <remarks>The message and status is ignored if a custom model is passed.</remarks>
        protected StatusMessageResult StatusMessage(string viewName = "", string message = "", ApplicationStatus status = ApplicationStatus.Ready, StatusViewModel model = null)
        {
            if (model == null)
                model = new StatusViewModel {Status = status, Message = message};

            var result = new StatusMessageResult {Model = model};

            FindView(viewName, ViewLevel.Normal, result);

            return result;
        }
Beispiel #38
0
        private void UpdateApplications(DatabaseEntry entry, ApplicationStatus status)
        {
            switch(status)
            {
                case ApplicationStatus.Remove:
                    _availableEntries.Remove(entry);
                    Database.Instance.Remove(entry);
                    break;
                case ApplicationStatus.Approve:
                    // remove from available
                    entry.votes.Add(_user.Name, Vote.Approve);
                    _availableEntries.Remove(entry);

                    if (entry.StudentType == StudentType.Undergraduate)
                    {
                        if (entry.stage == Stage.Lower)
                        {
                            entry.stage = Stage.Higher;
                        }
                        else if(entry.stage == Stage.Higher)
                        {
                            entry.stage = Stage.Approved;
                            // Database.Instance.Remove(entry);
                        }
                    }
                    else
                    {
                        int approve = entry.votes.Values.Count(e => e == Vote.Approve);
                        if (entry.stage == Stage.Lower && approve > CollegeData.CommitteeMembers / 2)
                        {
                            entry.stage = Stage.Higher;
                        }
                        else if (entry.stage == Stage.Higher)
                        {
                            entry.stage = Stage.Approved;
                            // Database.Instance.Remove(entry);
                        }
                    }
                    break;
                case ApplicationStatus.Reject:
                    // remove from available
                    entry.votes.Add(_user.Name, Vote.Reject);
                    _availableEntries.Remove(entry);

                    int reject = entry.votes.Values.Count(e => e == Vote.Reject);
                    if(entry.StudentType == StudentType.Undergraduate)
                    {
                        entry.stage = Stage.Rejected;
                        // Database.Instance.Remove(entry);
                    }
                    else
                    {
                        if (reject > CollegeData.CommitteeMembers / 2 || entry.stage == Stage.Higher)
                        {
                            entry.stage = Stage.Rejected;
                            // Database.Instance.Remove(entry);
                        }
                    }
                    break;
            }

            BaseSystem.Instance.Serialize();
            SAPS.Instance.UpdateApplicationList();
            SAPS.Instance.UpdateCharts();
        }