WINFORM权限系统开发系列教程(五)
2021-03-02 03:28
标签:models read csharp div obj ret 权限 object join 数据访问DAL和实体类 UserInfo.cs RoleInfo.cs UserDAL.cs WINFORM权限系统开发系列教程(五) 标签:models read csharp div obj ret 权限 object join 原文地址:https://www.cnblogs.com/xiewenyu/p/13064061.htmlusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Xwy.WindowsFormsApp.Models
{
public class UserInfoModel
{
public int UserId { get; set; }
public string UserName { get; set; }
public string UserPwd { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Xwy.WindowsFormsApp.Models
{
public class RoleInfoModel
{
public int RoleId { get; set; }
public string RoleName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xwy.WindowsFormsApp.Common;
using Xwy.WindowsFormsApp.DAL.Helpers;
using Xwy.WindowsFormsApp.Models;
namespace Xwy.WindowsFormsApp.DAL
{
public class UserDAL
{
public int Login(UserInfoModel user)
{
string sql = "select UserId from UserInfos where UserName=@UserName and UserPwd=@UserPwd";
SqlParameter[] paras =
{
new SqlParameter("@UserName",user.UserName),
new SqlParameter("@UserPwd",user.UserPwd)
};
object oId = DBHelper.ExecuteScalar(sql,1,paras);
if (oId != null && oId.ToString() != "")
{
return oId.GetInt();
}
else
{
return 0;
}
}
public List
文章标题:WINFORM权限系统开发系列教程(五)
文章链接:http://soscw.com/index.php/essay/58860.html