public static void DoShowMainForm(WMSAppInfo aInfo, WMSUserInfo uInfo, bool bIsMDIMode) { frmMain main = new frmMain(); if (bIsMDIMode) { main.IsMdiContainer = bIsMDIMode; main.AInfo = aInfo; main.UserInfo = uInfo; main.ShowDialog(); main.Dispose(); } }
/// <summary> /// 验证 用户与口令是否合法 /// </summary> /// <param name="aX"> 应用程序对象</param> /// <param name="uX">用户对象</param> /// <param name="sPwd">校验密码</param> /// <returns>返回是否成功</returns> public static bool CheckUserPwdIsOk(App.WMSAppInfo aX, App.WMSUserInfo uX, string sPwd) { return(frmMain.CheckUserPwdIsOK(aX, uX, sPwd)); }
public bool GetUserRights(WMSUserInfo uinfo) { StringBuilder builder = new StringBuilder(""); ToolStripMenuItem item = null; this.mmMain.Items.Clear(); if (uinfo != null) { if (uinfo.UType == UserType.utSupervisor) { builder.Append("select * from tpb_rights where cRType <= 2"); } else { builder.Append("select * from tpb_rights where ( cRType <= 2) and cRId in (select cRId from tpb_Urts where cUserId='" + uinfo.UserId + "')"); } builder.Append(" order by nSort,cRId"); DataSet set = null; SeDBClient client = new SeDBClient(DBSocketServerType.dbsstDotNet); DBSQLCommandInfo cmdInfo = new DBSQLCommandInfo { FromSysType = "DotNet", PageIndex = 0, PageSize = 0, SqlText = builder.ToString(), SqlType = SqlCommandType.sctSql, MyEncoding = Encoding.UTF8 }; string sErr = ""; set = client.GetDataSet(this.ainfo.SvrSocket, cmdInfo, false, out sErr); if (sErr.Length > 0) { MessageBox.Show(sErr); } if (set != null) { DataTable tbX = set.Tables["data"]; if ((tbX != null) && (tbX.Rows.Count > 0)) { DataRow[] rowArray = tbX.Select("cPRId='0'"); if ((rowArray != null) && (rowArray.Length > 0)) { foreach (DataRow row in rowArray) { item = null; item = new ToolStripMenuItem { Name = row["cRId"].ToString(), Text = row["cName"].ToString(), Tag = row["cRId"].ToString(), ShowShortcutKeys = false }; int num = 0; if (row["cRType"] != null) { num = int.Parse(row["cRType"].ToString()); } if (num == 1) { item.Click += new EventHandler(this.DoMenuItemClick); item.ToolTipText = item.Text; } this.mmMain.Items.Add(item); this.LoadUserMenuItem(item, tbX); } } } } } ToolStripMenuItem item2 = null; item = new ToolStripMenuItem { Name = "mnHelp", Text = "帮助" }; this.mmMain.Items.Add(item); item2 = new ToolStripMenuItem { Name = "mnHelp_Help", Text = "帮助", ToolTipText = item.Text }; item2.Click += new EventHandler(this.DoHelpClick); item.DropDownItems.Add(item2); item2 = null; item.DropDownItems.Add(this.mi_Help_Abot); //item = null; item = new ToolStripMenuItem { Name = "mnExit", Text = "退出", ToolTipText = item.Text }; item.Click += new EventHandler(this.DoExitClick); this.mmMain.Items.Add(item); return(false); }