예제 #1
0
        /// <summary>
        /// 忘记密码
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public UserForgotPwdResponse ForgotPassword(UserForgotPwdRequest request)
        {
            UserForgotPwdResponse response = new UserForgotPwdResponse();

            if (string.IsNullOrEmpty(request.UserName))
            {
                response.Status  = false;
                response.Message = "用户名为空";
                return(response);
            }
            if (string.IsNullOrEmpty(request.Email))
            {
                response.Status  = false;
                response.Message = "邮箱地址为空";
                return(response);
            }

            //判断用户名和邮箱是否存在一条信息里
            int userId = UserDal.Instance.IsExistUserNameEmail(request.UserName, request.Email);

            //存在 发送修改密码地址到邮箱
            //否则 返回失败信息
            if (userId > 0)
            {
                SendToEmail.UpdPwdAddrToEmail(request.UserName, request.Email);
                response.Message = "发送成功,请打开邮箱查看";
            }
            else
            {
                response.Status  = false;
                response.Message = "发送失败,请检查用户名或邮箱地址";
            }

            return(response);
        }
예제 #2
0
        public string getExcuse()
        {
            string hereItIs   = "";
            int    numExcuses = Settings.Default.ExcuseList.Count;
            int    indx       = rand.Next(0, numExcuses);
            bool   allSeen    = checkAllSeenExcuses();

            if (allSeen)
            {
                ExcuseText.Hide();
                RestartExcuses.Show();
                ExcuseNotification.Text = "You've seen all the excuses!";
                ExcuseButton.Hide();
                SendToEmail.Hide();
                CopyButton.Hide();
                BackButton.Hide();
                ForwardButton.Hide();
            }
            else
            {
                if (Settings.Default.ExcuseSeen[indx] == "0")
                {
                    hereItIs = Settings.Default.ExcuseList[indx].ToString();
                }
                else
                {
                    hereItIs = findNextUnseenExcuse();
                }

                Settings.Default.CurrentExcuse    = indx;
                Settings.Default.ExcuseSeen[indx] = "1";
                Settings.Default.Save();
            }
            return(hereItIs);
        }
예제 #3
0
 public static void ForgotPassword(string login, string email, Client client)
 {
     try
     {
         ContentFromAuthorizationServer content = new ContentFromAuthorizationServer("ForgotPassword", "*", login, "*");
         string sms      = content.GetContent(content);
         string callback = clientAuth.Say(sms);
         client.client.Send(callback);
         content = content.SetContent(callback);
         SendToEmail.ForgotPassword(content.Password, email);
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "AuthorizationServerCommand - ForgotPassword");
     }
     Log.Add(login, "ForgotPassword", "AuthorizationServerCommand - ForgotPassword");
 }
예제 #4
0
        private void ButtonStartGame_Click(object sender, RoutedEventArgs e)
        {
            string color1 = ComboBoxColorFirst.SelectedIndex == -1 ? "" : ComboBoxColorFirst.SelectedValue.ToString();
            string color2 = ComboBoxCOlorSecond.SelectedIndex == -1? "" : ComboBoxCOlorSecond.SelectedValue.ToString();

            if (color1 == "" || color2 == "")
            {
                System.Windows.MessageBox.Show("Choose forms for the game", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            int   round = LINQFactory.Round(UserId);
            Match match = Championship.playRound(userId, round);

            //Game
            sp.Stop();
            FootballGameForm f = new FootballGameForm(match.TeamName1, match.TeamName2, LINQFactory.GetNamesById(match.PlayersOne),
                                                      LINQFactory.GetNamesById(match.PlayersTwo), settings.Time, settings.Level, false,
                                                      match.ScorersOne, match.ScorersTwo, color1, color2);

            f.ShowDialog();
            sp = new SoundPlayer(RandomMusic.GetRandomMusic());
            sp.Play();
            match.ScorersOne = f.MyRep.ScoredFirstTeam;
            match.ScorersTwo = f.MyRep.ScoredSecondTeam;
            Championship.SaveMyMatch(match, round, userId);
            ListViewTable.ItemsSource   = Sorting.Sort(LINQFactory.GetTeamsByUser(UserId));
            ListViewResults.ItemsSource = LINQFactory.GetResults(UserId, LINQFactory.Round(UserId) - 1);
            if (round == Repository.Cnt - 1)
            {
                SendToEmail send = new SendToEmail(LINQFactory.GetPointsById(userId));
                send.Show();
                ButtonStartGame.Content   = "Tournament ended!";
                ButtonStartGame.IsEnabled = false;
                LabelTeam1.Content        = "";
                LabelTeam2.Content        = "";
            }
            else
            {
                List <string> Teams = LINQFactory.GetMyMatch(userId, round + 1);
                LabelTeam1.Content = Teams[0];
                LabelTeam2.Content = Teams[1];
            }
        }
예제 #5
0
        private void ExcuseButton_Click(object sender, EventArgs e)
        {
            if (Count > 0)
            {
                BackBox.Items.Insert(0, ExcuseText.Text);
                BackBox.EndUpdate();
            }
            ExcuseNotification.ForeColor = Color.BlanchedAlmond;
            ExcuseNotification.Text      = "Excuse #" + (Settings.Default.CurrentExcuse + 1).ToString() + "/" + TotExcuses;
            CopyButton.Show();
            SendToEmail.Show();
            BackButton.Show();
            ForwardButton.Show();
            string excuse = getExcuse();

            ExcuseText.Text = excuse;
            Count          += 1;
            ForwardBox.Items.Clear();
            ForwardBox.EndUpdate();
        }
예제 #6
0
 private void ResetExcuses_Click(object sender, EventArgs e)
 {
     RestartExcuses.Hide();
     ExcuseText.Show();
     ExcuseButton.Show();
     BackButton.Hide();
     ForwardButton.Hide();
     CopyButton.Hide();
     SendToEmail.Hide();
     ExcuseNotification.Text = "";
     ExcuseText.Text         = "Excuses Ahead...";
     BackBox.Items.Clear();
     ForwardBox.Items.Clear();
     BackBox.EndUpdate();
     ForwardBox.EndUpdate();
     Count = 0;
     Settings.Default.CurrentExcuse = 0;
     for (int i = 0; i < Settings.Default.ExcuseSeen.Count; i++)
     {
         Settings.Default.ExcuseSeen[i] = "0";
         Settings.Default.Save();
     }
     Settings.Default.Save();
 }