public override void Persist()
        {
            var groups = Activity.Cache.Updated.Cast <EPActivityApprove>()
                         .Where(a => a.IsReject == true && a.TimeCardCD != null)
                         .GroupBy(a => a.TimeCardCD)
                         .ToList();

            using (var ts = new PXTransactionScope())
            {
                if (groups.Count > 0)
                {
                    TimeCardMaint maint = PXGraph.CreateInstance <TimeCardMaint>();

                    foreach (var group in groups)
                    {
                        maint.Clear();
                        maint.Document.Current = maint.Document.Search <EPTimeCard.timeCardCD>(group.Key);
                        maint.Actions["Reject"].Press();
                        maint.Persist();
                    }
                }

                base.Persist();

                ts.Complete();
            }
        }
Exemple #2
0
        public static void Release(List <EPTimeCardRow> timeCards)
        {
            TimeCardMaint timeCardMaint = PXGraph.CreateInstance <TimeCardMaint>();

            for (int i = 0; i < timeCards.Count; i++)
            {
                timeCardMaint.Clear();
                timeCardMaint.Document.Current = timeCardMaint.Document.Search <EPTimeCard.timeCardCD>(timeCards[i].TimeCardCD);

                if (timeCardMaint.Document.Current == null)
                {
                    PXProcessing <EPTimeCardRow> .SetError(i, Messages.TimecardCannotBeReleased_NoRights);
                }
                else
                {
                    try
                    {
                        timeCardMaint.release.Press();
                        PXProcessing <EPTimeCardRow> .SetInfo(i, ActionsMessages.RecordProcessed);
                    }
                    catch (Exception e)
                    {
                        PXProcessing <EPTimeCardRow> .SetError(i, e is PXOuterException?e.Message + "\r\n" + String.Join("\r\n", ((PXOuterException)e).InnerMessages) : e.Message);
                    }
                }
            }
        }
Exemple #3
0
        public static void Release(List <EPTimeCardRow> timeCards)
        {
            TimeCardMaint timeCardMaint = PXGraph.CreateInstance <TimeCardMaint>();

            foreach (EPTimeCardRow item in timeCards)
            {
                timeCardMaint.Clear();
                timeCardMaint.Document.Current = timeCardMaint.Document.Search <EPTimeCard.timeCardCD>(item.TimeCardCD);
                timeCardMaint.release.Press();
            }
        }
 protected virtual void Create()
 {
     using (new PXPreserveScope())
     {
         TimeCardMaint graph = (TimeCardMaint)CreateInstance(typeof(TimeCardMaint));
         graph.Clear(PXClearOption.ClearAll);
         graph.Document.Insert();
         if (Filter.Current.EmployeeID != null && Filter.Current.EmployeeID != graph.Document.Current.EmployeeID)
         {
             graph.Document.Current.EmployeeID = Filter.Current.EmployeeID;
             graph.Document.Update(graph.Document.Current);
         }
         PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.InlineWindow);
     }
 }
        protected void Delete()
        {
            EPTimeCard row = PXSelect <EPTimeCard, Where <EPTimeCard.timeCardCD, Equal <Current <TimecardWithTotals.timeCardCD> > > > .Select(this);

            if (row == null)
            {
                return;
            }

            using (new PXPreserveScope())
            {
                TimeCardMaint graph = (TimeCardMaint)CreateInstance(typeof(TimeCardMaint));
                graph.Clear(PXClearOption.ClearAll);
                graph.Document.Current = row;
                graph.Delete.Press();
            }
        }