| | |
| | | public FrmLogin() |
| | | { |
| | | InitializeComponent(); |
| | | if (ConfigurationManager.AppSettings["IsAutoUpdater"] == "1") |
| | | if (ConfigurationManager.AppSettings["IsAutoUpdater"].ToString() == "1") |
| | | _autoUpdate(); |
| | | else |
| | | getTree(); |
| | | this.Text = lbVersion.Text = System.Configuration.ConfigurationSettings.AppSettings.Get("ProductName").ToString(); |
| | | this.Text = lbVersion.Text = ConfigurationManager.AppSettings["ProductName"].ToString(); |
| | | btnLogin.Click += BtnLogin_Click; |
| | | btnCancel.Click += BtnCancel_Click; |
| | | _getRemember(); |
| | | } |
| | | /// <summary> |
| | | /// 读取组织 |
| | | /// </summary> |
| | | private void getTree() |
| | | { |
| | | PageQueryModel pgq = new PageQueryModel(1, 999999, "factory", "asc", "", "and isStatus=1"); |
| | | PageQueryModel pgq = new PageQueryModel(1, 999999, "factory", "asc", "", " and IS_STATUS=1"); |
| | | string json = JsonConvert.SerializeObject(pgq); |
| | | string strReturn = ""; |
| | | try |
| | | { |
| | | strReturn = UtilityHelper.HttpPost("", "Organization/GetListPage", json); |
| | | string strReturn = UtilityHelper.HttpPost("", "Organization/GetListPage", json); |
| | | ReturnModel<PageListModel> rtn = UtilityHelper.ReturnToTablePage(strReturn); |
| | | DataTable dt = rtn.rtnData.list; |
| | | comOrg.DataSource = dt; |
| | | comOrg.DisplayMember = "name"; |
| | | comOrg.ValueMember = "guid"; |
| | | comOrg.SelectedIndex = 0; |
| | | _getRemember(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// </summary> |
| | | private void _getRemember() |
| | | { |
| | | if (Properties.Settings.Default.remember) |
| | | try |
| | | { |
| | | txtUser.Text = Properties.Settings.Default.userName; |
| | | txtPwd.Text = Properties.Settings.Default.userPwd; |
| | | comOrg.SelectedValue = Properties.Settings.Default.orgGuid; |
| | | ckRemember.Checked = true; |
| | | if (Properties.Settings.Default.remember) |
| | | { |
| | | txtUser.Text = Properties.Settings.Default.userName; |
| | | txtPwd.Text = Properties.Settings.Default.userPwd; |
| | | comOrg.SelectedValue = Properties.Settings.Default.orgGuid; |
| | | ckRemember.Checked = true; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | MessageBox.Show(ex.Message); |
| | | } |
| | | |
| | | } |
| | | private void _autoUpdate() |
| | | { |
| | | string _version = ConfigurationManager.AppSettings["Version"]; |
| | | AutoUpdater.InstalledVersion = new Version(_version); |
| | | AutoUpdater.Start(System.Configuration.ConfigurationSettings.AppSettings.Get("AutoUpdaterXml").ToString()); |
| | | AutoUpdater.Start(ConfigurationManager.AppSettings["AutoUpdaterXml"].ToString()); |
| | | AutoUpdater.CheckForUpdateEvent += AutoUpdater_CheckForUpdateEvent; |
| | | } |
| | | private void AutoUpdater_CheckForUpdateEvent(UpdateInfoEventArgs args) |
| | | { |
| | | |
| | | if (args == null || string.IsNullOrEmpty(args.DownloadURL)) |
| | | { |
| | | MsgHelper.ShowError("读取自动更新失败,无法登录,请联系管理员!"); |
| | |
| | | Application.Exit(); |
| | | return; |
| | | } |
| | | |
| | | if (!args.IsUpdateAvailable) |
| | | { |
| | | getTree(); |