// Role Access Start public string GetModuleListByRole(string rolename) { DataFunctions obj = new DataFunctions(); List <ModuleListModel> lstPropertyDetails = new List <ModuleListModel>(); DataTable dt = obj.GetDataTable("select * from ModuleList "); string st = ""; foreach (DataRow bankDetails in dt.Rows) { string controller = bankDetails["Controller"].ToString(); string action = bankDetails["ActionName"].ToString(); bool isread = false, iswrite = false; string chk = ""; var UAM = dbContext.RoleAccesses.Where(ua => ua.RoleName == rolename && ua.ControllerName == controller && ua.ActionName == action).FirstOrDefault(); if (UAM != null) { isread = UAM.IsRead; if (isread) { chk = "checked"; } } // lstPropertyDetails.Add(new ModuleListModel { ModuleListID = Convert.ToInt32(bankDetails["ModuleListID"]), Name = Convert.ToString(bankDetails["Name"]), PageName = bankDetails["PageName"].ToString(), Controller = bankDetails["Controller"].ToString(), ActionName = bankDetails["ActionName"].ToString(), UserName = rolename, IsRead = isread, IsWrite = iswrite, Checked = chk }); st += @"<tr><td><input type='checkbox' id='" + Convert.ToInt32(bankDetails["ModuleListID"]) + "' value='" + Convert.ToInt32(bankDetails["ModuleListID"]) + "' name='chkPro' class='Prolist' " + chk + "/></td>"; st += "<td>" + Convert.ToString(bankDetails["Name"]) + "</td><td>" + Convert.ToString(bankDetails["PageName"]) + "</td><td>" + Convert.ToString(bankDetails["Controller"]) + "</td><td>" + Convert.ToString(bankDetails["ActionName"]) + "</td></tr>"; } return(st); }
static void Main(string[] args) { string baseChannelSelect = "SELECT BaseChannelID FROM BaseChannel ORDER BY BaseChannelID"; DataTable baseChannelDT = DataFunctions.GetDataTable(baseChannelSelect, connString); foreach (DataRow channelDR in baseChannelDT.Rows) { var baseChannelID = channelDR["BaseChannelID"].ToString(); var customerSelect = "SELECT CustomerID FROM Customer WHERE BaseChannelID = " + baseChannelID + " ORDER BY CustomerID"; DataTable customersDT = DataFunctions.GetDataTable(customerSelect, connString); foreach (DataRow customersDR in customersDT.Rows) { var custID = customersDR["CustomerID"].ToString(); var imgPath = filePath + "images"; imgPath = imgPath.Replace("%%channelID%%", baseChannelID); imgPath = imgPath.Replace("%%customerID%%", custID); string dataPath = filePath + "data"; dataPath = dataPath.Replace("%%channelID%%", baseChannelID); dataPath = dataPath.Replace("%%customerID%%", custID); double size = 0; var imgStorageSize = new DataStorageCalculator(); if (Directory.Exists(imgPath)) { size += imgStorageSize.GetSizeInBytes(imgPath); } var dataStorageSize = new DataStorageCalculator(); try { size += dataStorageSize.GetSizeInBytes(dataPath); } catch (DirectoryNotFoundException) { // do nothing the } string insertSQL = string.Format(@"INSERT INTO CustomerDiskUsage (ChannelID, CustomerID, SizeInBytes) values ({0}, {1}, {2})", baseChannelID, custID, size.ToString()); try { DataFunctions.Execute(insertSQL); } catch (Exception ex) { NotifyAdmin("DISKUsage Monitor Error on CustomerID: " + custID, ex.ToString()); } //break; } //break; } }
public JsonResult GetUsersInfoList() { try { // UserManager.PasswordHasher. DataFunctions obj = new DataFunctions(); List <UserModel> lstPropertyDetails = new List <UserModel>(); DataTable dt = obj.GetDataTable("select u.UserName,au.Email,r.roleName,au.PasswordHash from aspnet_users u inner join aspnet_usersinroles us on u.UserID=us.UserID inner join aspnet_roles r on us.RoleId=r.RoleID inner join aspnetusers au on u.username=au.username"); foreach (DataRow bankDetails in dt.Rows) { lstPropertyDetails.Add(new UserModel { UserName = Convert.ToString(bankDetails["UserName"]), EmailID = bankDetails["Email"].ToString(), RoleName = bankDetails["RoleName"].ToString() }); } return(Json(lstPropertyDetails, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json("", JsonRequestBehavior.AllowGet)); } }
public JsonResult GetUserList() { try { // UserManager.PasswordHasher. DataFunctions obj = new DataFunctions(); List <UserModel> lstPropertyDetails = new List <UserModel>(); DataTable dt = obj.GetDataTable("select UserName from aspnet_users"); foreach (DataRow bankDetails in dt.Rows) { lstPropertyDetails.Add(new UserModel { UserName = Convert.ToString(bankDetails["UserName"]) }); } return(Json(lstPropertyDetails, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json("", JsonRequestBehavior.AllowGet)); } }
public string GetPropertyByUser(string username) { REMSDBEntities context = new REMSDBEntities(); var model = projectService.AllProjects(); DataFunctions obj = new DataFunctions(); List <ProjectListModel> lstPropertyDetails = new List <ProjectListModel>(); DataTable dt = obj.GetDataTable("select * from Project"); string st = ""; foreach (var mdl in model) { string chk = ""; var UAM = context.UserProperties.Where(ua => ua.UserName == username && ua.ProjectID == mdl.ProjectID).FirstOrDefault(); if (UAM != null) { chk = "checked"; } // lstPropertyDetails.Add(new ModuleListModel { ModuleListID = Convert.ToInt32(bankDetails["ModuleListID"]), Name = Convert.ToString(bankDetails["Name"]), PageName = bankDetails["PageName"].ToString(), Controller = bankDetails["Controller"].ToString(), ActionName = bankDetails["ActionName"].ToString(), UserName = username, IsRead = isread, IsWrite = iswrite, Checked = chk }); st += @"<tr><td><input type='checkbox' id='" + Convert.ToInt32(mdl.ProjectID) + "' value='" + mdl.ProjectID + "' name='chkPro' class='Prolist' " + chk + "/></td>"; st += "<td>" + mdl.PName + "</td></tr>"; } return(st); }