protected void Page_Load(object sender, EventArgs e) { _lblMessage.Text = string.Empty; // If Session expires, redirect the user to the login screen if (Session[SessionName.LogonId] == null) { Response.Redirect("~/LoginMobile.aspx?SessionExpired=1", true); } else { _logonId = (Guid)Session[SessionName.LogonId]; } if (!IsPostBack) { //Select the fee earner associated with the logged-in user if (Session[SessionName.DefaultFeeEarner] != null) { _msAddTimeEntry.DefaultFeeEarnerId = (Guid)Session[SessionName.DefaultFeeEarner]; } if (!string.IsNullOrEmpty(Request.QueryString["Success"])) { if (Request.QueryString["Success"] == "1") { _lblMessage.CssClass = "successMessage"; _lblMessage.Text = "Time entry saved successfully"; } if (Session[SessionName.ProjectId] != null) { _msAddTimeEntry.ProjectId = (Guid)Session[SessionName.ProjectId]; } } else { //if we are coming from the Additional Detail pg then display the entered values if (Request.UrlReferrer != null) { string pageName = Request.UrlReferrer.AbsolutePath; pageName = AppFunctions.GetPageNameByUrl(pageName); if (pageName == "AdditionalTimeDetailsMobile.aspx") { // Load Last saved time entry LoadLastSavedTimeEntry(); return; } } } Session[SessionName.TimeDetails] = null; } }
protected void Page_Load(object sender, EventArgs e) { _logonSettings = (LogonReturnValue)Session[SessionName.LogonSettings]; _lblMessage.Text = string.Empty; if (Request.QueryString["edit"] != "true") { _divBtnAddNew.Visible = false; } if (!IsPostBack) { try { //Edit time entry if (Session[SessionName.TimeId] != null && Session[SessionName.MatterReference] != null) { int timeId = Convert.ToInt32(Session[SessionName.TimeId]); string matterReference = Session[SessionName.MatterReference].ToString(); //Store the timeId as its required for updating ViewState["TimeId"] = timeId; LoadTimeEntry(timeId, matterReference); } else if (Session[SessionName.ProjectId] != null) { //if a project id is in context then get the time types GetTimeTypes((Guid)Session[SessionName.ProjectId]); SetDefaultTimeType(); } //if we are coming from the Additional Detail pg then display the entered values if (Request.UrlReferrer != null) { string pageName = Request.UrlReferrer.AbsolutePath; pageName = AppFunctions.GetPageNameByUrl(pageName); if (pageName == "AdditionalTimeDetails.aspx") { // Load Last saved time entry LoadLastSavedTimeEntry(); return; } } Session[SessionName.TimeDetails] = null; } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { //Clear session values after loading the time entry so that the time entry page //does not open in edit mode the next time the user visits the time recording pg. Session[SessionName.TimeId] = null; Session[SessionName.MatterReference] = null; } } }
/// <summary> /// Checks if the current link is the selected link. /// </summary> /// <param name="url">The URL.</param> /// <returns></returns> private bool CheckForSelectedLink(string url) { string currentPg = AppFunctions.GetPageNameByUrl(Request.Url.AbsolutePath); return(url.Contains(currentPg)); }