/// <summary> /// Sets status of eform on page load. Stores the step COMPLETED in the process. /// User is directed to the step AFTER one completed. /// </summary> protected virtual string SetEFormStatus() { EFormController ect = new EFormController(); string page = Request.Path; string status; try { status = ect.GetEFormStatus(this.EFormId); } catch { status = ""; } // get status from the db string nextstatus = EformStatusManager.GetNextStatus(status, Request.UrlReferrer.PathAndQuery, Request.Path); // only updates status when one of the above pages is loaded AND eform has not been already approved (concurrency) if (nextstatus != "" && !status.Equals(EformStatusManager.Status_Approved) && !status.Equals(EformStatusManager.Status_Deleted)) { ect.UpdateEFormStatus(this.EFormId, nextstatus, this.EFormUserName); status = nextstatus; } return(status); }
/// <summary> /// Determines the next eform status based on current status, referring page, and destination page. /// The status may stay the same. /// </summary> /// <param name="status"></param> /// <param name="fromPage"></param> /// <param name="toPage"></param> /// <returns></returns> public static string GetNextStatus(string status, string fromPage, string toPage) { if (!status.Equals(EformStatusManager.Status_Approved)) // make sure eform has not already been approved { EformStatusType statusType = EformStatusManager.GetStatusType(status); EformPageType fromPageType = EformStatusManager.GetPageType(fromPage); EformPageType toPageType = EformStatusManager.GetPageType(toPage); EformStatusType nextType = GetNextStatusByToPage(statusType, fromPageType, toPageType); return(EformStatusManager.GetStatusString(nextType)); } else { return(""); } }