示例#1
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();
                    }
                }
            }
        }
        /// <summary>
        /// Loads the time entry.
        /// </summary>
        private void LoadTimeEntry(int timeId, string matterReference)
        {
            TimeServiceClient timeService = null;

            try
            {
                timeService = new TimeServiceClient();
                TimeReturnValue returnValue = timeService.GetTime(_logonSettings.LogonId, timeId);

                if (returnValue.Success)
                {
                    if (returnValue.Time != null)
                    {
                        Session[SessionName.ProjectId] = returnValue.Time.ProjectId;
                        GetClientDetails(matterReference);
                        GetTimeTypes(returnValue.Time.ProjectId);

                        _ddlTimeType.SelectedIndex = -1;
                        for (int i = 0; i < _ddlTimeType.Items.Count; i++)
                        {
                            if (GetValueOnIndexFromArray(_ddlTimeType.Items[i].Value, 0) == returnValue.Time.TimeTypeId.ToString())
                            {
                                _ddlTimeType.Items[i].Selected = true;
                                break;
                            }
                        }

                        _txtUnits.Text = returnValue.Time.Units.ToString();
                        _txtNotes.Text = returnValue.Time.Notes;
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (timeService != null)
                {
                    if (timeService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        timeService.Close();
                    }
                }
            }
        }
 public TimeReturnValue AddTime(HostSecurityToken oHostSecurityToken, Time time, TimeAdditionalDetail additionalTime, bool postToAccounts)
 {
     TimeReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oTimeService = new TimeService();
         returnValue = oTimeService.AddTime(Functions.GetLogonIdFromToken(oHostSecurityToken), time, additionalTime, postToAccounts);
     }
     else
     {
         returnValue = new TimeReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
        public TimeReturnValue GetAddtionalDetailTime(HostSecurityToken oHostSecurityToken, Time time)
        {
            TimeReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oTimeService = new TimeService();
                returnValue  = oTimeService.GetAddtionalDetailTime(Functions.GetLogonIdFromToken(oHostSecurityToken), time);
            }
            else
            {
                returnValue         = new TimeReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
        public TimeReturnValue AddTime(HostSecurityToken oHostSecurityToken, Time time, TimeAdditionalDetail additionalTime, bool postToAccounts)
        {
            TimeReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oTimeService = new TimeService();
                returnValue  = oTimeService.AddTime(Functions.GetLogonIdFromToken(oHostSecurityToken), time, additionalTime, postToAccounts);
            }
            else
            {
                returnValue         = new TimeReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
示例#6
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();
                            }
                        }
                    }
                }
            }
        }
 public TimeReturnValue GetTime(HostSecurityToken oHostSecurityToken, int timeId)
 {
     TimeReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oTimeService = new TimeService();
         returnValue = oTimeService.GetTime(Functions.GetLogonIdFromToken(oHostSecurityToken), timeId);
     }
     else
     {
         returnValue = new TimeReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
        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();
                            }
                        }
                    }
                }
            }
        }