protected void Page_Load(object sender, EventArgs e)
        {
            _logonSettings = (LogonReturnValue)Session[SessionName.LogonSettings];

            _lblError.Text = string.Empty;
            timeDetails = (TimeDetails)Session[SessionName.TimeDetails];

            if (!IsPostBack)
            {
                try
                {
                    if (timeDetails == null)
                    {
                        _lblError.Text = "Session is timeout or time details are not saved in the previous screen. Please go back and enter details again.";
                        return;
                    }
                    ViewState["CurrentAdditionalDetail"] = null;
                    ViewState["FileReviewProjectId"] = DataConstants.DummyGuid.ToString();
                    LoadAdditionalDetailTimeEntry();
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    _lblError.Text = DataConstants.WSEndPointErrorMessage;
                }
                catch (Exception ex)
                {
                    _lblError.Text = ex.Message;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the time entry.
        /// </summary>
        private bool IsAdditionalDetailTimeExists(TimeDetails timeDetails)
        {
            TimeServiceClient timeService = null;

            try
            {
                timeService = new TimeServiceClient();
                IRIS.Law.WebServiceInterfaces.Time.Time time = new IRIS.Law.WebServiceInterfaces.Time.Time();
                time.Id          = timeDetails.Id;
                time.ProjectId   = timeDetails.ProjectId;
                time.FeeEarnerId = timeDetails.FeeEarnerId;
                time.TimeTypeId  = timeDetails.TimeTypeId;

                TimeReturnValue returnValue = timeService.GetAddtionalDetailTime(_logonId, time);

                if (returnValue.Success)
                {
                    if (returnValue.Time != null)
                    {
                        if (returnValue.AdditionalDetail != null)
                        {
                            if (returnValue.AdditionalDetail.CurrentAdditionalDetails != AdditionalDetails.None)
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (timeService != null)
                {
                    if (timeService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        timeService.Close();
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void LoadLastSavedTimeEntry()
 {
     _isLoadingLastSavedTimeEntry = true;
     try
     {
         if (Session[SessionName.TimeDetails] != null)
         {
             TimeDetails timeDetails = (TimeDetails)Session[SessionName.TimeDetails];
             _msAddTimeEntry.ProjectId = timeDetails.ProjectId;
             _txtUnits.Text            = ((TimeDetails)Session[SessionName.TimeDetails]).Units.ToString();
             _txtNotes.Text            = ((TimeDetails)Session[SessionName.TimeDetails]).Notes;
         }
     }
     catch (Exception ex)
     {
         _lblMessage.CssClass = "errorMessage";
         _lblMessage.Text     = ex.Message;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            // 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];
                _memberId = (Guid)Session[SessionName.MemberId];
            }

            _lblMessage.Text = string.Empty;
            timeDetails = (TimeDetails)Session[SessionName.TimeDetails];

            if (!IsPostBack)
            {
                try
                {
                    if (timeDetails == null)
                    {
                        _lblMessage.CssClass = "errorMessage";
                        _lblMessage.Text = "Session is timeout or time details are not saved in the previous screen. Please go back and enter details again.";
                        return;
                    }
                    ViewState["CurrentAdditionalDetail"] = null;
                    ViewState["FileReviewProjectId"] = DataConstants.DummyGuid.ToString();
                    LoadAdditionalDetailTimeEntry();
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    _lblMessage.Text = DataConstants.WSEndPointErrorMessage;
                    _lblMessage.CssClass = "errorMessage";
                }
                catch (Exception ex)
                {
                    _lblMessage.CssClass = "errorMessage";
                    _lblMessage.Text = ex.Message;
                }
            }
        }
Exemplo n.º 5
0
        protected void _btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                TimeDetails timeDetails = new TimeDetails();

                if ((Guid)ViewState["AddTimeProjectId"] != _msAddTimeEntry.ProjectIdConfirm)
                {
                    ViewState["AddTimeProjectId"] = _msAddTimeEntry.ProjectIdConfirm;
                }

                Guid _feeEarnerId = (Guid)Session[SessionName.DefaultFeeEarner];

                if (_msAddTimeEntry.FeeEarnerId != DataConstants.DummyGuid)
                {
                    _feeEarnerId = _msAddTimeEntry.FeeEarnerId;
                }

                timeDetails.ProjectId     = (Guid)ViewState["AddTimeProjectId"];
                timeDetails.FeeEarnerId   = _feeEarnerId;//(Guid)Session[SessionName.DefaultFeeEarner];
                timeDetails.TimeTypeId    = new Guid(GetValueOnIndexFromArray(_ddlTimeType.SelectedValue.Trim(), 0));
                timeDetails.TimeTypeCatId = Convert.ToInt32(GetValueOnIndexFromArray(_ddlTimeType.SelectedValue.Trim(), 1));
                timeDetails.Units         = Convert.ToInt32(_txtUnits.Text.Trim());
                timeDetails.Notes         = _txtNotes.Text.Trim();
                timeDetails.Date          = DateTime.Now.Date;
                // No validation for limits from the web
                timeDetails.CanProceed = true;
                timeDetails.Id         = 0;

                if (IsAdditionalDetailTimeExists(timeDetails))
                {
                    Session[SessionName.TimeDetails] = timeDetails;
                    Response.Redirect("~/Pages/Time/AdditionalTimeDetailsMobile.aspx", true);
                }
                else
                {
                    TimeServiceClient timeService = null;
                    TimeReturnValue   returnValue = null;
                    try
                    {
                        timeService = new TimeServiceClient();
                        IRIS.Law.WebServiceInterfaces.Time.Time time = new IRIS.Law.WebServiceInterfaces.Time.Time();

                        time.ProjectId   = timeDetails.ProjectId;
                        time.FeeEarnerId = timeDetails.FeeEarnerId;
                        time.TimeTypeId  = timeDetails.TimeTypeId;
                        time.Units       = timeDetails.Units;
                        time.Notes       = timeDetails.Notes;
                        time.Date        = DateTime.Now.Date;
                        //No validation for limits from the web
                        time.DontCheckLimits = true;
                        time.BillingCodeID   = 1; // Default to "Default - None Selected"

                        //No timeId present. Add a new time entry
                        returnValue = timeService.AddTime(_logonId, time, null, false);

                        if (returnValue.Success)
                        {
                            Session[SessionName.TimeDetails] = null;

                            _lblMessage.CssClass = "successMessage";
                            _lblMessage.Text     = "Time entry saved successfully";

                            //Reset time entry fields
                            ResetFields();
                        }
                        else
                        {
                            throw new Exception(returnValue.Message);
                        }
                    }
                    catch (System.ServiceModel.EndpointNotFoundException)
                    {
                        _lblMessage.Text     = DataConstants.WSEndPointErrorMessage;
                        _lblMessage.CssClass = "errorMessage";
                    }
                    catch (Exception ex)
                    {
                        _lblMessage.CssClass = "errorMessage";
                        _lblMessage.Text     = ex.Message;
                    }
                    finally
                    {
                        if (timeService != null)
                        {
                            if (timeService.State != System.ServiceModel.CommunicationState.Faulted)
                            {
                                timeService.Close();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets the valid time types for the matter.
        /// </summary>
        private void GetTimeTypes()
        {
            _ddlTimeType.Items.Clear();
            if (_msAddTimeEntry.ProjectId != DataConstants.DummyGuid)
            {
                TimeServiceClient timeService = null;
                try
                {
                    timeService = new TimeServiceClient();
                    CollectionRequest      collectionRequest = new CollectionRequest();
                    TimeTypeSearchCriteria criteria          = new TimeTypeSearchCriteria();
                    criteria.IncludeArchived = false;
                    criteria.ProjectId       = _msAddTimeEntry.ProjectId;
                    TimeTypeSearchReturnValue returnValue = timeService.TimeTypeSearch(_logonId,
                                                                                       collectionRequest, criteria);

                    if (returnValue.Success)
                    {
                        for (int i = 0; i < returnValue.TimeTypes.Rows.Length; i++)
                        {
                            ListItem item = new ListItem();
                            item.Text  = returnValue.TimeTypes.Rows[i].Description.ToString();
                            item.Value = returnValue.TimeTypes.Rows[i].Id.ToString().Trim() + "$" + Convert.ToString(returnValue.TimeTypes.Rows[i].CatId);
                            _ddlTimeType.Items.Add(item);
                        }

                        //Dont set default time type if we have come back from additional details pg
                        if (!_isLoadingLastSavedTimeEntry)
                        {
                            _ddlTimeType.SelectedIndex = -1;
                            for (int i = 0; i < _ddlTimeType.Items.Count; i++)
                            {
                                if (GetValueOnIndexFromArray(_ddlTimeType.Items[i].Value, 0) == "3ef2937c-c31b-430c-82ed-5701a84f258e")
                                {
                                    _ddlTimeType.Items[i].Selected = true;
                                }
                            }
                        }
                        else
                        {
                            TimeDetails timeDetails = (TimeDetails)Session[SessionName.TimeDetails];
                            _ddlTimeType.SelectedIndex = -1;
                            for (int i = 0; i < _ddlTimeType.Items.Count; i++)
                            {
                                if (GetValueOnIndexFromArray(_ddlTimeType.Items[i].Value, 0) == timeDetails.TimeTypeId.ToString())
                                {
                                    _ddlTimeType.Items[i].Selected = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        throw new Exception(returnValue.Message);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (timeService != null)
                    {
                        if (timeService.State != System.ServiceModel.CommunicationState.Faulted)
                        {
                            timeService.Close();
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Loads the time entry.
        /// </summary>
        private bool IsAdditionalDetailTimeExists(TimeDetails timeDetails)
        {
            TimeServiceClient timeService = null;
            try
            {
                timeService = new TimeServiceClient();
                IRIS.Law.WebServiceInterfaces.Time.Time time = new IRIS.Law.WebServiceInterfaces.Time.Time();
                time.Id = timeDetails.Id;
                time.ProjectId = timeDetails.ProjectId;
                time.FeeEarnerId = timeDetails.FeeEarnerId;
                time.TimeTypeId = timeDetails.TimeTypeId;

                TimeReturnValue returnValue = timeService.GetAddtionalDetailTime(_logonSettings.LogonId, time);

                if (returnValue.Success)
                {
                    if (returnValue.Time != null)
                    {
                        if (returnValue.AdditionalDetail != null)
                        {
                            if (returnValue.AdditionalDetail.CurrentAdditionalDetails != AdditionalDetails.None)
                            {
                                return true;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
                return false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (timeService != null)
                {
                    if (timeService.State != System.ServiceModel.CommunicationState.Faulted)
                        timeService.Close();
                }
            }
        }
        protected void _btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (_txtUnits.Text == "0")
                {
                    _lblMessage.CssClass = "errorMessage";
                    _lblMessage.Text = "Units cannot be zero";
                    return;
                }

                TimeDetails timeDetails = new TimeDetails();
                timeDetails.ProjectId = (Guid)Session[SessionName.ProjectId];
                timeDetails.FeeEarnerId = _logonSettings.UserDefaultFeeMemberId;
                timeDetails.TimeTypeId = new Guid(GetValueOnIndexFromArray(_ddlTimeType.SelectedValue.Trim(), 0));
                timeDetails.TimeTypeCatId = Convert.ToInt32(GetValueOnIndexFromArray(_ddlTimeType.SelectedValue.Trim(), 1));
                timeDetails.Units = Convert.ToInt32(_txtUnits.Text.Trim());
                timeDetails.Notes = _txtNotes.Text.Trim();
                timeDetails.Date = DateTime.Now.Date;
                // No validation for limits from the web
                timeDetails.CanProceed = true;
                if (ViewState["TimeId"] == null)
                {
                    timeDetails.Id = 0;
                }
                else
                {
                    timeDetails.Id = Convert.ToInt32(ViewState["TimeId"]);
                }

                if (IsAdditionalDetailTimeExists(timeDetails))
                {
                    Session[SessionName.TimeDetails] = timeDetails;
                    Response.Redirect("~/Pages/Time/AdditionalTimeDetails.aspx", true);
                }
                else
                {
                    TimeServiceClient timeService = null;
                    TimeReturnValue returnValue = null;
                    try
                    {
                        timeService = new TimeServiceClient();
                        IRIS.Law.WebServiceInterfaces.Time.Time time = new IRIS.Law.WebServiceInterfaces.Time.Time();

                        time.ProjectId = (Guid)Session[SessionName.ProjectId];
                        time.FeeEarnerId = _logonSettings.UserDefaultFeeMemberId;
                        time.TimeTypeId = timeDetails.TimeTypeId;
                        time.Units = timeDetails.Units;
                        time.Notes = timeDetails.Notes;
                        time.Date = DateTime.Now.Date;
                        //No validation for limits from the web
                        time.DontCheckLimits = true;
                        time.BillingCodeID = 1; // Default to "Default - None Selected"

                        if (timeDetails.Id == 0)
                        {
                            //No timeId present. Add a new time entry
                            returnValue = timeService.AddTime(_logonSettings.LogonId, time, null, false);
                        }
                        else
                        {
                            //If a timeId is present then we are updating an existing time entry
                            time.Id = timeDetails.Id;
                            returnValue = timeService.UpdateTime(_logonSettings.LogonId, time, null);
                        }

                        if (returnValue.Success)
                        {
                            Session[SessionName.TimeDetails] = null;
                            //Redirect the user to the timesheet where entry would be listed
                            Response.Redirect("ViewTimesheet.aspx", true);
                        }
                        else
                        {
                            throw new Exception(returnValue.Message);
                        }
                    }
                    catch (System.ServiceModel.EndpointNotFoundException)
                    {
                        _lblMessage.Text = DataConstants.WSEndPointErrorMessage;
                        _lblMessage.CssClass = "errorMessage";
                    }
                    catch (Exception ex)
                    {
                        _lblMessage.CssClass = "errorMessage";
                        _lblMessage.Text = ex.Message;
                    }
                    finally
                    {
                        if (timeService != null)
                        {
                            if (timeService.State != System.ServiceModel.CommunicationState.Faulted)
                                timeService.Close();
                        }
                    }
                }
            }
        }
        protected void _btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                TimeDetails timeDetails = new TimeDetails();

                if ((Guid)ViewState["AddTimeProjectId"] != _msAddTimeEntry.ProjectIdConfirm)
                {
                    ViewState["AddTimeProjectId"] = _msAddTimeEntry.ProjectIdConfirm;
                }

                Guid _feeEarnerId = (Guid)Session[SessionName.DefaultFeeEarner];

                if (_msAddTimeEntry.FeeEarnerId != DataConstants.DummyGuid)
                {
                    _feeEarnerId = _msAddTimeEntry.FeeEarnerId;
                }

                timeDetails.ProjectId = (Guid)ViewState["AddTimeProjectId"];
                timeDetails.FeeEarnerId = _feeEarnerId;//(Guid)Session[SessionName.DefaultFeeEarner];
                timeDetails.TimeTypeId = new Guid(GetValueOnIndexFromArray(_ddlTimeType.SelectedValue.Trim(), 0));
                timeDetails.TimeTypeCatId = Convert.ToInt32(GetValueOnIndexFromArray(_ddlTimeType.SelectedValue.Trim(), 1));
                timeDetails.Units = Convert.ToInt32(_txtUnits.Text.Trim());
                timeDetails.Notes = _txtNotes.Text.Trim();
                timeDetails.Date = DateTime.Now.Date;
                // No validation for limits from the web
                timeDetails.CanProceed = true;
                timeDetails.Id = 0;

                if (IsAdditionalDetailTimeExists(timeDetails))
                {
                    Session[SessionName.TimeDetails] = timeDetails;
                    Response.Redirect("~/Pages/Time/AdditionalTimeDetailsMobile.aspx", true);
                }
                else
                {
                    TimeServiceClient timeService = null;
                    TimeReturnValue returnValue = null;
                    try
                    {
                        timeService = new TimeServiceClient();
                        IRIS.Law.WebServiceInterfaces.Time.Time time = new IRIS.Law.WebServiceInterfaces.Time.Time();

                        time.ProjectId = timeDetails.ProjectId;
                        time.FeeEarnerId = timeDetails.FeeEarnerId;
                        time.TimeTypeId = timeDetails.TimeTypeId;
                        time.Units = timeDetails.Units;
                        time.Notes = timeDetails.Notes;
                        time.Date = DateTime.Now.Date;
                        //No validation for limits from the web
                        time.DontCheckLimits = true;
                        time.BillingCodeID = 1; // Default to "Default - None Selected"

                        //No timeId present. Add a new time entry
                        returnValue = timeService.AddTime(_logonId, time, null, false);

                        if (returnValue.Success)
                        {
                            Session[SessionName.TimeDetails] = null;

                            _lblMessage.CssClass = "successMessage";
                            _lblMessage.Text = "Time entry saved successfully";

                            //Reset time entry fields
                            ResetFields();
                        }
                        else
                        {
                            throw new Exception(returnValue.Message);
                        }
                    }
                    catch (System.ServiceModel.EndpointNotFoundException)
                    {
                        _lblMessage.Text = DataConstants.WSEndPointErrorMessage;
                        _lblMessage.CssClass = "errorMessage";
                    }
                    catch (Exception ex)
                    {
                        _lblMessage.CssClass = "errorMessage";
                        _lblMessage.Text = ex.Message;
                    }
                    finally
                    {
                        if (timeService != null)
                        {
                            if (timeService.State != System.ServiceModel.CommunicationState.Faulted)
                                timeService.Close();
                        }
                    }
                }
            }
        }
        protected void _btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (_txtUnits.Text == "0")
                {
                    _lblMessage.CssClass = "errorMessage";
                    _lblMessage.Text     = "Units cannot be zero";
                    return;
                }

                TimeDetails timeDetails = new TimeDetails();
                timeDetails.ProjectId     = (Guid)Session[SessionName.ProjectId];
                timeDetails.FeeEarnerId   = _logonSettings.UserDefaultFeeMemberId;
                timeDetails.TimeTypeId    = new Guid(GetValueOnIndexFromArray(_ddlTimeType.SelectedValue.Trim(), 0));
                timeDetails.TimeTypeCatId = Convert.ToInt32(GetValueOnIndexFromArray(_ddlTimeType.SelectedValue.Trim(), 1));
                timeDetails.Units         = Convert.ToInt32(_txtUnits.Text.Trim());
                timeDetails.Notes         = _txtNotes.Text.Trim();
                timeDetails.Date          = DateTime.Now.Date;
                // No validation for limits from the web
                timeDetails.CanProceed = true;
                if (ViewState["TimeId"] == null)
                {
                    timeDetails.Id = 0;
                }
                else
                {
                    timeDetails.Id = Convert.ToInt32(ViewState["TimeId"]);
                }

                if (IsAdditionalDetailTimeExists(timeDetails))
                {
                    Session[SessionName.TimeDetails] = timeDetails;
                    Response.Redirect("~/Pages/Time/AdditionalTimeDetails.aspx", true);
                }
                else
                {
                    TimeServiceClient timeService = null;
                    TimeReturnValue   returnValue = null;
                    try
                    {
                        timeService = new TimeServiceClient();
                        IRIS.Law.WebServiceInterfaces.Time.Time time = new IRIS.Law.WebServiceInterfaces.Time.Time();

                        time.ProjectId   = (Guid)Session[SessionName.ProjectId];
                        time.FeeEarnerId = _logonSettings.UserDefaultFeeMemberId;
                        time.TimeTypeId  = timeDetails.TimeTypeId;
                        time.Units       = timeDetails.Units;
                        time.Notes       = timeDetails.Notes;
                        time.Date        = DateTime.Now.Date;
                        //No validation for limits from the web
                        time.DontCheckLimits = true;
                        time.BillingCodeID   = 1; // Default to "Default - None Selected"

                        if (timeDetails.Id == 0)
                        {
                            //No timeId present. Add a new time entry
                            returnValue = timeService.AddTime(_logonSettings.LogonId, time, null, false);
                        }
                        else
                        {
                            //If a timeId is present then we are updating an existing time entry
                            time.Id     = timeDetails.Id;
                            returnValue = timeService.UpdateTime(_logonSettings.LogonId, time, null);
                        }

                        if (returnValue.Success)
                        {
                            Session[SessionName.TimeDetails] = null;
                            //Redirect the user to the timesheet where entry would be listed
                            Response.Redirect("ViewTimesheet.aspx", true);
                        }
                        else
                        {
                            throw new Exception(returnValue.Message);
                        }
                    }
                    catch (System.ServiceModel.EndpointNotFoundException)
                    {
                        _lblMessage.Text     = DataConstants.WSEndPointErrorMessage;
                        _lblMessage.CssClass = "errorMessage";
                    }
                    catch (Exception ex)
                    {
                        _lblMessage.CssClass = "errorMessage";
                        _lblMessage.Text     = ex.Message;
                    }
                    finally
                    {
                        if (timeService != null)
                        {
                            if (timeService.State != System.ServiceModel.CommunicationState.Faulted)
                            {
                                timeService.Close();
                            }
                        }
                    }
                }
            }
        }