Exemple #1
0
 public List <DataContracts.Pentaho.DC_PentahoApiCallLogDetails> Pentaho_SupplierApiCall_List(DataContracts.Pentaho.DC_PentahoApiCallLogDetails_RQ RQ)
 {
     using (BusinessLayer.BL_Pentaho obj = new BL_Pentaho())
     {
         return(obj.Pentaho_SupplierApiCall_List(RQ));
     }
 }
Exemple #2
0
        public List <DataContracts.Pentaho.DC_PentahoApiCallLogDetails> Pentaho_SupplierApiCall_List(DataContracts.Pentaho.DC_PentahoApiCallLogDetails_RQ RQ)
        {
            try
            {
                using (ConsumerEntities context = new ConsumerEntities())
                {
                    var Supplier_APILocation = (from a in context.Supplier_APILocation select a).AsQueryable();


                    if (RQ.Supplier_Id != null)
                    {
                        if (RQ.Supplier_Id != Guid.Empty)
                        {
                            Supplier_APILocation = Supplier_APILocation.Where(w => w.Supplier_Id == RQ.Supplier_Id);
                        }
                    }

                    if (RQ.Entity_Id != null)
                    {
                        if (RQ.Entity_Id != Guid.Empty)
                        {
                            Supplier_APILocation = Supplier_APILocation.Where(w => w.Entity_Id == RQ.Entity_Id);
                        }
                    }

                    var Supplier_ApiCallLog = (from a in context.Supplier_ApiCallLog select a).AsQueryable();
                    if (!string.IsNullOrWhiteSpace(RQ.Status))
                    {
                        Supplier_ApiCallLog = Supplier_ApiCallLog.Where(w => w.Status.ToUpper().Trim() == RQ.Status.Trim().ToUpper());
                    }

                    var result = (from log in Supplier_ApiCallLog
                                  join loc in Supplier_APILocation on log.SupplierApiLocation_Id equals loc.Supplier_APILocation_Id
                                  join sup in context.Supplier.AsNoTracking() on loc.Supplier_Id equals sup.Supplier_Id
                                  join ent in context.m_masterattributevalue.AsNoTracking() on loc.Entity_Id equals ent.MasterAttributeValue_Id
                                  select new DataContracts.Pentaho.DC_PentahoApiCallLogDetails
                    {
                        Entity_Id = loc.Entity_Id,
                        ApiPath = loc.API_Path,              //.Split('/').Last().Split('.').First().Trim(),
                        Create_User = log.Create_User,
                        Create_Date = log.Create_Date,
                        Edit_User = log.Edit_User,
                        Edit_Date = log.Edit_Date,
                        Entity = ent.AttributeValue,
                        Message = log.Message,
                        PentahoCall_Id = log.PentahoCall_Id,
                        Status = log.Status,
                        Supplier = sup.Code,
                        SupplierApiCallLog_Id = log.SupplierApiCallLog_Id,
                        SupplierApiLocation_Id = log.SupplierApiLocation_Id,
                        Supplier_Id = loc.Supplier_Id
                    }).ToList();

                    return(result);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }