static Dictionary<string, int> roles = new Dictionary<string, int>();
public static Dictionary<string, int> SetRoles(List<string> items)
{
if (roles != null)
{
roles.Clear();
}
foreach (string item in items)
{
// var Entitytype = item.Split('_')[1];
var country = item.Split('_')[2];
string Session_osoid = db.View_SharePointMappingTable.Where(x => x.GroupName == item).FirstOrDefault().OsoID.ToString();
var Session_Priority = db.View_SharePointMappingTable.Where(x => x.GroupName == item).FirstOrDefault().Priority;
var role = item.Split('_')[3];
if (!roles.Keys.Contains(Session_osoid) || Session_Priority > roles[Session_osoid])
roles[Session_osoid] =Convert.ToInt32(Session_Priority);
}
return roles;
}
Calling Dictionary
Dictionary<string, int> roles;
List<string> items = null;
keyList = null;
priorityList = null;
items = Session["AuthenticateOso"].ToString().Split(',').ToList();
if (roles!=null)
{
roles.Clear();
}
roles = Appcommon.SetRoles(items);
var OsoidList = roles.Keys;
var Priority = roles.Values.ToArray();
keyList = roles.Keys.ToArray();
priorityList = Priority;
public static Dictionary<string, int> SetRoles(List<string> items)
{
if (roles != null)
{
roles.Clear();
}
foreach (string item in items)
{
// var Entitytype = item.Split('_')[1];
var country = item.Split('_')[2];
string Session_osoid = db.View_SharePointMappingTable.Where(x => x.GroupName == item).FirstOrDefault().OsoID.ToString();
var Session_Priority = db.View_SharePointMappingTable.Where(x => x.GroupName == item).FirstOrDefault().Priority;
var role = item.Split('_')[3];
if (!roles.Keys.Contains(Session_osoid) || Session_Priority > roles[Session_osoid])
roles[Session_osoid] =Convert.ToInt32(Session_Priority);
}
return roles;
}
Calling Dictionary
Dictionary<string, int> roles;
List<string> items = null;
keyList = null;
priorityList = null;
items = Session["AuthenticateOso"].ToString().Split(',').ToList();
if (roles!=null)
{
roles.Clear();
}
roles = Appcommon.SetRoles(items);
var OsoidList = roles.Keys;
var Priority = roles.Values.ToArray();
keyList = roles.Keys.ToArray();
priorityList = Priority;