示例#1
0
        public void UpdateCollection(String Name, String Description, bool IsError, int CollectionID)
        {
            ConvertLetter cvLetter = new ConvertLetter();
            String        Alias    = cvLetter.ClearAccent(Name).ToTitleCase().Replace(" ", "_");

            CollectionModel collection = GetCollectionById(CollectionID);

            collection.Name        = Name;
            collection.Alias       = Alias;
            collection.Description = Description;
            collection.IsError     = IsError;

            LinqAdapter.SubmitChanges();
        }
示例#2
0
        public IEnumerable <CollectionModel> SearchCollectionByUsername(String Username)
        {
            UsersModel      userObj       = new UsersModel();
            CollectionModel collectionObj = new CollectionModel();

            IEnumerable <UsersModel>      user       = userObj.GetUserList();
            IEnumerable <CollectionModel> collection = collectionObj.GetCollectionList();

            IEnumerable <CollectionModel> result = from u in user
                                                   join c in collection
                                                   on u.UserID equals c.UserID
                                                   where SqlMethods.Like(u.Username, "%" + Username + "%")
                                                   select c;

            return(result);
        }
示例#3
0
        public int AddCollection(String Name, String Description, int UserID)
        {
            ConvertLetter cvLetter = new ConvertLetter();
            String        Alias    = cvLetter.ClearAccent(Name).ToTitleCase().Replace(" ", "_");

            CollectionModel collectionToInsert = new CollectionModel();

            collectionToInsert.UserID      = UserID;
            collectionToInsert.Name        = Name;
            collectionToInsert.Alias       = Alias;
            collectionToInsert.Description = Description;
            collectionToInsert.TotalView   = 0;
            collectionToInsert.CreatedDate = DateTime.Now;
            collectionToInsert.IsError     = false;

            LinqAdapter.GetTable <CollectionModel>().InsertOnSubmit(collectionToInsert);
            LinqAdapter.SubmitChanges();

            return(collectionToInsert.CollectionID);
        }