/// <summary> /// 登录方法 /// </summary> /// <returns></returns> private bool doLogin() { string LoginName = this.txtLoginName.Text.Trim(); string LoginPwd = this.txtLoginPwd.Text.Trim(); try { DataTable dataTable = Global._AppRight.GetUserInfo(LoginName, LoginPwd); if (dataTable == null || dataTable.Rows.Count < 1) { DxPublic.ShowMessage("用户或密码错误!", this.Text); return(false); } Global._Session._IsRberPwd = CheckRemPwd.Checked; Global._Session._LoginPwd = LoginPwd; Global._Session._LoginName = LoginName; DataRow dataRow = dataTable.Rows[0]; Global._Session._UserId = DxPublic.GetObjGUID(dataRow["Id"]); Global._Session._FullName = DxPublic.GetObjString(dataRow["FullName"]); Global._Session._DepartmentId = DxPublic.GetObjGUID(dataRow["DepartmentId"]); Global._Session._DepartmentName = DxPublic.GetObjString(dataRow["DepartmentName"]); return(true); } catch (Exception ex) { DxPublic.ShowMessage($"用户登录出错:{ex.Message}", this.Text); return(false); } }
public void MdiShow(BaseForm frm, object FuncId, bool ReStart = false) { try { System.Windows.Forms.Form[] mdiChildren = base.MdiChildren; for (int i = 0; i < mdiChildren.Length; i++) { System.Windows.Forms.Form form = mdiChildren[i]; if (!ReStart) { if (form.GetType().Equals(frm.GetType())) { form.Activate(); form.Show(); frm.Dispose(); return; } } else if (form.GetType().Equals(frm.GetType())) { form.Close(); form.Dispose(); } } string objectString = DxPublic.GetObjString(FuncId); if (!string.IsNullOrEmpty(objectString)) { frm.FuncId = Guid.Parse(objectString); } frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; frm.MdiParent = this; frm.KeyPreview = true; frm.Mainform = this; frm.InitFeatureButton(); frm.Show(); } catch (System.Exception ex) { DxPublic.ShowException(ex, this.Text); } }