コード例 #1
0
        /// <summary>
        /// Adds the specified access profile.
        /// </summary>
        /// <param name="accessProfile">The access profile.</param>
        /// <returns></returns>
        public tbl_AccessProfile Add(tbl_AccessProfile accessProfile)
        {
            if (accessProfile.ID == Guid.Empty)
            {
                accessProfile.ID = Guid.NewGuid();
            }

            _dataContext.tbl_AccessProfile.AddObject(accessProfile);
            _dataContext.SaveChanges();

            return(accessProfile);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int?profileActiveContactCount   = null;
            tbl_AccessProfile accessProfile = null;

            if (CurrentUser.Instance.SiteAccessProfileID.HasValue)
            {
                accessProfile             = DataManager.AccessProfile.SelectById((Guid)CurrentUser.Instance.SiteAccessProfileID);
                profileActiveContactCount = accessProfile.ActiveContactsCount;
            }

            if (profileActiveContactCount.HasValue && profileActiveContactCount > 0)
            {
                var percent = (decimal)profileActiveContactCount.Value / 100;
                if (DataManager.StatisticData.ClientBaseStatisticCountInBase.DbValue / percent > 90)
                {
                    lrlMessage.Text = string.Format("<li class\"widget-error\">Использовано {0} из {1} активных контактов. Свяжитесь с <a href=\"{2}\">отделом продаж</a> для увеличения количества активных пользователей!</li>", DataManager.StatisticData.ClientBaseStatisticCountInBase.DbValue.ToString("F0"), profileActiveContactCount.Value, accessProfile.ContactsPageUrl);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Handles the OnClick event of the lbtnRegisterDomainsByActionLog control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void lbtnRegisterDomainsByActionLog_OnClick(object sender, EventArgs e)
        {
            var dataManager = new DataManager();
            var domains     = dataManager.SiteDomain.SelectDomainFromContactActivity(SiteId);

            var site         = dataManager.Sites.SelectById(SiteId);
            int?domainsCount = null;

            if (site.AccessProfileID.HasValue)
            {
                tbl_AccessProfile accessProfile = dataManager.AccessProfile.SelectById(site.AccessProfileID.Value);
                if (accessProfile != null)
                {
                    domainsCount = accessProfile.DomainsCount;
                }
            }


            foreach (var domain in domains)
            {
                if (string.IsNullOrEmpty(domain))
                {
                    continue;
                }

                var siteDomain = new tbl_SiteDomain {
                    Domain = domain, SiteID = SiteId, Aliases = string.Empty
                };
                if (dataManager.SiteDomain.SelectByDomain(siteDomain.Domain).ID == Guid.Empty &&
                    (!domainsCount.HasValue ||
                     dataManager.SiteDomain.SelectDomainsBySiteId(site.ID).Count() < domainsCount))
                {
                    dataManager.SiteDomain.Add(siteDomain);
                }
            }

            gridSiteDomains.Rebind();
        }
コード例 #4
0
 /// <summary>
 /// Updates the specified access profile.
 /// </summary>
 /// <param name="accessProfile">The access profile.</param>
 public void Update(tbl_AccessProfile accessProfile)
 {
     _dataContext.SaveChanges();
 }