Esempio n. 1
1
 private void ClearChatCommand_OnExecute(string sender, string[] Parameters, IUserData data)
 {
     Bot.SayMessage("/clear");
 }
Esempio n. 2
0
        public static ExchangeService ConnectToServiceWithImpersonation(
            IUserData userData,
            string impersonatedUserSMTPAddress,
            ITraceListener listener)
        {
            ExchangeService service = new ExchangeService(userData.Version);

            if (listener != null)
            {
                service.TraceListener = listener;
                service.TraceFlags = TraceFlags.All;
                service.TraceEnabled = true;
            }

            service.Credentials = new NetworkCredential(userData.EmailAddress, userData.Password);

            ImpersonatedUserId impersonatedUserId =
                new ImpersonatedUserId(ConnectingIdType.SmtpAddress, impersonatedUserSMTPAddress);

            service.ImpersonatedUserId = impersonatedUserId;

            if (userData.AutodiscoverUrl == null)
            {
                service.AutodiscoverUrl(userData.EmailAddress, RedirectionUrlValidationCallback);
                userData.AutodiscoverUrl = service.Url;
            }
            else
            {
                service.Url = userData.AutodiscoverUrl;
            }

            return service;
        }
Esempio n. 3
0
 public PostHandler(
     IAuthenticationContext authContext, 
     IUserData userdata)
 {
     this.authContext = authContext;
     this.userData = userdata;
 }
Esempio n. 4
0
        public static ExchangeService ConnectToService(IUserData userData, ITraceListener listener)
        {
            ExchangeService service = new ExchangeService(userData.Version);

            if (listener != null)
            {
                service.TraceListener = listener;
                service.TraceFlags = TraceFlags.All;
                service.TraceEnabled = true;
            }

            service.Credentials = new NetworkCredential(userData.EmailAddress, userData.Password);

            if (userData.AutodiscoverUrl == null)
            {
                Console.Write(string.Format("Using Autodiscover to find EWS URL for {0}. Please wait... ", userData.EmailAddress));

                service.AutodiscoverUrl(userData.EmailAddress, RedirectionUrlValidationCallback);
                userData.AutodiscoverUrl = service.Url;

                Console.WriteLine("Autodiscover Complete");
            }
            else
            {
                service.Url = userData.AutodiscoverUrl;
            }

            return service;
        }
Esempio n. 5
0
        public static ExchangeService ConnectToService(
            IUserData userData,
            ITraceListener listener)
        {
            ExchangeService service = new ExchangeService(userData.Version);

            if (listener != null)
            {
                service.TraceListener = listener;
                service.TraceFlags = TraceFlags.All;
                service.TraceEnabled = true;
            }

            service.Credentials = new NetworkCredential(userData.EmailAddress, userData.Password);

            if (userData.AutodiscoverUrl == null)
            {
                service.AutodiscoverUrl(userData.EmailAddress, RedirectionUrlValidationCallback);
                userData.AutodiscoverUrl = service.Url;
            }
            else
            {
                service.Url = userData.AutodiscoverUrl;
            }

            return service;
        }
Esempio n. 6
0
 public PageService(IPageData pageData, ISettingData settingData, LoggingService log, IUserData userData,
                    IAtomicCmsDataRepository dataContext)
 {
     this.pageData = pageData;
     this.settingData = settingData;
     this.log = log;
     this.userData = userData;
     _dataContext = dataContext;
 }
Esempio n. 7
0
 private void EchoCommand_OnExecute(string sender, string[] Parameters, IUserData data)
 {
     if (Parameters[0].StartsWith("/"))
     {
         if (Parameters.Length == 1)
             Parameters[0] = string.Empty;
         if (Parameters[0].Length > 1)
             Parameters[0] = Parameters[0].Substring(1, Parameters[0].Length - 1);
     }
     Bot.SayMessage(string.Join(" ", Parameters));
 }
Esempio n. 8
0
 public ConnectionParams(
     ExchangeVersion version,
     string autodiscoverUri,
     IUserData data,
     bool traceToFile)
 {
     this.Version = version;
     this.AutodiscoverUrl = autodiscoverUri;
     this.Data = data;
     this.TraceToFile = traceToFile;
 }
        /// <summary>
        /// Sign the user in with Claims.
        /// </summary>
        /// <param name="userData">UserData: the user data.</param>
        /// <param name="tokenLifetimeInMinutes">int: cookie token lifetime.</param>
        public void SignIn(IUserData userData, int tokenLifetimeInMinutes = 60*24)
        {
            // Create the identity & then principal.
            var identity = new ClaimsIdentity(userData.ToClaims(), "Forms");
            var principal = new ClaimsPrincipal(identity);

            // Claims transform.
            principal =
                FederatedAuthentication.FederationConfiguration.IdentityConfiguration.ClaimsAuthenticationManager
                                       .Authenticate(String.Empty, principal);

            // Issue the cookie.
            var sam = FederatedAuthentication.SessionAuthenticationModule;
            if (sam == null)
            {
                throw new Exception("SessionAuthenticationModule is not configured and it needs to be.");
            }

            var token = new SessionSecurityToken(principal, TimeSpan.FromHours(tokenLifetimeInMinutes));
            sam.WriteSessionTokenToCookie(token);
        }
Esempio n. 10
0
 public LoginVM(IUserData _userData) : this()
 {
     userData      = _userData;
     Login_Command = new SyncCommand(Login, EnableButton);
 }
 public UserController(IUserData data)
 {
     _data = data;
 }
 public void Content_GiveFeedback(GiveFeedbackEventArgs e, IUserData userdata)
 {
 }
        public void Content_DragDrop(DragEventArgs e, IUserData userdata)
        {
            if (_fdb == null)
            {
                return;
            }

            bool schemaOnly = false;

            if (userdata != null &&
                userdata.GetUserData("gView.Framework.UI.BaseTools.PasteSchema") != null &&
                userdata.GetUserData("gView.Framework.UI.BaseTools.PasteSchema").Equals(true))
            {
                schemaOnly = true;
            }

            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
            }
            else
            {
                foreach (string format in e.Data.GetFormats())
                {
                    object ob = e.Data.GetData(format);
                    if (ob is IEnumerable <IExplorerObjectSerialization> )
                    {
                        ExplorerObjectManager exObjectManager = new ExplorerObjectManager();

                        List <IExplorerObject> exObjects = new List <IExplorerObject>(exObjectManager.DeserializeExplorerObject((IEnumerable <IExplorerObjectSerialization>)ob));
                        if (exObjects == null)
                        {
                            return;
                        }

                        foreach (IExplorerObject exObject in ListOperations <IExplorerObject> .Clone(exObjects))
                        {
                            IFeatureClass fc = exObject.Object as IFeatureClass;
                            if (fc == null)
                            {
                                continue;
                            }

                            if (fc.Dataset != null && fc.Dataset.DatasetName == _dsname &&
                                _fdb != null &&
                                fc.Dataset.Database is AccessFDB &&
                                ((AccessFDB)fc.Dataset.Database)._conn.ConnectionString.ToLower() ==
                                _fdb._conn.ConnectionString.ToLower())
                            {
                                exObjects.Remove(exObject);
                            }
                        }
                        if (exObjects.Count == 0)
                        {
                            return;
                        }

                        FormFeatureclassCopy dlg = new FormFeatureclassCopy(exObjects, _dataset);
                        dlg.SchemaOnly = schemaOnly;
                        if (dlg.ShowDialog() != DialogResult.OK)
                        {
                            continue;
                        }

                        foreach (FeatureClassListViewItem fcItem in dlg.FeatureClassItems)
                        {
                            ImportDatasetObject(fcItem, schemaOnly);
                        }

                        /*
                         * foreach (IExplorerObject exObject in exObjects)
                         * {
                         *  ImportDatasetObject(exObject.Object);
                         * }
                         * */
                        exObjectManager.Dispose(); // alle ExplorerObjects wieder löschen...
                    }
                }
            }
            //_dataset.RefreshClasses();
            this.Refresh();
        }
Esempio n. 14
0
 protected abstract TUser CreateUser(IUserData externalUser);
 public void Content_DragLeave(EventArgs e, IUserData userdata)
 {
 }
Esempio n. 16
0
 public GetUserClaimByUserIdQuery(IUserData userdata)
 {
     _userdata = userdata;
 }
Esempio n. 17
0
 /// <summary>
 /// Determines whether the specified object is compatible with the specified type.
 /// Unless a very specific behaviour is needed, the correct implementation is a
 /// simple " return type.IsInstanceOfType(obj); "
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="obj">The object.</param>
 /// <returns></returns>
 public bool IsTypeCompatible(Type type, IUserData obj)
 {
     return(Framework.Do.IsInstanceOfType(type, obj));
 }
Esempio n. 18
0
 private void BanCommand_OnExecute(string sender, string[] Parameters, IUserData data)
 {
     Bot.SayMessage("/ban {0}", Parameters[0]);
 }
        public float[] MultiGridQuery(gView.Framework.Carto.IDisplay display, IPoint[] Points, double dx, double dy, ISpatialReference sRef, IUserData userdata)
        {
            if (Points == null || Points.Length != 3)
            {
                return(null);
            }
            PointCollection pColl = new PointCollection();

            pColl.AddPoint(Points[0]);
            pColl.AddPoint(Points[1]);
            pColl.AddPoint(Points[2]);

            double d1x = Points[1].X - Points[0].X, d1y = Points[1].Y - Points[0].Y;
            double d2x = Points[2].X - Points[0].X, d2y = Points[2].Y - Points[0].Y;
            double len1  = Math.Sqrt(d1x * d1x + d1y * d1y);
            double len2  = Math.Sqrt(d2x * d2x + d2y * d2y);
            int    stepX = (int)Math.Round(len1 / dx);
            int    stepY = (int)Math.Round(len2 / dy);

            d1x /= stepX; d1y /= stepX;
            d2x /= stepY; d2y /= stepY;

            List <float> vals = new List <float>();

            vals.Add((float)(stepX + 1));
            vals.Add((float)(stepY + 1));

            List <IRasterLayer> layers = QueryChildLayers(pColl.Envelope, String.Empty);

            try
            {
                for (int y = 0; y <= stepY; y++)
                {
                    for (int x = 0; x <= stepX; x++)
                    {
                        Point p = new Point(Points[0].X + d1x * x + d2x * y,
                                            Points[0].Y + d1y * x + d2y * y);

                        bool found = false;
                        foreach (IRasterLayer layer in layers)
                        {
                            if (layer == null ||
                                !(layer.Class is IRasterClass) ||
                                !(layer.Class is IGridIdentify))
                            {
                                continue;
                            }

                            if (gView.Framework.SpatialAlgorithms.Algorithm.Jordan(((IRasterClass)layer.Class).Polygon, p.X, p.Y))
                            {
                                ((IGridIdentify)layer.Class).InitGridQuery();
                                float val = ((IGridIdentify)layer.Class).GridQuery(display, p, sRef);
                                vals.Add(val);
                                found = true;
                                break;
                            }
                        }
                        if (!found)
                        {
                            vals.Add(float.MinValue);
                        }
                    }
                }
            }
            finally
            {
                foreach (IRasterLayer layer in layers)
                {
                    if (layer.Class is IGridIdentify)
                    {
                        ((IGridIdentify)layer.Class).ReleaseGridQuery();
                    }
                }
            }


            return(vals.ToArray());
        }
Esempio n. 20
0
        static void SetStreamingNotifications(ExchangeService service,IUserData ud)
        {
            // Subscribe to streaming notifications on the Inbox folder, and listen
            // for "NewMail", "Created", and "Deleted" events.
            try
            {
                StreamingSubscription streamingsubscription = service.SubscribeToStreamingNotifications(
                    new FolderId[] { WellKnownFolderName.Inbox },
                    EventType.NewMail,
                    EventType.Created,
                    EventType.Deleted);

                StreamingSubscriptionConnection connection = new StreamingSubscriptionConnection(service, 1);

                connection.AddSubscription(streamingsubscription);
                // Delegate event handlers.
                connection.OnNotificationEvent +=
                    new StreamingSubscriptionConnection.NotificationEventDelegate(OnEvent);
                connection.OnSubscriptionError +=
                    new StreamingSubscriptionConnection.SubscriptionErrorDelegate(OnError);
                connection.OnDisconnect +=
                    new StreamingSubscriptionConnection.SubscriptionErrorDelegate(OnDisconnect);
                connection.Open();

                Log(string.Format("Zasubskrybowano konto: {0}", ud.EmailAddress));

            }
            catch (Exception e)
            {
                Log("Błąd w trakcie próby podłączenia subskrypcji." + e.InnerException.ToString());

            }
        }
Esempio n. 21
0
 public UserService(IUserData userData)
 {
     this.userData = userData;
 }
Esempio n. 22
0
        //private static UserDataFromConsole userData;
        /*public static IUserData GetUserData(ref ExchangeService service)
        {
            if (userData == null)
            {
                GetUserDataFromConsoleCredUi(ref service);
            }

            return userData;
        }*/
        internal static bool GetUserDataFromConsoleCredUi(IWin32Window owner, IUserData data, ref ExchangeService service)
        {
            return CredentialHelper.AppLogin(owner, data, ref service);
        }
 public UsersController(IUserData userData)
 {
     _userData = userData;
 }
Esempio n. 24
0
        /// <summary>
        /// The setup user links.
        /// </summary>
        /// <param name="userData">The user data.</param>
        /// <param name="userName">Name of the user.</param>
        private void SetupUserLinks([NotNull] IUserData userData, string userName)
        {
            // homepage link
            this.Home.Visible = userData.Profile.Homepage.IsSet();
            this.SetupThemeButtonWithLink(this.Home, userData.Profile.Homepage);
            this.Home.ParamTitle0 = userName;

            // blog link
            this.Blog.Visible = userData.Profile.Blog.IsSet();
            this.SetupThemeButtonWithLink(this.Blog, userData.Profile.Blog);
            this.Blog.ParamTitle0 = userName;

            this.Facebook.Visible = this.User != null && userData.Profile.Facebook.IsSet();

            if (userData.Profile.Facebook.IsSet())
            {
                this.Facebook.NavigateUrl = ValidationHelper.IsNumeric(userData.Profile.Facebook)
                                                ? "https://www.facebook.com/profile.php?id={0}".FormatWith(
                    userData.Profile.Facebook)
                                                : userData.Profile.Facebook;
            }

            this.Facebook.ParamTitle0 = userName;

            this.Twitter.Visible     = this.User != null && userData.Profile.Twitter.IsSet();
            this.Twitter.NavigateUrl = "http://twitter.com/{0}".FormatWith(this.HtmlEncode(userData.Profile.Twitter));
            this.Twitter.ParamTitle0 = userName;

            this.Google.Visible     = this.User != null && userData.Profile.Google.IsSet();
            this.Google.NavigateUrl = userData.Profile.Google;
            this.Google.ParamTitle0 = userName;

            if (userData.UserID == this.PageContext.PageUserID)
            {
                return;
            }

            this.PM.Visible = !userData.IsGuest && this.User != null &&
                              this.Get <YafBoardSettings>().AllowPrivateMessages;
            this.PM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.pmessage, "u={0}", userData.UserID);
            this.PM.ParamTitle0 = userName;

            // email link
            this.Email.Visible = !userData.IsGuest && this.User != null &&
                                 this.Get <YafBoardSettings>().AllowEmailSending;
            this.Email.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_email, "u={0}", userData.UserID);
            if (this.PageContext.IsAdmin)
            {
                this.Email.TitleNonLocalized = userData.Membership.Email;
            }

            this.Email.ParamTitle0 = userName;

            this.MSN.Visible     = this.User != null && userData.Profile.MSN.IsSet();
            this.MSN.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_msn, "u={0}", userData.UserID);
            this.MSN.ParamTitle0 = userName;

            this.YIM.Visible     = this.User != null && userData.Profile.YIM.IsSet();
            this.YIM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_yim, "u={0}", userData.UserID);
            this.YIM.ParamTitle0 = userName;

            this.AIM.Visible     = this.User != null && userData.Profile.AIM.IsSet();
            this.AIM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_aim, "u={0}", userData.UserID);
            this.AIM.ParamTitle0 = userName;

            this.ICQ.Visible     = this.User != null && userData.Profile.ICQ.IsSet();
            this.ICQ.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_icq, "u={0}", userData.UserID);
            this.ICQ.ParamTitle0 = userName;

            this.XMPP.Visible     = this.User != null && userData.Profile.XMPP.IsSet();
            this.XMPP.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_xmpp, "u={0}", userData.UserID);
            this.XMPP.ParamTitle0 = userName;

            this.Skype.Visible     = this.User != null && userData.Profile.Skype.IsSet();
            this.Skype.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_skype, "u={0}", userData.UserID);
            this.Skype.ParamTitle0 = userName;
        }
Esempio n. 25
0
 public RazaService(IUserData dataUser, IRazaData magiaData)
 {
     _dataUser = dataUser;
     _dataRaza = magiaData;
 }
Esempio n. 26
0
        /// <summary>
        /// The setup user profile info.
        /// </summary>
        /// <param name="userID">The user id.</param>
        /// <param name="user">The user.</param>
        /// <param name="userData">The user data.</param>
        /// <param name="userDisplayName">The user display name.</param>
        private void SetupUserProfileInfo(
            int userID,
            [NotNull] MembershipUser user,
            [NotNull] IUserData userData,
            [NotNull] string userDisplayName)
        {
            this.UserLabel1.UserID = userData.UserID;

            if (this.PageContext.IsAdmin && userData.DisplayName != user.UserName)
            {
                this.Name.Text = this.HtmlEncode("{0} ({1})".FormatWith(userData.DisplayName, user.UserName));
            }
            else
            {
                this.Name.Text = this.HtmlEncode(userDisplayName);
            }

            this.Joined.Text =
                "{0}".FormatWith(this.Get <IDateTime>().FormatDateLong(Convert.ToDateTime(userData.Joined)));

            // vzrus: Show last visit only to admins if user is hidden
            if (!this.PageContext.IsAdmin && Convert.ToBoolean(userData.DBRow["IsActiveExcluded"]))
            {
                this.LastVisit.Text    = this.GetText("COMMON", "HIDDEN");
                this.LastVisit.Visible = true;
            }
            else
            {
                this.LastVisitDateTime.DateTime = userData.LastVisit;
                this.LastVisitDateTime.Visible  = true;
            }

            if (this.User != null && userData.RankName.IsSet())
            {
                this.RankTR.Visible = true;
                this.Rank.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.RankName));
            }

            if (this.User != null && userData.Profile.Location.IsSet())
            {
                this.LocationTR.Visible = true;
                this.Location.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Location));
            }

            if (this.User != null && userData.Profile.Country.Trim().IsSet() && !userData.Profile.Country.Equals("N/A"))
            {
                this.CountryTR.Visible = true;
                this.CountryLabel.Text =
                    this.HtmlEncode(
                        this.Get <IBadWordReplace>().Replace(this.GetText("COUNTRY", userData.Profile.Country.Trim())));

                this.CountryFlagImage.Src = this.Get <ITheme>()
                                            .GetItem(
                    "FLAGS",
                    "{0}_MEDIUM".FormatWith(userData.Profile.Country.Trim()),
                    YafForumInfo.GetURLToContent("images/flags/{0}.png".FormatWith(userData.Profile.Country.Trim())));

                this.CountryFlagImage.Alt = userData.Profile.Country.Trim();
                this.CountryFlagImage.Attributes.Add("title", this.CountryLabel.Text);
            }

            if (this.User != null && userData.Profile.Region.IsSet())
            {
                this.RegionTR.Visible = true;

                try
                {
                    var tag =
                        "RGN_{0}_{1}".FormatWith(
                            userData.Profile.Country.Trim().IsSet()
                                ? userData.Profile.Country.Trim()
                                : this.Get <ILocalization>().Culture.Name.Remove(0, 3).ToUpperInvariant(),
                            userData.Profile.Region);
                    this.RegionLabel.Text =
                        this.HtmlEncode(this.Get <IBadWordReplace>().Replace(this.GetText("REGION", tag)));
                }
                catch (Exception)
                {
                    this.RegionTR.Visible = false;
                }
            }

            if (this.User != null && userData.Profile.City.IsSet())
            {
                this.CityTR.Visible = true;
                this.CityLabel.Text = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.City));
            }

            if (this.User != null && userData.Profile.Location.IsSet())
            {
                this.LocationTR.Visible = true;
                this.Location.Text      = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Location));
            }

            if (this.User != null && userData.Profile.RealName.IsSet())
            {
                this.RealNameTR.Visible = true;
                this.RealName.InnerText = this.HtmlEncode(
                    this.Get <IBadWordReplace>().Replace(userData.Profile.RealName));
            }

            if (this.User != null && userData.Profile.Interests.IsSet())
            {
                this.InterestsTR.Visible = true;
                this.Interests.InnerText =
                    this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Interests));
            }

            if (this.User != null && (userData.Profile.Gender > 0))
            {
                string imagePath = string.Empty;
                string imageAlt  = string.Empty;

                this.GenderTR.Visible = true;
                switch (userData.Profile.Gender)
                {
                case 1:
                    imagePath = this.PageContext.Get <ITheme>().GetItem("ICONS", "GENDER_MALE", null);
                    imageAlt  = this.GetText("USERGENDER_MAS");
                    break;

                case 2:
                    imagePath = this.PageContext.Get <ITheme>().GetItem("ICONS", "GENDER_FEMALE", null);
                    imageAlt  = this.GetText("USERGENDER_FEM");
                    break;
                }

                this.Gender.InnerHtml =
                    @"<a><img src=""{0}"" alt=""{1}"" title=""{1}"" /></a>&nbsp;{1}".FormatWith(imagePath, imageAlt);
            }

            if (this.User != null && userData.Profile.Occupation.IsSet())
            {
                this.OccupationTR.Visible = true;
                this.Occupation.InnerText =
                    this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Occupation));
            }

            this.ThanksFrom.Text =
                LegacyDb.user_getthanks_from(userData.DBRow["userID"], this.PageContext.PageUserID).ToString();
            int[] thanksToArray = LegacyDb.user_getthanks_to(userData.DBRow["userID"], this.PageContext.PageUserID);
            this.ThanksToTimes.Text      = thanksToArray[0].ToString();
            this.ThanksToPosts.Text      = thanksToArray[1].ToString();
            this.ReputationReceived.Text = YafReputation.GenerateReputationBar(userData.Points.Value, userData.UserID);

            if (this.Get <YafBoardSettings>().ShowUserOnlineStatus)
            {
                this.OnlineStatusImage1.UserID  = userID;
                this.OnlineStatusImage1.Visible = true;

                var suspended = userData.DBRow["Suspended"].ToType <DateTime?>();

                if (suspended.HasValue && suspended.Value > DateTime.UtcNow)
                {
                    this.ThemeImgSuspended.LocalizedTitle =
                        this.GetText("POSTS", "USERSUSPENDED")
                        .FormatWith(this.Get <IDateTime>().FormatDateTimeShort(suspended.Value));

                    this.ThemeImgSuspended.Visible  = true;
                    this.OnlineStatusImage1.Visible = false;
                }
                else
                {
                    this.ThemeImgSuspended.Visible = false;
                }
            }
            else
            {
                this.ThemeImgSuspended.Visible  = false;
                this.OnlineStatusImage1.Visible = false;
            }


            if (this.User != null && userData.Profile.XMPP.IsSet())
            {
                this.XmppTR.Visible = true;
                this.lblxmpp.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.XMPP));
            }

            if (this.User != null && userData.Profile.AIM.IsSet())
            {
                this.AimTR.Visible = true;
                this.lblaim.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.AIM));
            }

            if (this.User != null && userData.Profile.ICQ.IsSet())
            {
                this.IcqTR.Visible = true;
                this.lblicq.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.ICQ));
            }

            if (this.User != null && userData.Profile.MSN.IsSet())
            {
                this.MsnTR.Visible = true;
                this.lblmsn.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.MSN));
            }

            if (this.User != null && userData.Profile.Skype.IsSet())
            {
                this.SkypeTR.Visible = true;
                this.lblskype.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Skype));
            }

            if (this.User != null && userData.Profile.YIM.IsSet())
            {
                this.YimTR.Visible = true;
                this.lblyim.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.YIM));
            }

            var loadHoverCardJs = false;

            if (this.User != null && userData.Profile.Facebook.IsSet())
            {
                this.FacebookTR.Visible = true;
                this.lblfacebook.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Facebook));

                if (this.Get <YafBoardSettings>().EnableUserInfoHoverCards)
                {
                    this.lblfacebook.Attributes.Add("data-hovercard", this.lblfacebook.Text);
                    this.Facebook.Attributes.Add("data-hovercard", this.lblfacebook.Text);

                    this.lblfacebook.CssClass += " Facebook-HoverCard";
                    this.Facebook.CssClass    += " Facebook-HoverCard";

                    loadHoverCardJs = true;
                }
            }

            if (this.User != null && userData.Profile.Twitter.IsSet())
            {
                this.TwitterTR.Visible = true;
                this.lbltwitter.Text   = this.HtmlEncode(this.Get <IBadWordReplace>().Replace(userData.Profile.Twitter));

                if (this.Get <YafBoardSettings>().EnableUserInfoHoverCards&& Config.IsTwitterEnabled)
                {
                    this.lbltwitter.Attributes.Add("data-hovercard", this.lbltwitter.Text);
                    this.Twitter.Attributes.Add("data-hovercard", this.lbltwitter.Text);

                    this.lbltwitter.CssClass += " Twitter-HoverCard";
                    this.Twitter.CssClass    += " Twitter-HoverCard";

                    loadHoverCardJs = true;
                }
            }

            if (loadHoverCardJs && this.Get <YafBoardSettings>().EnableUserInfoHoverCards&& Config.IsTwitterEnabled)
            {
                var hoverCardLoadJs = new StringBuilder();

                hoverCardLoadJs.Append(
                    JavaScriptBlocks.HoverCardLoadJs(
                        ".Facebook-HoverCard",
                        "Facebook",
                        this.GetText("DEFAULT", "LOADING_FB_HOVERCARD").ToJsString(),
                        this.GetText("DEFAULT", "ERROR_FB_HOVERCARD").ToJsString()));

                hoverCardLoadJs.Append(
                    JavaScriptBlocks.HoverCardLoadJs(
                        ".Twitter-HoverCard",
                        "Twitter",
                        this.GetText("DEFAULT", "LOADING_TWIT_HOVERCARD").ToJsString(),
                        this.GetText("DEFAULT", "ERROR_TWIT_HOVERCARD").ToJsString(),
                        "{0}{1}resource.ashx?twitterinfo=".FormatWith(
                            BaseUrlBuilder.BaseUrl.TrimEnd('/'),
                            BaseUrlBuilder.AppPath)));

                // Setup Hover Card JS
                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "hovercardtwitterfacebookjs",
                    hoverCardLoadJs.ToString());

                if (this.Get <YafBoardSettings>().EnableUserReputation)
                {
                    // Setup UserBox Reputation Script Block
                    YafContext.Current.PageElements.RegisterJsBlockStartup(
                        "reputationprogressjs",
                        JavaScriptBlocks.RepuatationProgressLoadJs);
                }
            }

            if (this.User != null && userData.Profile.Birthday >= DateTimeHelper.SqlDbMinTime())
            {
                this.BirthdayTR.Visible = true;
                this.Birthday.Text      =
                    this.Get <IDateTime>()
                    .FormatDateLong(userData.Profile.Birthday.AddMinutes((double)(-userData.TimeZone)));
            }
            else
            {
                this.BirthdayTR.Visible = false;
            }

            // Show User Medals
            if (this.Get <YafBoardSettings>().ShowMedals)
            {
                var userMedalsTable = this.Get <YafDbBroker>().UserMedals(this.UserId);

                if (userMedalsTable.Rows.Count <= 0)
                {
                    this.MedalsRow.Visible = false;

                    return;
                }

                var ribbonBar = new StringBuilder(500);
                var medals    = new StringBuilder(500);

                DataRow    r;
                MedalFlags f;

                int i     = 0;
                int inRow = 0;

                // do ribbon bar first
                while (userMedalsTable.Rows.Count > i)
                {
                    r = userMedalsTable.Rows[i];
                    f = new MedalFlags(r["Flags"]);

                    // do only ribbon bar items first
                    if (!r["OnlyRibbon"].ToType <bool>())
                    {
                        break;
                    }

                    // skip hidden medals
                    if (!f.AllowHiding || !r["Hide"].ToType <bool>())
                    {
                        if (inRow == 3)
                        {
                            // add break - only three ribbons in a row
                            ribbonBar.Append("<br />");
                            inRow = 0;
                        }

                        var title = "{0}{1}".FormatWith(
                            r["Name"],
                            f.ShowMessage ? ": {0}".FormatWith(r["Message"]) : string.Empty);

                        ribbonBar.AppendFormat(
                            "<img src=\"{0}{5}/{1}\" width=\"{2}\" height=\"{3}\" alt=\"{4}\" title=\"{4}\" />",
                            YafForumInfo.ForumClientFileRoot,
                            r["SmallRibbonURL"],
                            r["SmallRibbonWidth"],
                            r["SmallRibbonHeight"],
                            title,
                            YafBoardFolders.Current.Medals);

                        inRow++;
                    }

                    // move to next row
                    i++;
                }

                // follow with the rest
                while (userMedalsTable.Rows.Count > i)
                {
                    r = userMedalsTable.Rows[i];
                    f = new MedalFlags(r["Flags"]);

                    // skip hidden medals
                    if (!f.AllowHiding || !r["Hide"].ToType <bool>())
                    {
                        medals.AppendFormat(
                            "<img src=\"{0}{6}/{1}\" width=\"{2}\" height=\"{3}\" alt=\"{4}{5}\" title=\"{4}{5}\" />",
                            YafForumInfo.ForumClientFileRoot,
                            r["SmallMedalURL"],
                            r["SmallMedalWidth"],
                            r["SmallMedalHeight"],
                            r["Name"],
                            f.ShowMessage ? ": {0}".FormatWith(r["Message"]) : string.Empty,
                            YafBoardFolders.Current.Medals);
                    }

                    // move to next row
                    i++;
                }

                this.MedalsPlaceHolder.Text = "{0}<br />{1}".FormatWith(ribbonBar, medals);
                this.MedalsRow.Visible      = true;
            }
        }
Esempio n. 27
0
 private void SayCommand_OnExecute(string sender, string[] Parameters, IUserData data)
 {
     Bot.SayMessage("{0}", data.GetValue<object>("Text", ""));
 }
Esempio n. 28
0
 public ListModel(IUserData data)
 {
     _data = data;
 }
        public void Content_DragEnter(DragEventArgs e, IUserData userdata)
        {
            if (_fdb == null)
            {
                return;
            }

            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                foreach (string file in (string[])e.Data.GetData(DataFormats.FileDrop))
                {
                    if (file.ToLower().EndsWith(".shp"))
                    {
                        e.Effect = DragDropEffects.Copy;
                        return;
                    }
                }
            }
            else
            {
                foreach (string format in e.Data.GetFormats())
                {
                    object ob = e.Data.GetData(format);

                    if (ob is List <IExplorerObjectSerialization> )
                    {
                        //List<IExplorerObject> exObjects = ComponentManager.DeserializeExplorerObject((List<IExplorerObjectSerialization>)ob);
                        foreach (IExplorerObjectSerialization ser in (List <IExplorerObjectSerialization>)ob)
                        {
                            if (ser.ObjectTypes.Contains(typeof(IFeatureDataset)) ||
                                ser.ObjectTypes.Contains(typeof(IFeatureClass)))
                            {
                                e.Effect = DragDropEffects.Copy;
                                return;
                            }
                        }
                    }

                    /*
                     * if (ob is IExplorerObject)
                     * {
                     *  IExplorerObject exObject = (IExplorerObject)ob;
                     *
                     *  if (exObject.Object is IFeatureDataset || exObject.Object is IFeatureClass)
                     *  {
                     *      e.Effect = DragDropEffects.Copy;
                     *      return;
                     *  }
                     * }
                     * if (ob is List<IExplorerObject>)
                     * {
                     *  foreach (IExplorerObject exObject in (List<IExplorerObject>)ob)
                     *  {
                     *      if (exObject.Object is IFeatureDataset || exObject.Object is IFeatureClass)
                     *      {
                     *          e.Effect = DragDropEffects.Copy;
                     *          return;
                     *      }
                     *  }
                     * }
                     * */
                }
            }
        }
Esempio n. 30
0
 public PageService(IPageData pageData, ISettingData settingData, LoggingService log, IUserData userData,
                    IAtomicCmsDataRepository dataContext)
 {
     this.pageData    = pageData;
     this.settingData = settingData;
     this.log         = log;
     this.userData    = userData;
     _dataContext     = dataContext;
 }
 public void Content_DragOver(DragEventArgs e, IUserData userdata)
 {
 }
 public EditModel(IUserData data)
 {
     _data = data;
 }
 public void Content_QueryContinueDrag(QueryContinueDragEventArgs e, IUserData userdata)
 {
 }
Esempio n. 34
0
 public static ExchangeService ConnectToService(IUserData userData)
 {
     return(ConnectToService(userData, null));
 }
Esempio n. 35
0
 public WaitingRoomViewModel(IEventAggregator events, ISocketHandler socketHandler, IUserData userdata)
 {
     _events = events;
     _events.Subscribe(this);
     _socketHandler         = socketHandler;
     _userData              = userdata;
     userdata.messages      = new BindableCollection <Models.Message>(userdata.currentGameRoom.messages);
     userdata.currentRoomId = userdata.matchId;
     _events.PublishOnUIThread(new refreshMessagesEvent(userdata.messages, userdata.currentRoomId));
     this._messages = userdata.messages;
     this.players   = new BindableCollection <Player>();
     this._socketHandler.offLobby();
     this._socketHandler.offCreateMatch();
     this._socketHandler.onWaitingRoom(this.players);
     this._socketHandler.socket.Emit("get_players", this._userData.matchId);
 }
Esempio n. 36
0
 public void Execute(string sender, string[] Parameters, IUserData userData)
 {
     OnExecute(sender, Parameters, userData);
 }
 public CheckIfPrintIsZero(IUserData userData)
 {
     _userData = userData;
 }
Esempio n. 38
0
        // References:
        // http://msdn.microsoft.com/en-us/library/aa480470.aspx
        /// <summary>
        /// Accepts a user credentials if they haven't been saved or if they have changed, adds them to the credential cache, and makes
        /// a call to EWS to verify that the credentials work. If the credentials work, then a confirmation is sent to the credential
        /// manager and the credentials are provided back to the application to be used to make EWS calls.
        /// </summary>
        internal static bool AppLogin(IWin32Window owner, IUserData data, ref ExchangeService service)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(data.UserName) ||
                    string.IsNullOrWhiteSpace(data.Password))
                {
                    // Create the credential prompt that will handle the user credentials.
                    //CredPrompt prompt = new CredPrompt(@"Exchange Web Services (EWS)");
                    CredentialsDialog dlg = new CredentialsDialog(
                        @"Exchange Web Services (EWS)", "EWS credentials", "Enter your credentials");

                    // Show the prompt. This will either prompt for the user credentials or, if they
                    // already exist on the system, it will load credentials from the cache in the CredDialog object.
                    //DialogResult result = prompt.ShowPrompt();
                    DialogResult result = dlg.Show(owner, true);

                    if (result == DialogResult.OK)
                    {
                        // Authenticate the credentials and if they work, confirm the credentials and provide the
                        // ExchangeService object back to the application.
                        string[] parts = dlg.Name.Split('\\');
                        switch (parts.Length)
                        {
                            case 1:
                                data.UserName = parts[0];
                                break;
                            default:
                                data.Domain = parts[0];
                                data.UserName = parts[1];
                                break;
                        }
                        data.Password = dlg.Password;

                        if (Authenticate(data, ref service))
                        {
                            // The credentials were authenticated. Confirm that we want the
                            // credential manager to save our credentials.
                            if (dlg.SaveChecked)
                                dlg.Confirm(true);
                            return true;
                        }
                        // The credentials were not authenticated.
                        try
                        {
                            dlg.Confirm(false);
                            return false;
                        }
                        catch (ApplicationException)
                        {
                            // Prompt user for credentials again. We may need to provide a way to break
                            while (true)
                            {
                                DialogResult res = MessageBox.Show(
                                    LocalizibleStrings.RetryConnection,
                                    Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                                return res == DialogResult.Yes && AppLogin(owner, data, ref service);
                            }
                        }
                    }

                    if (result != DialogResult.Cancel)
                    {
                        throw new ApplicationException(LocalizibleStrings.UnhandledCondition + result);
                    }
                }
                else
                {
                    return Authenticate(data, ref service);
                }
            }
            // This will capture errors stemming from CredUICmdLinePromptForCredentials.
            catch (ApplicationException exc)
            {
                Logger.Error(@"AppLogin", exc);
            }

            return false;
        }
 public ProjectData(IUserData userData, IMapper mapper)
 {
     _userData = userData;
     _mapper   = mapper;
 }
Esempio n. 40
0
        /// <summary>
        /// Authenticates using the credentials provided to the credential manager. It also 
        /// populates the ExchangeService object used by the application.
        /// </summary>
        /// <param name="data">users data : name, password, email, domain</param>
        /// <param name="service">The ExchangeService object for this application.</param>
        /// <returns>A value of true indicates that the client successfully authenticated with EWS.</returns>
        private static bool Authenticate(IUserData data, ref ExchangeService service)
        {
            bool authenticated = false;
            try
            {
                service.Credentials = new WebCredentials(data.UserName, data.Password, data.Domain);

                // Check if we have the service URL.
                if (service.Url == null
                    || string.IsNullOrWhiteSpace(service.Url.OriginalString))
                {
                    Logger.Message(
                        LocalizibleStrings.StartAutodiscover, data.EmailAddress);
                    service.AutodiscoverUrl(
                        data.EmailAddress, Service.RedirectionUrlValidationCallback);
                    Logger.Message(LocalizibleStrings.AutodiscoverComplete);
                }

                // Once we have the URL, try a ConvertId operation to check if we can access the service. We expect that
                // the user will be authenticated and that we will get an error code due to the invalid format. Expect a
                // ServiceResponseException.
                Logger.Message(LocalizibleStrings.AttemptingConnectEws);
                service.ConvertId(new AlternateId(IdFormat.EwsId, @"Placeholder", data.UserName), IdFormat.EwsId);
            }
            // The user principal name is in a bad format.
            catch (FormatException fe)
            {
                Logger.Error(LocalizibleStrings.AuthInvalidUpn, fe);
            }
            catch (AutodiscoverLocalException ale)
            {
                Logger.Error(LocalizibleStrings.Auth, ale);
            }
            // The credentials were authenticated. We expect this exception since we are providing intentional bad data for ConvertId
            catch (ServiceResponseException)
            {
                Logger.Message(LocalizibleStrings.SuccConnection);
                authenticated = true;
            }
            // The credentials were not authenticated.
            catch (ServiceRequestException exc)
            {
                Logger.Error(LocalizibleStrings.CredNotAuth, exc);
            }
            return authenticated;
        }
Esempio n. 41
0
 public SearchController(ILogger <HomeController> logger, FacebookDataContext _facebookDataContext, IUserData _userData)
 {
     userData            = _userData;
     _logger             = logger;
     facebookDataContext = _facebookDataContext;
 }
 public EditUserModel(IUserData userData, IPasswordHasher passwordHasher)
 {
     _userData       = userData;
     _passwordHasher = passwordHasher;
 }
 public AboutController(IUserData userData, ICourseData courseData)
 {
     _userData   = userData;
     _courseData = courseData;
 }
 public UserController(IUserData userData, ICartData cartData)
 {
     _userData = userData;
     _cartData = cartData;
 }
Esempio n. 45
0
 public static ExchangeService ConnectToServiceWithImpersonation(
     IUserData userData,
     string impersonatedUserSMTPAddress)
 {
     return(ConnectToServiceWithImpersonation(userData, impersonatedUserSMTPAddress, null));
 }
Esempio n. 46
0
 private void TimeoutCommand_OnExecute(string sender, string[] Parameters, IUserData data)
 {
     if(Parameters.Length < 3)
         Bot.SayMessage("/timeout {0}", string.Join(" ", (Parameters)));
 }
Esempio n. 47
0
 public static ExchangeService ConnectToService(IUserData userData)
 {
     return ConnectToService(userData, null);
 }
Esempio n. 48
0
 protected override BlogUser CreateUser(IUserData externalUser)
 {
     return(new BlogUser(externalUser));
 }
Esempio n. 49
0
 public static ExchangeService ConnectToServiceWithImpersonation(
   IUserData userData,
   string impersonatedUserSMTPAddress)
 {
     return ConnectToServiceWithImpersonation(userData, impersonatedUserSMTPAddress, null);
 }
 public LoginController(IUserData userData)
 {
     _userData = userData;
 }