usertotaldurationreport.cs

来自「V2005+SQL 2005 数据库与网络开发典型系统时间跟增系统」· CS 代码 · 共 66 行

CS
66
字号
using System;
using System.Collections.Generic;
using ASPNET.StarterKit.DataAccessLayer;

namespace ASPNET.StarterKit.BusinessLogicLayer {
  public class UserTotalDurationReport {
    /*** FIELD PRIVATE ***/
    private decimal _TotalDuration;
    private string _UserName;

    /*** CONSTRUCTOR ***/
    public UserTotalDurationReport(decimal totalDuration, string userName) {

      if (totalDuration < DefaultValues.GetDurationMinValue())
        throw (new ArgumentOutOfRangeException("totalDuration"));

      if (String.IsNullOrEmpty(userName))
        throw (new NullReferenceException("userName"));

      _TotalDuration = totalDuration;
      _UserName = userName;
    }

    /*** PROPERTIES ***/
    public decimal TotalDuration {
      get { return _TotalDuration; }
    }

    public string UserName {
      get {
        if (String.IsNullOrEmpty(_UserName))
          return string.Empty;
        else
          return _UserName;
      }
    }

    public static List<UserTotalDurationReport> GetUserReportsByUserName(string userName) {
      if (String.IsNullOrEmpty(userName))
        return (new List<UserTotalDurationReport>());

      DataAccess DALLayer = DataAccessHelper.GetDataAccess();
      return (DALLayer.GetUserReportsByUserName(userName));
    }

    public static List<UserTotalDurationReport> GetUserReportsByUserNames(string userNames) {
      if (String.IsNullOrEmpty(userNames))
        return (new List<UserTotalDurationReport>());

      char[] separator = new char[] { ',' };
      string[] substrings = userNames.Split(separator);
      List<UserTotalDurationReport> list = new List<UserTotalDurationReport>();

      foreach (string str in substrings) {
        if (!string.IsNullOrEmpty(str)) {
          List<UserTotalDurationReport> tempList = UserTotalDurationReport.GetUserReportsByUserName(str);
          foreach (UserTotalDurationReport userReport in tempList) {
            list.Add(userReport);
          }
        }
      }
      return list;
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?