北京安通林JIS系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.8 KiB

using System;
using System.Collections.Generic;
using System.Text;
using Stone.Common;
using System.Windows.Forms;
using System.Data;
namespace Stone.User
{
public class UserInfo
{
public static int UserID = 0;
public static string UserName = "";
public static string Password = "";
public static DataTable Authority = null;
public static bool isLogin = false;
/// <summary>
/// 登录系统
/// </summary>
public static DialogResult Login()
{
frmLogin dialog = new frmLogin();
DialogResult dr = dialog.ShowDialog();
dialog.Dispose();
return dr;
}
/// <summary>
/// 操作员管理
/// </summary>
public static void UserManager()
{
frmUserManager dialog = new frmUserManager();
dialog.ShowDialog();
dialog.Dispose();
}
/// <summary>
/// 修改操作员密码
/// </summary>
public static void AlterPassword()
{
frmPassword dialog = new frmPassword();
dialog.ShowDialog();
dialog.Dispose();
}
/// <summary>
/// 判断是否有指定的权限
/// </summary>
/// <param name="authority">权限字串,请在数据库中的“t_UserAuthority”表中添加</param>
/// <returns></returns>
public static bool UserVerify(string authority)
{
bool result = false;
if(Authority.Select("[Code]='" + authority + "'").Length > 0)
{
result = true;
}
return result;
}
/// <summary>
/// 获取SQL连接字符串
/// </summary>
/// <returns></returns>
public static string sqlconnstring()
{
string sql = "uid=" + MyAppconfig.ReadValue("SqlUser")
+ ";pwd=" + MyStrings.DecryptStr(MyAppconfig.ReadValue("SqlPwd"))
+ ";initial catalog=" + MyAppconfig.ReadValue("SqlDataBase")
+ ";data source=" + MyAppconfig.ReadValue("SqlServer")
+ ";TimeOut=" + MyAppconfig.ReadValue("SqlTimeOut");
return sql;
}
/// <summary>
/// 取得最后一次登录的操作员名
/// </summary>
/// <returns></returns>
internal static string GetLastLoginUsername()
{
return MyAppconfig.ReadValue("LastLoginUser");
}
/// <summary>
/// 保存最后一次登录的操作员名
/// </summary>
internal static void PutLastLoginUsername()
{
MyAppconfig.WriteValue("LastLoginUser", UserInfo.UserName);
}
}
}