15,888,968 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 15073686 (Top 7 by date)
Member 15073686
8-Mar-21 5:04am
View
I particularly put down the admin role as main role so when i add admin all the permissions are enabled.
Member 15073686
5-Mar-21 4:36am
View
than what else can I do. I am open for suggestions.
Member 15073686
5-Mar-21 4:31am
View
Deleted
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Xml.Linq;
using System.Windows.Media;
namespace UserAccessManagementLib
{
public class UserAccessManagement
{
public string roleXMLLoc { get; set; }
public string activityXMLLoc { get; set; }
public string userPermissionLoc { get; set; }
List<string> usersData;
List<string> userPermission;
List<mycontrol> listControls;
///
/// Parsing XML
///
public void ParseXML()
{
if (File.Exists(userPermissionLoc))
{
XDocument doc = XDocument.Load(userPermissionLoc);
var elements = doc.Root.Elements("Roles").ToList();
foreach (var x in elements)
{
//Console.WriteLine("Roles :: " + x.Value);
var UIControls = listControls.Where(y => y.userRole == x.Value).ToList();
var roles = doc.Root.Elements(x.Value.Replace(" ", "_")).Where(y => y.Name == x.Value.Replace(" ", "_"));
var permissions = roles.Elements("Permissions");
var permission_value = permissions.Elements("Permission").ToList();
var visible_value = permissions.Elements("Visible").ToList();
var enable_value = permissions.Elements("Enabled").ToList();
for (int i = 0; i < permissions.Count(); i++)
{
if (permissions.Count() == UIControls.Count)
{
UIControls[i].isVisibled.IsChecked = Convert.ToBoolean(visible_value[i].Value);
UIControls[i].isEnabled.IsChecked = Convert.ToBoolean(enable_value[i].Value);
}
}
}
}
}
///
/// Adding Tabs
///
/// <param name="myTab" />
public void FillTabs(TabControl myTab)
{
myTab.Items.Clear();
usersData = new List<string>();
userPermission = new List<string>();
listControls = new List<mycontrol>();
bool isFailedToLoad = false;
if (File.Exists(roleXMLLoc))
{
XDocument doc = XDocument.Load(roleXMLLoc);
var list_ = doc.Root.Elements("Role").ToList();
for (int i = 0; i < list_.Count; i++)
{
usersData.Add(list_[i].Value);
}
}
else
{
isFailedToLoad = true;
}
if (File.Exists(activityXMLLoc))
{
XDocument doc = XDocument.Load(activityXMLLoc);
var list_ = doc.Root.Elements("Activity").ToList();
for (int i = 0; i < list_.Count; i++)
{
userPermission.Add(list_[i].Value);
}
}
else
{
isFailedToLoad = true;
}
if (!isFailedToLoad)
{
GenerateTabs(myTab);
}
}
private void GenerateTabs(TabControl myTab)
{
for (int i = 0; i < usersData.Count; i++)
{
ScrollViewer scroll = new ScrollViewer();
scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
StackPanel sp = new StackPanel();
sp.Orientation = Orientation.Vertical;
for (i
Member 15073686
5-Mar-21 4:12am
View
I am making a WPF application to create user access management and it has check box to the permissions. The thing is whenever I edit or change the users name than all the permissions will set to False or all the checkbox will be unchecked. my requirements are whenever I edit the name of the user the checkbox stay checked. I am fetching data from XML file.
Member 15073686
27-Feb-21 4:27am
View
Thanks dude but I got my answers there was one silly mistake that in line
cmd.CommandText = "insert into Login (UserName, PassWord,) values ('" + textBox1.Text + "','" + textBox2.Text + "');";
i wasn't suppose to put the comma in "insert into login (Username,Password,)...."
The line needs to be like this "insert into login (Username,Password)....."
Member 15073686
22-Feb-21 4:56am
View
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Globalization;
using System.Windows.Forms;
namespace system_date_and_time_format
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
timer1.Start();
}
private void Form1_Load(object sender, EventArgs e)
{
CultureInfo ci = CultureInfo.CurrentCulture;
DateTimeFormatInfo dtfi = ci.DateTimeFormat;
string[] SystemDateTimePatterns = new string[250];
int i = 0;
foreach (string name in dtfi.GetAllDateTimePatterns('d'))
{
SystemDateTimePatterns[i] = name;
i++;
}
string[] myDateTimeFormat = { "dd-MMM-yy HH:mm:ss tt", "dd-MMM-yyyy HH:mm:ss tt", "dd-MM-yyyy" };
MessageBox.Show(myDateTimeFormat[0].ToString());
for(int j =0;j
Member 15073686
22-Feb-21 4:55am
View
Deleted
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Globalization;
using System.Windows.Forms;
namespace system_date_and_time_format
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
timer1.Start();
}
private void Form1_Load(object sender, EventArgs e)
{
CultureInfo ci = CultureInfo.CurrentCulture;
DateTimeFormatInfo dtfi = ci.DateTimeFormat;
string[] SystemDateTimePatterns = new string[250];
int i = 0;
foreach (string name in dtfi.GetAllDateTimePatterns('d'))
{
SystemDateTimePatterns[i] = name;
i++;
}
string[] myDateTimeFormat = { "dd-MMM-yy HH:mm:ss tt", "dd-MMM-yyyy HH:mm:ss tt", "dd-MM-yyyy" };
MessageBox.Show(myDateTimeFormat[0].ToString());
for(int j =0;j
Show More