コード例 #1
0
ファイル: User.cs プロジェクト: jbob24/KPFF
        public static User GetByUsernamePassword(string userName, string password)
        {
            var parms = new Dictionary<string, string>();
            parms.Add("@UserName", userName);
            parms.Add("@Password", password);
            var con = new SqlConnection(Configuration.ConnectionString);
            var da = new DABase();
            var dr = da.GetDataReaderByStoredProcedure("sp_GetUserByUserNamePassword", parms, con);

            if (dr.HasRows)
            {
                dr.Read();

                return new User()
                {
                    EmployeeId = dr.GetValueOrDefault<int>("EmployeeID"),
                    UserLevel = dr.GetValueOrDefault<string>("UserLevel"),
                    EmployeeFirst = dr.GetValueOrDefault<string>("EmployeeFirst"),
                    EmployeeLast = dr.GetValueOrDefault<string>("EmployeeLast"),
                    HoursPerWeek = dr.GetValueOrDefault<int>("HoursPerWeek"),
                    HasPICFiscalSummaryAccess = dr.GetValueOrDefault<bool>("PICFiscalSummary"),
                    HasPMFiscalSummaryAccess = dr.GetValueOrDefault<bool>("PMFiscalSummary"),
                };
            }

            return null;
        }
コード例 #2
0
 public int DeleteContentByID(int id)
 {
     return(DABase.NewContext().AddStoredProcedure("usp_DeleteContent")
            .AddParameter("Id", id, DbType.Int32)
            .ExecuteNonquery());
 }