Exemple #1
0
        public CounterPartiesDTO Parse(CounterParty item)
        {
            CounterPartiesDTO itemObj = new CounterPartiesDTO();

            itemObj.ID           = item.ID;
            itemObj.Name         = item.Name;
            itemObj.Identifier   = item.Identifier;
            itemObj.PropCode     = item.PropCode;
            itemObj.PipeDuns     = item.PipeDuns;
            itemObj.IsActive     = item.IsActive;
            itemObj.CreatedBy    = item.CreatedBy;
            itemObj.CreatedDate  = item.CreatedDate;
            itemObj.ModifiedBy   = item.ModifiedBy;
            itemObj.ModifiedDate = item.ModifiedDate;
            return(itemObj);
        }
Exemple #2
0
        // PageNo  = 0,1,2,3...so on.
        public List <CounterPartiesDTO> GetCounterPartiesUsingPaging(string Keyword, int PipelineID, int PageNo, int PageSize, string order, string orderDir)
        {
            List <CounterPartiesDTO> items  = new List <CounterPartiesDTO>();
            List <CounterParty>      Result = new List <CounterParty>();

            if (string.IsNullOrEmpty(Keyword))
            {
                var QueryData = DbContext.CounterParty.Where(a =>
                                                             (a.PipelineID == PipelineID || a.PipelineID == 0) &&
                                                             a.IsActive); //.Skip(PageNo * PageSize).Take(PageSize);
                var QueryDataWithOrder = GetCounterPartiesWithOrder(QueryData, orderDir, order);
                Result = QueryDataWithOrder.Skip(PageNo * PageSize).Take(PageSize).ToList();
            }
            else
            {
                var QueryDataWithKeyword = DbContext.CounterParty.Where(a =>
                                                                        (a.Identifier.Contains(Keyword) ||
                                                                         a.PropCode.Contains(Keyword) ||
                                                                         a.Name.Contains(Keyword)) &&
                                                                        (a.PipelineID == PipelineID || a.PipelineID == 0) &&
                                                                        a.IsActive); //.OrderBy(a => a.Identifier).Skip(PageNo * PageSize).Take(PageSize).ToList();
                var QueryDataWithOrder = GetCounterPartiesWithOrder(QueryDataWithKeyword, orderDir, order);
                Result = QueryDataWithOrder.Skip(PageNo * PageSize).Take(PageSize).ToList();
            }

            foreach (var item in Result)
            {
                CounterPartiesDTO itemObj = new CounterPartiesDTO();
                itemObj.ID           = item.ID;
                itemObj.Name         = item.Name;
                itemObj.Identifier   = item.Identifier;
                itemObj.PropCode     = item.PropCode;
                itemObj.PipelineID   = item.PipelineID;
                itemObj.IsActive     = item.IsActive;
                itemObj.CreatedBy    = item.CreatedBy;
                itemObj.CreatedDate  = item.CreatedDate;
                itemObj.ModifiedBy   = item.ModifiedBy;
                itemObj.ModifiedDate = item.ModifiedDate;
                items.Add(itemObj);
            }

            return(items);
        }
Exemple #3
0
        public List <CounterPartiesDTO> GetCounterParties(string Keyword, int PipelineID)
        {
            List <CounterPartiesDTO> items = new List <CounterPartiesDTO>();
            List <CounterParty>      data  = new List <CounterParty>();

            if (string.IsNullOrEmpty(Keyword))
            {
                data = DbContext.CounterParty.Where(a =>
                                                    (a.PipelineID == PipelineID || a.PipelineID == 0) &&
                                                    a.IsActive
                                                    ).ToList();
            }
            else
            {
                data = DbContext.CounterParty.Where(a =>
                                                    (a.Identifier.Contains(Keyword) ||
                                                     a.PropCode.Contains(Keyword) ||
                                                     a.Name.Contains(Keyword)) &&
                                                    (a.PipelineID == PipelineID || a.PipelineID == 0) &&
                                                    a.IsActive
                                                    ).ToList();
            }

            foreach (var item in data)
            {
                CounterPartiesDTO itemObj = new CounterPartiesDTO();
                itemObj.ID           = item.ID;
                itemObj.Name         = item.Name;
                itemObj.Identifier   = item.Identifier;
                itemObj.PropCode     = item.PropCode;
                itemObj.PipelineID   = item.PipelineID;
                itemObj.IsActive     = item.IsActive;
                itemObj.CreatedBy    = item.CreatedBy;
                itemObj.CreatedDate  = item.CreatedDate;
                itemObj.ModifiedBy   = item.ModifiedBy;
                itemObj.ModifiedDate = item.ModifiedDate;
                items.Add(itemObj);
            }

            return(items);
        }