本文整理汇总了C#中WMS.Models.User类的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于WMS.Models命名空间,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckDeleteActionPermission
private bool CheckDeleteActionPermission(User _User)
{
if (_User.CanDelete == true)
return true;
else
return false;
}
示例2: CheckCreateActionPermission
private bool CheckCreateActionPermission(User _User)
{
if (_User.CanAdd == true)
return true;
else
return false;
}
示例3: CheckForUserRole
public string CheckForUserRole(User user)
{
string val = "";
using (var ctx = new TAS2013Entities())
{
string criteria = ctx.UserAccesses.Where(aa => aa.UserID == user.UserID).FirstOrDefault().Criteria;
switch (criteria.Trim())
{
case "Z":
val = "Zone";
break;
case "R":
val="Region";
break;
case "C":
val = "City";
break;
case "L":
val = "Location";
break;
case "S":
val = "SuperUser";
break;
}
ctx.Dispose();
}
return val;
}
示例4: CheckDetailActionPermission
private bool CheckDetailActionPermission(User _User)
{
if (_User.CanView == true)
return true;
else
return false;
}
示例5: CheckforPermission
public static bool CheckforPermission(User _User, ReportName _report)
{
bool check = false;
try
{
switch (_report)
{
case ReportName.Audit:
if (_User.MRAudit == true)
check = true;
break;
case ReportName.Daily:
if (_User.MRDailyAtt == true)
check = true;
break;
case ReportName.Detail:
if (_User.MRDetail == true)
check = true;
break;
case ReportName.Employee:
if (_User.MREmployee == true)
check = true;
break;
case ReportName.Grpah:
if (_User.MRGraph == true)
check = true;
break;
case ReportName.Leave:
if (_User.MRLeave == true)
check = true;
break;
case ReportName.ManualAtt:
if (_User.MRManualEditAtt == true)
check = true;
break;
case ReportName.Monthly:
if (_User.MRMonthly == true)
check = true;
break;
case ReportName.Summary:
if (_User.MRSummary == true)
check = true;
break;
}
}
catch (Exception ex)
{
check = false;
}
return check;
}
示例6: MakeCustomizeQuery
public string MakeCustomizeQuery(User _user)
{
string query = " where ";
string subQuery = "";
string subQueryLoc = "";
List<string> _Criteria = new List<string>();
List<string> _CriteriaForOr = new List<string>();
List<string> _CriteriaForOrLoc = new List<string>();
TAS2013Entities db = new TAS2013Entities();
List<UserAccess> ulocs = new List<UserAccess>();
ulocs = db.UserAccesses.Where(aa => aa.UserID == _user.UserID).ToList();
foreach (var uloc in ulocs)
{
if(uloc.Criteria.Trim() == "Z")
_CriteriaForOrLoc.Add(" ZoneID = " + uloc.CriteriaData + " ");
if (uloc.Criteria.Trim() == "R")
_CriteriaForOrLoc.Add(" RegionID = " + uloc.CriteriaData + " ");
if (uloc.Criteria.Trim() == "C")
_CriteriaForOrLoc.Add(" CityID = " + uloc.CriteriaData + " ");
if (uloc.Criteria.Trim() == "L")
_CriteriaForOrLoc.Add(" LocID = " + uloc.CriteriaData + " ");
if (uloc.Criteria.Trim() == "S")
query = "";
if (uloc.Criteria.Trim() == "")
{
query = "";
return query;
}
}
for (int i = 0; i < _CriteriaForOrLoc.Count - 1; i++)
{
subQueryLoc = subQueryLoc + _CriteriaForOrLoc[i] + " or ";
}
if(_CriteriaForOrLoc.Count>0)
subQueryLoc = " ( " + subQueryLoc + _CriteriaForOrLoc[_CriteriaForOrLoc.Count - 1] + " ) ";
//subQuery = " ( ";
//for (int i = 0; i < _CriteriaForOr.Count - 1; i++)
//{
// subQuery = subQuery + _CriteriaForOr[i] + " or ";
//} if (_CriteriaForOr.Count > 0)
//subQuery = subQuery + _CriteriaForOr[_CriteriaForOr.Count - 1];
//subQuery = subQuery + " ) ";
query = query + subQueryLoc;
return query;
}
示例7: QueryForCompanyFilters
public string QueryForCompanyFilters(User _User)
{
string query = "";
switch (_User.RoleID)
{
case 1:
break;
case 2:
query = " where CompanyID= 1 or CompanyID = 2 ";
break;
case 3:
query = " where CompanyID>= 3";
break;
case 4:
query = " where CompanyID = " + _User.CompanyID.ToString();
break;
case 5:
break;
}
return query;
}
示例8: MakeCustomizeQueryForUserAccess
public string MakeCustomizeQueryForUserAccess(User _user)
{
TAS2013Entities db = new TAS2013Entities();
string query = "where";
List<UserAccess> uAcc = new List<UserAccess>();
uAcc = db.UserAccesses.Where(aa => aa.UserID == _user.UserID).ToList();
foreach (var access in uAcc)
{
if (access.Criteria.Contains("L"))
query = query + " LocID = " + access.CriteriaData + " ";
if (access.Criteria.Contains("S"))
query = query + " LocID>0";
}
return query;
}
示例9: LoadShiftGrid
private void LoadShiftGrid(User _loggedUser)
{
List<Shift> _objectList = new List<Shift>();
_objectList = context.Shifts.Where(aa => aa.CompanyID == _loggedUser.CompanyID).ToList();
//_Query = "SELECT * FROM TAS2013.dbo.EmpType where " + selectSQL;
//grid_EmpType.DataSource = GetValuesFromDatabase(_Query, "EmpType");
//grid_EmpType.DataBind();
grid_Shift.DataSource = _objectList;
grid_Shift.DataBind();
}
示例10: LoadSectionGrid
private void LoadSectionGrid(User _loggedUser)
{
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForCompanySegeration(_loggedUser);
DataTable dt = qb.GetValuesfromDB("select * from ViewSection " + query);
List<ViewSection> _View = dt.ToList<ViewSection>();
grid_Section.DataSource = _View;
grid_Section.DataBind();
}
示例11: LoadShiftView
private void LoadShiftView(User _loggedUser)
{
}
示例12: QueryForUserAccess
public string QueryForUserAccess(User _User, string view)
{
string role="";
string query = "";
using (var context = new TAS2013Entities())
{
role = context.UserRoles.Where(aa => aa.RoleID == _User.RoleID).FirstOrDefault().RoleName;
}
switch (view)
{
case "Region": query= UserAcccessGetRegion(_User,role);
return query;
case "Zone": query = UserAcccessGetZone(_User, role);
return query;
case "Location": query = UserAcccessGetLocation(_User, role);
return query;
case "City": query = UserAccessGetCity(_User, role);
return query;
case "SuperUser": query = "CompanyID >0";
return query;
}
return query;
}
示例13: QueryForReportsCity
internal string QueryForReportsCity(User LoggedInUser, string p)
{
string query = " where ";
TAS2013Entities db = new TAS2013Entities();
List<UserAccess> uAcc = new List<UserAccess>();
uAcc = db.UserAccesses.Where(aa => aa.UserID == LoggedInUser.UserID).ToList();
List<Region> regions = db.Regions.ToList();
List<City> cities = db.Cities.ToList();
List<Location> locs = db.Locations.ToList();
List<string> queryList = new List<string>();
foreach (var access in uAcc)
{
switch (LoggedInUser.RoleID)
{
case 1://Super ADmin
query = "";
break;
case 4://Zone
List<City> city = db.Cities.Where(aa => aa.Region.ZoneID== access.CriteriaData).ToList();
foreach (var c in city)
{
queryList.Add(" CityID =" + c.CityID);
}
break;
case 5://REgion
city = db.Cities.Where(aa => aa.RegionID == access.CriteriaData).ToList();
foreach (var c in city)
{
queryList.Add(" CityID =" + c.CityID);
}
break;
case 6://City
string cityID = cities.Where(aa => aa.CityID == access.CriteriaData).FirstOrDefault().CityID.ToString();
queryList.Add(" CityID =" + cityID);
break;
case 7://Location
string cityIDForLoc = locs.Where(aa => aa.LocID == access.CriteriaData).FirstOrDefault().CityID.ToString();
queryList.Add(" CityID =" + cityIDForLoc);
break;
}
}
if (queryList.Count == 1)
{
query = query + queryList[0];
}
else if (queryList.Count > 1)
{
for (int i = 0; i < queryList.Count - 1; i++)
{
query = query + queryList[i] + " or ";
}
query = query + queryList[queryList.Count - 1];
}
return query;
}
示例14: QueryForCompanyFilters
public string QueryForCompanyFilters(User _User)
{
string query = "";
//switch (_User.RoleID)
//{
// case 1:
// break;
// case 2:
// query = " where CompanyID= 1 or CompanyID = 2 ";
// break;
// case 3:
// query = " where CompanyID>= 3";
// break;
// case 4:
// query = " where CompanyID = " + _User.ToString();
// break;
// case 5:
// break;
//}
return query;
}
示例15: QueryForCompanyViewLinq
public string QueryForCompanyViewLinq(User _User)
{
string query = "";
switch (_User.RoleID)
{
case 1: query = "CompID > 0";
break;
case 2:
query = "CompID= 1 or CompID = 2 ";
break;
case 3:
query = "CompID>= 3";
break;
case 4:
query = "CompID = " + _User.CompanyID.ToString();
break;
case 5:
break;
}
return query;
}