Exemplo n.º 1
0
 public static void SetUserActivityTime(string sid, DateTime time)
 {
     WebInitializer.Initialize();
     using (var db = new DBDataContext(SpecificInstances.DbFactory.CreateConnection()))
     {
         db.ADM_P_SetUserActivityTime(sid, time);
     }
 }
Exemplo n.º 2
0
 public static UsersInRoleResult[] GetUsersInRole(string role)
 {
     using (var db = new DBDataContext(SpecificInstances.DbFactory.CreateConnection()))
     {
         using (var data = db.ADM_GetUsersInRole(role))
             return(data.ToArray());
     }
 }
Exemplo n.º 3
0
        private static TResult GetPersonInfoInternal <TResult>(string sid)
        {
            if (string.IsNullOrEmpty(sid))
            {
                return(default(TResult));
            }

            try
            {
                if (InitializerSection.GetSection().IsConvertToSSDL)
                {
                    if (!sid.StartsWith("S-") && !"anonymous".Equals(sid))
                    {
                        var base64   = Convert.FromBase64String(sid);
                        var sidValue = new SecurityIdentifier(base64, 0);
                        sid = sidValue.Value;
                    }
                }
            }
            catch (FormatException)
            {
            }

            var     key = PersonInfoBySid + typeof(TResult).FullName + ">:" + sid;
            TResult value;

            if (HttpContext.Current != null && HttpContext.Current.Cache[key] != null)
            {
                value = (TResult)HttpContext.Current.Cache[key];
            }
            else
            {
                WebInitializer.Initialize();
                using (var db = new DBDataContext(SpecificInstances.DbFactory.CreateConnection()))
                {
                    value = db.GetPersonInfoBySid <TResult>(sid).FirstOrDefault();
                    if (value != null && HttpContext.Current != null)
                    {
                        HttpContext.Current.Cache.Add(
                            key,
                            value,
                            null,
                            DateTime.Now.AddMinutes(2),
                            Cache.NoSlidingExpiration,
                            CacheItemPriority.Normal,
                            null);
                    }
                }
            }

            return(value);
        }
Exemplo n.º 4
0
        public static void AddViewReports(
            string sid,
            string loginName,
            string name,
            string docLocation,
            string siteUrl,
            string hostName,
            bool export,
            string plugin,
            string titleRu,
            string titleKz)
        {
            using (var db = new DBDataContext(SpecificInstances.DbFactory.CreateConnection()))
            {
                if (siteUrl.EndsWith("/") || siteUrl.EndsWith("\\"))
                {
                    siteUrl = siteUrl.Substring(0, siteUrl.Length - 1);
                }

                if (docLocation.StartsWith(siteUrl))
                {
                    docLocation = docLocation.Substring(siteUrl.Length);
                }

                if (docLocation.StartsWith("/") || docLocation.StartsWith("\\"))
                {
                    docLocation = docLocation.Substring(1);
                }

                if (plugin.StartsWith("/") || plugin.StartsWith("\\"))
                {
                    plugin = plugin.Substring(1);
                }

                db.MSD_P_AddViewReports(
                    sid,
                    loginName,
                    name,
                    DateTime.UtcNow,
                    docLocation,
                    siteUrl,
                    hostName,
                    new Guid("{B85A2C1A-E75F-47CD-84DA-CA3295CC7BFB}"),
                    export,
                    plugin,
                    titleRu,
                    titleKz);
            }
        }