private async Task <ISecurityQuestionSearchViewModel> SearchDataAsync(ISearchModel searchModel, ISecurityQuestionSearchViewModel model, CancellationToken cancellationToken)
        {
            IPredicate        pred      = null;
            IPredicate        finalPred = null;
            List <IPredicate> list      = new List <IPredicate>();

            if (!string.IsNullOrEmpty(searchModel.SearchText))
            {
                searchModel.SearchText = searchModel.SearchText.Trim();
                pred = Predicate <string> .GetPredicate("Question", searchModel.SearchText, Operator.Like);

                list.Add(pred);
            }

            if (list.Count == 0)
            {
                list.Add(Predicate <string> .GetPredicate("1", "1", Operator.Equal));
            }

            finalPred = CompoundPredicate.GetCompoundPredicate(LogicalOperator.AND, list.ToArray());

            if (model == null)
            {
                model = await PoulateDropDownListAsync(model, cancellationToken);
            }

            model.SecurityQuestionList = await _dal.SelectAllByFilterAsync(finalPred, cancellationToken, model.GetPageInfo(searchModel.CPage, searchModel.TPage, searchModel.TRows, searchModel.PSize, searchModel.UserId));

            return(model);
        }
Exemplo n.º 2
0
        private async Task <IAdvertisementSearchViewModel> SearchDataAsync(ISearchModel searchModel, IAdvertisementSearchViewModel model, CancellationToken cancellationToken)
        {
            IPredicate        pred      = null;
            IPredicate        finalPred = null;
            List <IPredicate> list      = new List <IPredicate>();


            if (!string.IsNullOrEmpty(searchModel.SearchText))
            {
                searchModel.SearchText = searchModel.SearchText.Trim();
                if (searchModel.SearchField == -1)
                {
                    pred = CompoundPredicate.GetCompoundPredicate(
                        LogicalOperator.OR,
                        Predicate <string> .GetPredicate("A.Name", searchModel.SearchText, Operator.Like),
                        Predicate <string> .GetPredicate("A.Description", searchModel.SearchText, Operator.Like));



                    list.Add(pred);
                }
                else if (searchModel.SearchField == -2)
                {
                    pred = Predicate <long> .GetPredicate("T.ThemeId", System.Convert.ToInt64(searchModel.SearchText), Operator.Equal);


                    list.Add(pred);
                }
                else if (searchModel.SearchField == -3)
                {
                    pred = Predicate <long> .GetPredicate("C.CategoryId", System.Convert.ToInt64(searchModel.SearchText), Operator.Equal);

                    list.Add(pred);
                }
            }

            if (list.Count == 0)
            {
                list.Add(Predicate <string> .GetPredicate("1", "1", Operator.Equal));
            }

            finalPred = CompoundPredicate.GetCompoundPredicate(LogicalOperator.AND, list.ToArray());

            if (model == null)
            {
                model = await PoulateDropDownListAsync(model, cancellationToken);
            }

            model.AdvertisementList = await _dal.SelectAllByFilterAsync(finalPred, cancellationToken, model.GetPageInfo(searchModel.CPage, searchModel.TPage, searchModel.TRows, searchModel.PSize, searchModel.UserId));

            return(model);
        }
        public async Task <ICategorySearchViewModel> SearchDataAsync(ISearchModel searchModel, ICategorySearchViewModel model, CancellationToken cancellationToken)
        {
            IPredicate        pred      = null;
            IPredicate        finalPred = null;
            List <IPredicate> list      = new List <IPredicate>();

            if (!string.IsNullOrEmpty(searchModel.SearchText))
            {
                if (searchModel.SearchField == -1)
                {
                    pred = CompoundPredicate.GetCompoundPredicate(
                        LogicalOperator.OR,
                        Predicate <string> .GetPredicate("C.CategoryName", searchModel.SearchText, Operator.Like),
                        Predicate <string> .GetPredicate("T.Name", searchModel.SearchText, Operator.Like)
                        );



                    list.Add(pred);
                }
                else if (searchModel.SearchField == 1)
                {
                    pred = Predicate <string> .GetPredicate("C.CategoryName", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }

                else if (searchModel.SearchField == 2)
                {
                    pred = Predicate <string> .GetPredicate("T.Name", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
            }

            if (list.Count == 0)
            {
                list.Add(Predicate <string> .GetPredicate("1", "1", Operator.Equal));
            }

            finalPred = CompoundPredicate.GetCompoundPredicate(LogicalOperator.AND, list.ToArray());

            if (model == null)
            {
                model = await PoulateDropDownListAsync(model, cancellationToken);
            }

            model.CategoryList = await _dal.SelectAllByFilterAsync(finalPred, cancellationToken, model.GetPageInfo(searchModel.CPage, searchModel.TPage, searchModel.TRows, searchModel.PSize, searchModel.UserId));

            return(model);
        }
Exemplo n.º 4
0
        private async Task <IEmailServerSearchViewModel> SearchDataAsync(ISearchModel searchModel, IEmailServerSearchViewModel model, CancellationToken cancellationToken)
        {
            IPredicate        pred      = null;
            IPredicate        finalPred = null;
            List <IPredicate> list      = new List <IPredicate>();


            if (!string.IsNullOrEmpty(searchModel.SearchText))
            {
                searchModel.SearchText = searchModel.SearchText.Trim();
                if (searchModel.SearchField == -1)
                {
                    pred = CompoundPredicate.GetCompoundPredicate(
                        LogicalOperator.OR,
                        Predicate <string> .GetPredicate("ServerName", searchModel.SearchText, Operator.Like),
                        Predicate <string> .GetPredicate("ServerIP", searchModel.SearchText, Operator.Like));


                    System.Int32 port;
                    if (System.Int32.TryParse(searchModel.SearchText, out port))
                    {
                        pred = CompoundPredicate.GetCompoundPredicate(
                            LogicalOperator.OR,
                            pred,
                            Predicate <System.Int32> .GetPredicate("CONVERT(int,EmailPort)", port, Operator.Equal)
                            );
                    }

                    list.Add(pred);
                }
                else if (searchModel.SearchField == 1)
                {
                    pred = Predicate <string> .GetPredicate("ServerName", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
                else if (searchModel.SearchField == 2)
                {
                    pred = Predicate <string> .GetPredicate("ServerIP", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }

                else if (searchModel.SearchField == 3)
                {
                    System.Int32 port;
                    if (System.Int32.TryParse(searchModel.SearchText, out port))
                    {
                        pred = Predicate <System.Int32> .GetPredicate("CONVERT(int,EmailPort)", port, Operator.Equal);

                        list.Add(pred);
                    }
                    else
                    {
                        list.Add(Predicate <string> .GetPredicate("1", "2", Operator.Equal));
                    }
                }
            }

            if (list.Count == 0)
            {
                list.Add(Predicate <string> .GetPredicate("1", "1", Operator.Equal));
            }

            finalPred = CompoundPredicate.GetCompoundPredicate(LogicalOperator.AND, list.ToArray());

            if (model == null)
            {
                model = await PoulateDropDownListAsync(model, cancellationToken);
            }

            model.EmailServerList = await _dal.SelectAllByFilterAsync(finalPred, cancellationToken, model.GetPageInfo(searchModel.CPage, searchModel.TPage, searchModel.TRows, searchModel.PSize, searchModel.UserId));

            return(model);
        }
Exemplo n.º 5
0
        private async Task <ILocationSearchViewModel> SearchDataAsync(ISearchModel searchModel, ILocationSearchViewModel model, CancellationToken cancellationToken)
        {
            IPredicate        pred      = null;
            IPredicate        finalPred = null;
            List <IPredicate> list      = new List <IPredicate>();

            var sdsd = searchModel.CPage;


            if (searchModel.CountryId > 0)
            {
                pred = Predicate <long> .GetPredicate("T.CountryId", searchModel.CountryId, Operator.Equal);

                list.Add(pred);
            }

            if (searchModel.LocationId > 0)
            {
                pred = Predicate <long> .GetPredicate("O.LocationId", searchModel.LocationId, Operator.Equal);

                list.Add(pred);
            }

            if (!string.IsNullOrEmpty(searchModel.SearchText))
            {
                if (searchModel.SearchField == -1)
                {
                    //pred = CompoundPredicate.GetCompoundPredicate(
                    //        Predicate<string>.GetPredicate("O.LocationName", searchModel.SearchText, Operator.Like),
                    //        Predicate<string>.GetPredicate("O.LocationRefNo", searchModel.SearchText, Operator.Like), LogicalOperator.OR);

                    //list.Add(pred);

                    pred = Predicate <string> .GetPredicate("L.LocationName", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
                else if (searchModel.SearchField == 1)
                {
                    pred = Predicate <string> .GetPredicate("L.LocationName", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
            }

            if (list.Count == 0)
            {
                list.Add(Predicate <string> .GetPredicate("1", "1", Operator.Equal));
            }

            finalPred = CompoundPredicate.GetCompoundPredicate(LogicalOperator.AND, list.ToArray());

            if (model == null)
            {
                model = await PoulateDropDownListAsync(model, cancellationToken);
            }

            model.LocationList = await _dal.SelectAllByFilterAsync(finalPred, cancellationToken, model.GetPageInfo(searchModel.CPage, searchModel.TPage, searchModel.TRows, searchModel.PSize, searchModel.UserId));

            return(model);
        }
Exemplo n.º 6
0
        private async Task <IUserSearchViewModel> SearchDataAsync(ISearchModel searchModel, IUserSearchViewModel model, CancellationToken cancellationToken)
        {
            IPredicate        pred      = null;
            IPredicate        finalPred = null;
            List <IPredicate> list      = new List <IPredicate>();

            if (searchModel.CountryId > 0)
            {
                pred = Predicate <long> .GetPredicate("C.CountryId", searchModel.CountryId, Operator.Equal);

                list.Add(pred);
            }

            if (searchModel.LocationId > 0)
            {
                pred = Predicate <long> .GetPredicate("L.LocationId", searchModel.LocationId, Operator.Equal);

                list.Add(pred);
            }

            if (!string.IsNullOrEmpty(searchModel.SearchText))
            {
                searchModel.SearchText = searchModel.SearchText.Trim();
                if (searchModel.SearchField == -1)
                {
                    pred = CompoundPredicate.GetCompoundPredicate(
                        LogicalOperator.OR,
                        Predicate <string> .GetPredicate("U.FirstName", searchModel.SearchText, Operator.Like),
                        Predicate <string> .GetPredicate("U.EmailId", searchModel.SearchText, Operator.Like),
                        Predicate <string> .GetPredicate("L.LocationName", searchModel.SearchText, Operator.Like),
                        Predicate <string> .GetPredicate("U.PhoneNo", searchModel.SearchText, Operator.Like),
                        Predicate <string> .GetPredicate("U.Address2", searchModel.SearchText, Operator.Like));

                    list.Add(pred);
                }
                else if (searchModel.SearchField == 1)
                {
                    pred = Predicate <string> .GetPredicate("U.FirstName", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
                else if (searchModel.SearchField == 2)
                {
                    pred = Predicate <string> .GetPredicate("U.EmailId", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
                else if (searchModel.SearchField == 3)
                {
                    pred = Predicate <string> .GetPredicate("L.LocationName", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
                else if (searchModel.SearchField == 4)
                {
                    pred = Predicate <string> .GetPredicate("U.PhoneNo", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
                else if (searchModel.SearchField == 5)
                {
                    pred = Predicate <string> .GetPredicate("U.Address2", searchModel.SearchText, Operator.Like);

                    list.Add(pred);
                }
            }

            if (list.Count == 0)
            {
                list.Add(Predicate <string> .GetPredicate("1", "1", Operator.Equal));
            }

            finalPred = CompoundPredicate.GetCompoundPredicate(LogicalOperator.AND, list.ToArray());

            if (model == null)
            {
                model = await PoulateDropDownListAsync(model, cancellationToken);
            }

            model.UserList = await _dal.SelectAllByFilterAsync(finalPred, cancellationToken, model.GetPageInfo(searchModel.CPage, searchModel.TPage, searchModel.TRows, searchModel.PSize, searchModel.UserId));

            return(model);
        }