ホテル管理システム
ogi
yesterday 1a1c8e71fcd14858f595029f089b2d4a00202b32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using HotelPms.Data.Common;
using HotelPms.Share.Util;
using System.Collections.Generic;
 
namespace HotelPms.Data.UseInfo;
 
/// <summary>
/// 画面中制御時データの加工
/// </summary>
public partial class UseDetail
{
    /// <summary>
    /// 利用日を指定し、データを返す
    /// </summary>
    /// <param name="useDate"></param>
    /// <returns></returns>
    public List<UseRoom> GetUseRoomList(string useDate)
    {
        List<UseRoom> list = new();
        if (useDate.Length == 0)
        {
            list.AddRange(UseRoomList);
        }
        else
        {
            list.AddRange(UseRoomList.Where(x => x.UseDate.CompareTo(new customTypes.Date(useDate)) == 0));  //一件しかない
        }
        return list;
    }
 
    /// <summary>
    /// 利用部屋存在するかどうか
    /// </summary>
    /// <param name="useDate"></param>
    /// <returns></returns>
    public bool ExistsUseRoom(string useDate)
    {
        if (useDate.Length == 0)
        {
            return UseRoomList.Count > 0;
        }
        else
        {
            var a = UseRoomList.Any(x => x.UseDate.CompareTo(new customTypes.Date(useDate)) == 0);  //存在
            return a;
        }
    }
 
    /// <summary>
    /// 利用日の追加による利用期間調整
    /// </summary>
    /// <param name="useDate"></param>
    public void SetUseRange(string useDate)
    {
        customTypes.Date date = new(useDate);
        if (date.CompareTo(CinDate) < 0) { CinDate = date; }
        if (date.CompareTo(CoutDate) > 0) { CoutDate = date; }
        Stay = CoutDate.Subtract(CinDate);
    }
}