Ejemplo n.º 1
0
        public ExecuteActionResult ExecuteAction(ExecuteActionQuery query)
        {
            DisableCaching();
            var result = new ExecuteActionResult();

            try
            {
                if (query == null)
                {
                    throw new ArgumentNullException("query");
                }
                var dataService = new RosterDataService();
                {
                    var paramCollection = query.Parameters == null ? new List <Tuple <string, object> >():
                                          query.Parameters.Select(item => new Tuple <string, object>(item.Name, item.Value)).ToList();

                    var currentUserParam = paramCollection.FirstOrDefault(p => p.Item1.Equals("@currentUser"));
                    if (currentUserParam != null)
                    {
                        // change :: sharepoint user id -> roster user id
                        paramCollection.Remove(currentUserParam);
                        paramCollection.Add(new Tuple <string, object>("@currentUser", DbFieldUser.GetUserRosterId(SPContext.Current.Web.CurrentUser)));
                    }

                    result.Message = dataService.ExecuteProcedure(query.Name, paramCollection);
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public ExecuteActionResult CancelRoster(ItemDataQuery query)
        {
            DisableCaching();
            var result = new ExecuteActionResult();

            try
            {
                result.Message = new DataHelpers().CancelRoster(query.ItemId);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public ExecuteActionResult RejectRoster(RejectRosterQuery query)
        {
            DisableCaching();
            var result = new ExecuteActionResult();

            try
            {
                result.Message = new DataHelpers().RejectRoster(query.ListId, query.ItemId, query.Reason);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public ExecuteActionResult SubmitSingleTimesheet(ItemDataQuery query)
        {
            DisableCaching();
            var result = new ExecuteActionResult();

            try
            {
                result.Message = new DataHelpers().SubmitTimesheet(query.ListId, query.ItemId);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            return(result);
        }
Ejemplo n.º 5
0
        public ExecuteActionResult SubmitTimesheet(SubmitTimesheetQuery query)
        {
            DisableCaching();
            var result = new ExecuteActionResult();

            try
            {
                result.Message = new DataHelpers().SubmitTimesheet(query.StoredProcedureName, query.WorkerId, query.RosterIDs, query.PeriodStart, query.PeriodEnd);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            return(result);
        }