示例#1
0
 public static UserLight Load(int UserId)
 {
     using (IDataReader r = DBUser.GetUserInfo(UserId))
     {
         return(Load(r));
     }
 }
示例#2
0
        public static string GetAddress(DeliveryType type, int userdId)
        {
            using (IDataReader reader = DBUser.GetUserInfo(userdId))
            {
                if (reader.Read())
                {
                    switch (type)
                    {
                    case DeliveryType.Email:
                        return(Alerts2.BuldEmailAddress(reader["FirstName"].ToString(), reader["LastName"].ToString(), reader["Email"].ToString()));

                    case DeliveryType.IBN:
                        return(reader["OriginalId"].ToString());
                    }
                }
            }

            return(null);
        }
示例#3
0
        //		public static string[] GetExternalSendersByIncidentId(int IncidentId)
        //		{
        //			return EMailMessageRow.GetExternalSendersByIncidentId(IncidentId);
        //		}

        /// <summary>
        /// Logs the on creator.
        /// </summary>
        /// <param name="DefaultCreatorId">The default creator id.</param>
        /// <param name="msg">The MSG.</param>
        /// <returns></returns>
        internal static UserLight LogOnCreator(int DefaultCreatorId, Pop3Message msg)
        {
            if (Security.CurrentUser != null)
            {
                return(Security.CurrentUser);
            }

            int creatorId = DefaultCreatorId;

            int emailUser = DBUser.GetUserByEmail(EMailMessage.GetSenderEmail(msg), false);

            if (emailUser > 0)
            {
                // OZ: 2007-01-26: Fix problem: Mediachase.IBN.Business.AccessDeniedException: Access denied.
                //   at Mediachase.IBN.Business.Incident.CreateFromEmail
                using (IDataReader reader = DBUser.GetUserInfo(emailUser))
                {
                    if (reader.Read())
                    {
                        if (!(bool)reader["IsActive"])
                        {
                            emailUser = -1;
                        }
                    }
                    else
                    {
                        emailUser = -1;
                    }
                }
                //
            }

            if (emailUser > 0)
            {
                creatorId = emailUser;
            }

            UserLight creator = UserLight.Load(creatorId);

            return(Security.SetCurrentUser(creator));
        }
示例#4
0
        protected virtual int GetUserIdByEmail(string from, bool onlyExternalSenders)
        {
            int userId = DBUser.GetUserByEmail(from, onlyExternalSenders);

            // Fix: If we've found inactive user. [8/18/2004]
            using (IDataReader reader = DBUser.GetUserInfo(userId))
            {
                if (reader.Read())
                {
                    if (!(bool)reader["IsActive"])
                    {
                        userId = -1;
                    }
                }
                else
                {
                    userId = -1;
                }
            }
            // End fix [8/18/2004]

            return(userId);
        }