| | |
| | | using DevExpress.XtraEditors; |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.ToolBox; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using Gs.DevApp.Models; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace Gs.DevApp.DevFrm |
| | | { |
| | |
| | | public FrmLogin() |
| | | { |
| | | InitializeComponent(); |
| | | this.Text = System.Configuration.ConfigurationSettings.AppSettings.Get("ProductName").ToString(); |
| | | btnLogin.Click += BtnLogin_Click; |
| | | btnCancel.Click += BtnCancel_Click; |
| | | } |
| | | |
| | | private void BtnCancel_Click(object sender, EventArgs e) |
| | | { |
| | | if (Msg.AskQuestion("确定要退出系统吗?")) |
| | | if (MsgHelper.AskQuestion("确定要退出系统吗?")) |
| | | { |
| | | // frmMain1.IsClosing = true; |
| | | Application.Exit(); |
| | | } |
| | | } |
| | | |
| | | private void BtnLogin_Click(object sender, EventArgs e) |
| | | { |
| | | //int i = 199; |
| | | //ShowDialogForm sdf = new ShowDialogForm("提示", "正在登录......", "请耐心等候,正在验证您的身份!", i); |
| | | //for (int j = 1; j < i; j++) |
| | | //{ |
| | | // sdf.SetCaption("执行进度(" + j.ToString() + "/" + i.ToString() + ")"); |
| | | //} |
| | | int i = 100; |
| | | Gs.DevApp.UserControl.ShowDialogForm sdf = new Gs.DevApp.UserControl.ShowDialogForm("提示", "", "请耐心等候,正在验证您的身份!"); |
| | | var _obj = new |
| | | { |
| | | accountPwd = txtUser.Text.Trim(), |
| | | accountNo = txtPwd.Text.Trim(), |
| | | orgGuid = Guid.NewGuid() |
| | | }; |
| | | string json = JsonConvert.SerializeObject(_obj); |
| | | sdf.SetCaption("执行进度(" + (i - 80) + "/" + i.ToString() + ")"); |
| | | try |
| | | { |
| | | Utility.HttpPost("", "User/UserLogin", json); |
| | | |
| | | string strJson = UtilityHelper.HttpPost("", "User/UserLogin", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson); |
| | | JObject _login = _rtn.rtnData; |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | LoginInfoModel.CurrentUser.LoginUserGuid = _login["loginGuid"].ToString(); |
| | | LoginInfoModel.CurrentUser.LoginOrgGuid = _login["loginOrgGuid"].ToString(); |
| | | LoginInfoModel.CurrentUser.LoginTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm"); |
| | | } |
| | | else |
| | | { |
| | | ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg); |
| | | } |
| | | sdf.SetCaption("执行进度(" + (i - 10) + "/" + i.ToString() + ")"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | sdf.Close(); |
| | | ToolBox.MsgHelper.ShowError("提示:" + ex.Message); |
| | | return; |
| | | } |
| | | // sdf.Close(); |
| | | |
| | | sdf.Close(); |
| | | this.DialogResult = DialogResult.OK; |
| | | } |
| | | } |
| | | } |