public static Response RetrieveFilteredAudits(SearhFilter filter)
        {
            try
            {
                var filters = new Dictionary<string, string>();
                if (!string.IsNullOrEmpty(filter.Type))
                {
                    filters.Add("TYPE", filter.Type);
                }
                if (!string.IsNullOrEmpty(filter.RequestedBy))
                {
                    filters.Add("REQUESTEDBY", filter.RequestedBy);
                }
                if (!string.IsNullOrEmpty(filter.ApprovedBy))
                {
                    filters.Add("APPROVEDBY", filter.ApprovedBy);
                }
                if (!string.IsNullOrEmpty(filter.Status))
                {
                    filters.Add("STATUS", filter.Status);
                }
                if (filter.RequestedFrom.HasValue)
                {
                    filters.Add("REQUESTEDFROM", filter.RequestedFrom.Value.ToString());
                }
                if (filter.RequestedTo.HasValue)
                {
                    filters.Add("REQUESTEDTO", filter.RequestedTo.Value.AddHours(23).ToString());
                }

                var audits = AuditTrailDL.RetrieveFilteredAudits(filters);
                return new Response
                {
                    DynamicList = new { data = audits }
                };
            }
            catch (Exception ex)
            {
                ErrorHandler.WriteError(ex);
                return new Response
                {
                    SuccessMsg = string.Empty,
                    ErrorMsg = ex.Message,
                    DynamicList = new { data = new List<AuditTrail>() }
                };
            }
        }
Exemplo n.º 2
0
        public static Response RetrieveFilteredCards(SearhFilter filter)
        {
            try
            {
                var filters = new Dictionary<string, string>();
                if (!string.IsNullOrEmpty(filter.RequestedBy))
                {
                    filters.Add("VUSERNAME", filter.RequestedBy);
                }
                if (!string.IsNullOrEmpty(filter.Status))
                {
                    filters.Add("PRINTSTATUS", filter.Status);
                }
                if (filter.RequestedFrom.HasValue)
                {
                    filters.Add("REQUESTEDFROM", filter.RequestedFrom.Value.ToString());
                }
                if (filter.RequestedTo.HasValue)
                {
                    filters.Add("REQUESTEDTO", filter.RequestedTo.Value.AddHours(23).ToString());
                }

                var cards = CardDL.RetrieveFilteredCards(filters);
                return new Response
                {
                    DynamicList = new { data = cards }
                };
            }
            catch (Exception ex)
            {
                ErrorHandler.WriteError(ex);
                return new Response
                {
                    SuccessMsg = string.Empty,
                    ErrorMsg = ex.Message,
                    DynamicList = new { data = new List<Card>() }
                };
            }
        }