public bool AddToSite(Guid siteID)
        {
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
                carrot_UserSiteMapping map = (from m in _db.carrot_UserSiteMappings
                                              where m.UserId == this.UserId &&
                                              m.SiteID == siteID
                                              select m).FirstOrDefault();

                if (map == null)
                {
                    _siteIDs = null;

                    map = new carrot_UserSiteMapping();
                    map.UserSiteMappingID = Guid.NewGuid();
                    map.SiteID            = siteID;
                    map.UserId            = this.UserId;

                    _db.carrot_UserSiteMappings.InsertOnSubmit(map);
                    _db.SubmitChanges();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#2
0
        public void MapUserToSite(Guid siteID, Guid userID)
        {
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
                carrot_UserSiteMapping map = new carrot_UserSiteMapping();
                map.UserSiteMappingID = Guid.NewGuid();
                map.SiteID            = siteID;
                map.UserId            = userID;

                _db.carrot_UserSiteMappings.InsertOnSubmit(map);
                _db.SubmitChanges();
            }
        }
        public bool RemoveFromSite(Guid siteID)
        {
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
                carrot_UserSiteMapping map = (from m in _db.carrot_UserSiteMappings
                                              where m.UserId == this.UserId &&
                                              m.SiteID == siteID
                                              select m).FirstOrDefault();

                if (map != null)
                {
                    _siteIDs = null;

                    _db.carrot_UserSiteMappings.DeleteOnSubmit(map);
                    _db.SubmitChanges();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#4
0
        public void MapUserToSite(Guid siteID, Guid userID)
        {
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) {

                carrot_UserSiteMapping map = new carrot_UserSiteMapping();
                map.UserSiteMappingID = Guid.NewGuid();
                map.SiteID = siteID;
                map.UserId = userID;

                _db.carrot_UserSiteMappings.InsertOnSubmit(map);
                _db.SubmitChanges();

            }
        }
		public bool AddToSite(Guid siteID) {
			using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
				carrot_UserSiteMapping map = (from m in _db.carrot_UserSiteMappings
											  where m.UserId == this.UserId
												&& m.SiteID == siteID
											  select m).FirstOrDefault();

				if (map == null) {
					_siteIDs = null;

					map = new carrot_UserSiteMapping();
					map.UserSiteMappingID = Guid.NewGuid();
					map.SiteID = siteID;
					map.UserId = this.UserId;

					_db.carrot_UserSiteMappings.InsertOnSubmit(map);
					_db.SubmitChanges();

					return true;
				} else {
					return false;
				}
			}
		}