Esempio n. 1
0
        public GroupDetail GetGroup(GroupCriteria criteria)
        {
            using (var uow = UnitOfWorkFactory.Create <NovelContext>())
            {
                var service = new GroupService(uow);
                var detail  = service.Get(criteria);

                detail.Series = service.View <Connector>()
                                .Where(w => w.IsDeleted == false && w.ConnectorType == R.ConnectorType.SERIES_GROUP && w.TargetID == detail.ID)
                                .Join(service.View <Series>().All(), c => c.SourceID, s => s.ID, (c, s) => s).ToList();

                detail.Releases = service.View <Release>().Where(w => w.GroupID == detail.ID).ToList();

                detail.Feeds = service.View <Connector>()
                               .Where(w => w.ConnectorType == R.ConnectorType.GROUP_FEED && w.SourceID == detail.ID)
                               .Join(service.View <Feed>().All(), c => c.TargetID, f => f.ID, (c, f) => f).ToList();

                detail.Glossaries = service.View <Glossary>().Where(w => w.SourceTable == R.SourceTable.GROUP && w.SourceID == detail.ID).ToList();

                detail.Summarize  = service.View <Summarize>().Where(w => w.SourceTable == R.SourceTable.GROUP && w.SourceID == detail.ID).SingleOrDefault() ?? new Summarize();
                detail.UserAction = new UserActionFacade().Get(new ViewForm {
                    UserID = criteria.ByUserID, SourceID = detail.ID, SourceTable = R.SourceTable.GROUP
                });
                return(detail);
            }
        }
Esempio n. 2
0
        public IList <GroupCriteria> Select(GroupCriteria data)
        {
            IList <GroupCriteria> datos = new List <GroupCriteria>();

            datos = GetHsql(data).List <GroupCriteria>();
            if (!Factory.IsTransactional)
            {
                Factory.Commit();
            }
            return(datos);
        }
Esempio n. 3
0
        public IList <Group> SearchGroup(GroupCriteria criteria)
        {
            using (var uow = UnitOfWorkFactory.Create <NovelContext>())
            {
                var qGroup = uow.Repository <Group>().All();

                if (!string.IsNullOrWhiteSpace(criteria.Query))
                {
                    qGroup = qGroup.Where(w => w.Name.Contains(criteria.Query));
                }
                return(qGroup.ToList());
            }
        }
Esempio n. 4
0
        public ActionResult Detail(GroupCriteria criteria)
        {
            criteria.ByUserID = UserSession.UserID;
            var detail = Facade <GroupFacade>().GetGroup(criteria);

            // log views
            var viewForm = new ViewForm {
                UserID = criteria.ByUserID, SourceID = detail.ID, SourceTable = R.SourceTable.GROUP
            };

            Facade <UserActionFacade>().Viewing(viewForm);

            return(View(detail));
        }
Esempio n. 5
0
        public override IQuery GetHsql(Object data)
        {
            StringBuilder sql           = new StringBuilder("select a from GroupCriteria a    where  ");
            GroupCriteria groupcriteria = (GroupCriteria)data;

            if (groupcriteria != null)
            {
                Parms = new List <Object[]>();
                if (groupcriteria.GroupCriteriaID != 0)
                {
                    sql.Append(" a.GroupCriteriaID = :id     and   ");
                    Parms.Add(new Object[] { "id", groupcriteria.GroupCriteriaID });
                }

                if (groupcriteria.Company != null && groupcriteria.Company.CompanyID != 0)
                {
                    sql.Append(" a.Company.CompanyID = :id1     and   ");
                    Parms.Add(new Object[] { "id1", groupcriteria.Company.CompanyID });
                }

                if (!String.IsNullOrEmpty(groupcriteria.Name))
                {
                    sql.Append(" a.Name like :nom     and   ");
                    Parms.Add(new Object[] { "nom", "%" + groupcriteria.Name + "%" });
                }

                if (!String.IsNullOrEmpty(groupcriteria.Description))
                {
                    sql.Append(" a.Description like :nom1     and   ");
                    Parms.Add(new Object[] { "nom1", "%" + groupcriteria.Description + "%" });
                }


                if (groupcriteria.Rank != 0)
                {
                    sql.Append(" a.Rank = :id2     and   ");
                    Parms.Add(new Object[] { "id2", groupcriteria.Rank });
                }
            }

            sql = new StringBuilder(sql.ToString());
            sql.Append(" 1=1 order by a.GroupCriteriaID asc ");
            IQuery query = Factory.Session.CreateQuery(sql.ToString());

            SetParameters(query);
            return(query);
        }
Esempio n. 6
0
        // GET: Group
        public ActionResult Index(GroupCriteria criteria)
        {
            var searchModel = CreateSearchModel(criteria);
            var pagedList   = Facade <SearchFacade>().Search(searchModel);

            // alternative version
            if (!string.IsNullOrWhiteSpace(criteria.Alt))
            {
                var feedItems = pagedList.Data.Select(s => new FeedGrid
                {
                    InsertedDate = s.InsertedDate,
                    UpdatedDate  = s.UpdatedDate,
                    Title        = s.Name,
                    Url          = Url.Action("Detail", "Group", new { ID = s.ID, Seo = s.Name.ToSeo() }),
                });
                return(FeedGenerator(feedItems, criteria.Alt));
            }

            return(View(pagedList));
        }
Esempio n. 7
0
        public GroupDetail Get(GroupCriteria criteria)
        {
            var qGroup = View <Group>().All();

            if (criteria.IDToInt > 0)
            {
                qGroup = qGroup.Where(w => w.ID == criteria.IDToInt);
            }

            var group = qGroup.SingleOrDefault();

            if (group == null)
            {
                return(null);
            }

            var groupDetail = new GroupDetail();

            MapProperty(group, groupDetail);

            return(groupDetail);
        }
Esempio n. 8
0
 public GroupPredicate(IEnumerable <IPredicate <T> > predicates, GroupCriteria criteria)
 {
     if (predicates == null)
     {
         throw new ArgumentNullException("predicates");
     }
     //
     Func <T, bool>[] parray = predicates.Apply((p, i) =>
     {
         if (p == null)
         {
             throw new ArgumentCollectionElementException("predicates", "Nulpredicate.", i);
         }
     }).Select(p => (Func <T, bool>)p.Match).ToArray();
     //
     if (parray.Length == 0)
     {
         throw new ArgumentException("Empty predicates", "predicates");
     }
     //
     _criteria   = criteria;
     _predicates = parray;
 }
Esempio n. 9
0
 public void DeleteGroupCriteria(GroupCriteria data)
 {
     try {
     SetService();  SerClient.DeleteGroupCriteria(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }
Esempio n. 10
0
 public GroupCriteria SaveGroupCriteria(GroupCriteria data)
 {
     try {
     SetService();  return SerClient.SaveGroupCriteria(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }
Esempio n. 11
0
        public JsonResult Groups(GroupCriteria criteria)
        {
            var groupList = Facade <QueryFacade>().SearchGroup(criteria);

            return(Json(groupList, JsonRequestBehavior.AllowGet));
        }
Esempio n. 12
0
 public GroupCriteria SelectById(GroupCriteria data)
 {
     return((GroupCriteria)base.SelectById(data));
 }
Esempio n. 13
0
 public Boolean Delete(GroupCriteria data)
 {
     return(base.Delete(data));
 }
Esempio n. 14
0
 public Boolean Update(GroupCriteria data)
 {
     return(base.Update(data));
 }
Esempio n. 15
0
 public GroupCriteria Save(GroupCriteria data)
 {
     return((GroupCriteria)base.Save(data));
 }