lg
2024-09-06 3d6533f1381e3e513ffb3d65bf34fb254f967088
DevApp/Gs.DevApp/DevFrm/FrmLogin.cs
@@ -4,6 +4,7 @@
using System.Windows.Forms;
using Gs.DevApp.Models;
using Newtonsoft.Json.Linq;
using System.Data;
namespace Gs.DevApp.DevFrm
{
@@ -16,8 +17,33 @@
            btnLogin.Click += BtnLogin_Click;
            btnCancel.Click += BtnCancel_Click;
            UtilityHelper.SetFont(panel1);
            getTree();
        }
        private void getTree()
        {
            Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "factory", "asc", "", "and upGuid is not null");
            string json = JsonConvert.SerializeObject(pgq);
            string strReturn = "";
            try
            {
                strReturn = UtilityHelper.HttpPost("", "Organization/GetListPage", json);
                ReturnModel<PageListModel> rtn = UtilityHelper.GetTableByJson(strReturn);
                DataTable dt = rtn.rtnData.list;
                DataRow newRow = dt.NewRow();
                newRow["guid"] = "00000000-0000-0000-0000-000000000000";
                newRow["name"] = "-请选择-";
                dt.Rows.Add(newRow);
                comOrg.DataSource = dt;
                comOrg.DisplayMember = "name";
                comOrg.ValueMember = "guid";
                comOrg.SelectedIndex = dt.Rows.Count - 1;
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void BtnCancel_Click(object sender, EventArgs e)
        {
            if (MsgHelper.AskQuestion("确定要退出系统吗?"))
@@ -28,15 +54,12 @@
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            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()
                accountPwd = txtPwd.Text.Trim(),
                accountNo = txtUser.Text.Trim(),
                orgGuid = comOrg.SelectedValue
            };
            sdf.SetCaption("执行进度(" + (i - 80) + "/" + i.ToString() + ")");
            try
            {
                string strJson = UtilityHelper.HttpPost("", "User/UserLogin", JsonConvert.SerializeObject(_obj));
@@ -47,21 +70,21 @@
                    LoginInfoModel.CurrentUser.LoginUserGuid = _login["loginGuid"].ToString();
                    LoginInfoModel.CurrentUser.LoginOrgGuid = _login["loginOrgGuid"].ToString();
                    LoginInfoModel.CurrentUser.LoginTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm");
                    LoginInfoModel.CurrentUser.LoginFactory = _login["loginFactory"].ToString();
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    this.DialogResult = DialogResult.None;
                }
                sdf.SetCaption("执行进度(" + (i - 10) + "/" + i.ToString() + ")");
            }
            catch (Exception ex)
            {
                sdf.Close();
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                return;
            }
            sdf.Close();
            this.DialogResult = DialogResult.OK;
        }
    }
}