| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using ivf_tl_Entity.Enums;
- using ivf_tl_Manage.Converts;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- namespace ivf_tl_Manage.Win
- {
- /// <summary>
- /// PasswordWindow.xaml 的交互逻辑
- /// </summary>
- public partial class PasswordWindow : Window
- {
- public PasswordWindow()
- {
- InitializeComponent();
- this.Owner = AppData.Instance.MainWindow;
- this.Closed += (a, b) => AppData.Instance.MainWindow.Activate();
- }
- private void Cancel_MouseUp(object sender, MouseButtonEventArgs e)
- {
- this.DialogResult = false;
- return;
- }
- private void Cancel_Click(object sender, RoutedEventArgs e)
- {
- this.DialogResult = false;
- return;
- }
- private void Ok_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- string oldPass = this.PasswordBox_Old.Password;
- string new1 = this.PasswordBox_New1.Password;
- string new2 = this.PasswordBox_New2.Password;
- if (string.IsNullOrEmpty(oldPass))
- {
- //MessageBoxShow("请输入原密码");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0265"));
- return;
- }
- if (string.IsNullOrEmpty(new1))
- {
- //MessageBoxShow("请输入新密码");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0266"));
- return;
- }
- if (string.IsNullOrEmpty(new2))
- {
- //MessageBoxShow("请再次输入新密码");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0267"));
- return;
- }
- if(new1 != new2)
- {
- //MessageBoxShow("两次密码不一致,请重新输入");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0285"));
- return;
- }
- string error = AppData.Instance.HttpServiceCall.UpdatePasswordApi(oldPass, new1, new2);
- if (!string.IsNullOrEmpty(error))
- {
- //MessageBoxShow($"操作失败:{error}");
- MessageBoxShow($"{KeyToStringConvert.GetLanguageStringByKey("0286")}:{error}");
- return;
- }
- this.DialogResult= true;
- return;
- }
- catch (Exception ex)
- {
- ExLog(ex, "Ok_Click");
- //MessageBoxShow($"操作异常:{ex.Message}");
- MessageBoxShow($"{KeyToStringConvert.GetLanguageStringByKey("0291")}:{ex.Message}");
- }
- }
- private void MessageBoxShow(string mess)
- {
- this.message.Text = mess;
- }
- private void ExLog(Exception ex, string name)
- {
- AppData.Instance.LogService.ExceptionLog(ex, $"PasswordWindow.{name}", LogEnum.RunException);
- }
- private void ErrorLog(string message, LogEnum logType)
- {
- AppData.Instance.LogService.TLLog($"PasswordWindow.{message}", logType);
- }
- private void PasswordBox_Old_Click(object sender, RoutedEventArgs e)
- {
- if (!(sender is PasswordBox source)) return;
- source.Password = "";
- }
- }
- }
|