UserRoleGroupModel.cs
2.42 KB
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
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vrh.OneReport.Lib.Areas.OneReport.Models
{
/// <summary>
/// Holds the list of a menu items for a user role.
/// </summary>
public class UserRoleGroupModel
{
public enum ItemGroupState
{
Unknown,
Opened,
Closed
}
public string Name { get; set; }
public List<ItemDescriptor> Items { get; set; }
public ItemGroupState GroupState { get; set; }
}
/// <summary>
/// Holds the query and report data needed for a menu item.
/// </summary>
public class ItemDescriptor
{
public string Name { get; set; }
public string Controller { get; set; }
public string Action { get; set; }
public object Params { get; set; }
public string Description { get; set; }
}
/// <summary>
/// Holds the data needed for a database command parameter.
/// </summary>
public class CommandParameter
{
public static int CommandTimeout
{
get
{
string value = System.Web.Configuration.WebConfigurationManager.AppSettings.Get("SQLCommandTimeout");
int timeout;
return (string.IsNullOrEmpty(value) || !int.TryParse(value, out timeout) ? -1 : timeout);
}
}
/// <summary>
/// Name of the parameter.
/// </summary>
public string Name;
/// <summary>
/// Type of the parameter.
/// </summary>
public System.Data.DbType Type;
/// <summary>
/// Value of the parameter.
/// </summary>
public string Value;
public CommandParameter(string Name, System.Data.DbType Type, string Value)
{
this.Name = Name;
this.Type = Type;
this.Value = Value;
}
public static void SetCommandTimeout(System.Data.SqlClient.SqlCommand mySqlCommand)
{
int timeout;
if ((timeout = CommandTimeout) >= 0)
mySqlCommand.CommandTimeout = timeout;
}
public static void SetCommandTimeout(System.Data.Common.DbCommand dbCommand)
{
int timeout;
if ((timeout = CommandTimeout) >= 0)
dbCommand.CommandTimeout = timeout;
}
}
}