Blame view

Vrh.Web.iScheduler.Lib/StateTrans.cs 3.07 KB
ab9f2fbe   Schwirg László   Add project files.
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Web.Mvc;
  using VRH.Log4Pro.MultiLanguageManager;
  using Vrh.iScheduler;
  
  namespace Vrh.Web.iScheduler
  {
      /// <summary>
      /// Az állapotok fordítását és egyéb használatos
      /// segédeszközöket tartalmazó osztály.
      /// </summary>
      public class StateTrans
      {
          #region Properties
  
          /// <summary>
          /// Aktív állapot nevének fordítása.
          /// </summary>
          public string Active { get; private set; }
  
          /// <summary>
          /// Aktív állapot nevének fordítása.
          /// </summary>
          public string Success { get; private set; }
  
          /// <summary>
          /// Aktív állapot nevének fordítása.
          /// </summary>
          public string Failed { get; private set; }
  
          /// <summary>
          /// A lefordított elemekből összeállított lista a megjelenítéshez.
          /// </summary>
          public List<SelectListItem> SelectList { get; private set; }
  
          /// <summary>
          /// A lefordított elemekből összeállított lista a szűréshez.
          /// </summary>
          public List<SelectListItem> FilterList { get; private set; }
          #endregion Properties
  
          #region Constructor
          /// <summary>
          /// Egy példány előállítása.
          /// </summary>
          /// <param name="lcid">A környezetben érvényes nyelvi kód.</param>
          public StateTrans(string lcid)
          {
              Active = MultiLanguageManager.GetTranslation(typeof(SchedulerWordCodes.iScheduler.Manager.State.Active), lcid);
              Success = MultiLanguageManager.GetTranslation(typeof(SchedulerWordCodes.iScheduler.Manager.State.Success), lcid);
              Failed = MultiLanguageManager.GetTranslation(typeof(SchedulerWordCodes.iScheduler.Manager.State.Failed), lcid);
              this.SelectList = new List<SelectListItem>
              {
                  new SelectListItem { Value = ((int)ScheduleStates.Active).ToString(), Text = this.Active },
                  new SelectListItem { Value = ((int)ScheduleStates.Failed).ToString(), Text = this.Failed },
                  new SelectListItem { Value = ((int)ScheduleStates.Success).ToString(), Text = this.Success },
              };
              this.FilterList = new List<SelectListItem> { new SelectListItem { Value = "", Text = "" } };
              this.FilterList.AddRange(this.SelectList);
          }
          #endregion Constructor
  
          /// <summary>
          /// A lefordított állapotnév visszaadása.
          /// </summary>
          /// <param name="ss"></param>
          /// <returns></returns>
          public string GetName(ScheduleStates ss)
          {
              switch (ss)
              {
                  case ScheduleStates.Active:
                      return this.Active;
                  case ScheduleStates.Success:
                      return this.Success;
                  case ScheduleStates.Failed:
                      return this.Failed;
                  default:
                      return "";
              }
          }
      }
  }