Example #1
0
        protected virtual void _(Events.FieldDefaulting <PMTimeActivity, PMTimeActivity.projectTaskID> e)
        {
            if (e.Row == null)
            {
                return;
            }

            if (e.Row.ParentTaskNoteID != null)
            {
                EPActivityApprove rowParentTask = PXSelect <EPActivityApprove> .Search <EPActivityApprove.noteID>(this, e.Row.ParentTaskNoteID);

                if (rowParentTask != null && rowParentTask.ProjectID == e.Row.ProjectID)
                {
                    e.NewValue = rowParentTask.ProjectTaskID;
                    e.Cancel   = true;
                }
            }

            EPEarningType earningRow = (EPEarningType)PXSelectorAttribute.Select <EPActivityApprove.earningTypeID>(e.Cache, e.Row);

            if (e.NewValue == null && earningRow != null && earningRow.ProjectID == e.Row.ProjectID)
            {
                PMTask defTask = PXSelectorAttribute.Select(e.Cache, e.Row, e.Cache.GetField(typeof(EPTimeCardSummary.projectTaskID)), earningRow.TaskID) as PMTask;
                if (defTask != null && defTask.VisibleInTA == true)
                {
                    e.NewValue = earningRow.TaskID;
                    e.Cancel   = true;
                }
            }
        }
        // PUT api/<controller>/5
        /// <summary>
        /// Puts the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        /// <exception cref="HttpResponseException"></exception>
        public EPEarningType Put(string id, [FromBody] EPEarningType value)
        {
            EPEarningType objItem = new EPEarningType();

            try
            {
                objItem = EPEarningTypeManager.UpdateItem(value);
            }
            catch (Exception ObjEx)
            {
                IfindLogManager.AddItem(new IfindLog()
                {
                    LinkUrl = Request.RequestUri.AbsoluteUri, Exception = ObjEx.Message, Message = ObjEx.StackTrace
                });
            }
            return(objItem);
        }
Example #3
0
        protected virtual void _(Events.FieldDefaulting <PMTimeActivity, PMTimeActivity.projectID> e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEarningType earningType = PXSelect <EPEarningType, Where <EPEarningType.typeCD, Equal <Required <EPEarningType.typeCD> > > > .Select(this, e.Row.EarningTypeID);

            if (earningType != null && earningType.ProjectID != null && e.Row.ProjectID == null &&
                PXSelectorAttribute.Select(e.Cache, e.Row, e.Cache.GetField(typeof(PMTimeActivity.projectID)), earningType.ProjectID) != null                 //available in selector
                )
            {
                e.NewValue = earningType.ProjectID;
                e.Cancel   = true;
            }
        }