|
Lev,
this is the current code i am using:-
private void SetUserPermissions(int userId,int grpId)
{
DataTable objDt = objUserlBus.GetAllUserLevel(userId);
for (int i = 0; i < objDt.Rows.Count; i++)
{
foreach (ToolStripMenuItem menu in objMain.menuStrip1.Items)
{
if (objDt.Rows[i][1].ToString() == menu.Tag.ToString())
{
menu.Enabled = true;
}
EnableMenu(menu, objDt, 0);
}
}
}
private void EnableMenu(ToolStripMenuItem tm, DataTable dt, int strt)
{
try
{
foreach (ToolStripMenuItem item in tm.DropDownItems)
{
for (int i = strt; i < dt.Rows.Count; i++)
{
if (_usrGrp == 2 && item.Tag.ToString() == "7.01")
continue;
if (item.Tag.ToString() == dt.Rows[i][1].ToString())
{
item.Enabled = true;
EnableMenu(item, dt, i + 1);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Please go thru this n verify whether i have gone wrong anywhere.
regards,
SRK
|
|
|
|
|
Why are you getting all the users permissions? There is only one user that works with the program instance. It is enough to get current user's permission level, and then iterate through the menus, tuning it as you need
Regards,
Lev
|
|
|
|
|
I am getting only the currently logged in user's permissions into the datatable,by passing his userid.I think you got confused by then name of the function.
SRK
|
|
|
|
|
Well, I see,
You are storing all the menu IDs applicable to the user permissions in a DB and then enable/disable the menu items with this IDs, am I right?
I don't think this is efficient, you are storing a lot of redundant data, try to do it the way I suggested. Do not keep menu IDs in the DB, instead keep the user privilege level, associate it with each menu item. This way you will get just the user permissions level from db (an integer for example) and compare it with the level associated with the menu item. See my previous post.
Regards,
Lev
|
|
|
|
|
I dont understand how the data will b eredundant,as the fields in the usrlvlmas table are usr_id n menu_id.
Each time new permissions are set for the user,all the existing levels for that user are deleted and only new ones are updated.
Anyway let me have a try again.
SRK
|
|
|
|
|
The key of my suggested approach is having general permission groups (levels, like admin, power user, restricted user) and not individual permissions for each and every user, that's generally the way it is being done (e.g. in Asp.Net membership providers).
Regards,
Lev
|
|
|
|
|
|
hello all
does anyone can give an idea of what a "response file" in c#
Is that an alternative to "makefiles" ????????
thanks
TJS
|
|
|
|
|
Hi friends,
plz any one reply me how can we change datagridview row's background color in runtime.
|
|
|
|
|
If this is not an ASP.NET question, surely the control has a Background or BackgroundColor property ? If not, you'd have to owner draw it, but that would seem odd to me.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
DataGridViewCellStyle style = new DataGridViewCellStyle();
style.BackColor = Color.Blue;
this.dataGridView1.RowsDefaultCellStyle = style;
|
|
|
|
|
Do it as
gridviewID.BackColor = "ffffff";
Cheers!!
Brij
|
|
|
|
|
I have created a C# Windows application in .NET 3.5, it runs the powerpoint slideshow and closes all the existing slideshows and should only run the new .ppt application.
In C# when I run this application with putting breakpoints it runs fine and gives no error.
But when I run it without breakpoint and say Ctrl+F5 then it throws the exception
Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 800706ba.
I have followed these links
http://blogs.msdn.com/karthick/archive/2006/02/28/540780.aspx[^]
http://blog.crowe.co.nz/archive/2006/03/02/589.aspx[^]
But got no help.
Can please anybody help me?
Thanks in advance,
|
|
|
|
|
Generally this means that the pause created by the breakpoint, fixes a race condition. Try putting a sleep before the code in question, if that fixes it, try to work out what your race condition is.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks a lot Christian Graus,
My problem is solved by putting sleep....
Also I understood the basic cause for that..........
Thanks for ur quick support.....
|
|
|
|
|
I've been been tasked redevelop a bespoke application that's showing its age, it's functionally very rich but it's UI is circa Windows 3.0 and it's internal architecture makes it costly to maintain. It's written in C/MFC with a proprietary "database", it's genesis goes back to the late '80's.
The stakeholders agree that the application cries out for a dock panel interface a'la Visual Studio etc. I'd really appreciate knowing what products folks have used to implement a dock panel user interface and their experiences in doing so - rolling our own is not an option we would want to persue.
I've identified five potential sources for a dock panel control, please tell me of any others. My client is a non-for-profit so the budget is limited, but it's not zero. Major considerations include access to source (free, escrow or pay (within reason) are all acceptable), robustness (even at the expense of some functionality), support costs & quality and documentation.
AvalonDock - open source, free, lives at Codeplex, it's a "vanilla" dock panel control, it's the successor of http://www.codeproject.com/KB/WPF/WPFdockinglib.aspx[^]
Nevron UI for .NET - proprietary, costs US$169, this library includes other stuff beside Dock Panel, which has some attractions
JastDev Docking Control - proprietary, costs US$78, supports XAML Browser Application development which has some appeal, does not include much other than the dock panel control.
Actipro - Docking & MDI Control - costs US$149, includes a fairly extensive set of atomic controls. Actipro have a bundle for US$499, that adds ribbons, navigation, property grid etc, this too has some appeal.
Dock Panel Suite - open source, free, lives at Source Forge, it's a vanilla WinForms dock panel control (I missed this one in my original post, thanks to John Simmons for reminding me of its existence)
modified on Friday, December 12, 2008 6:46 AM
|
|
|
|
|
I guess a big question is, do you want to use WPF, or not / At least one of these seems to be WPF ? Are they all ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
You're right they're all WPF. Its what my search turned up.
Actipro has a Windows Forms Dock Panel in a suite with Tab Strips, Navigation etc.
There were some el cheapo WinForms controls which I rejected, some were moribund, i.e. they'd not been updated for years, or their mail addresses bounced or their forums had not had a post for 12 months or more etc.
I'm not enamored with WPF, because I'm not convinced that XAML is an efficient declarative language. Seems to me that there are too many ways of doing the same thing and no clear guidelines on what to use when, but I really need to use it anger to make a rightful judgement. I originally thought C was rubbish when I was writing PDP-11 assembler, so I don't take much notice of what I think.
Office 2007 is an influence, client recently upgraded to it, being who/what they are they get academic pricing. Apparently the users wanted their menu's back but after a few weeks they all got to love the ribbons etc, now they complain about Outlook not having ribbons & orbs.
The users don't know/care if its WPF, XYZ or �(, but they've seen things like the Health Care facade that MS did in the UK and they've indicated like some of that. Also given that the current system was bleeding edge when it was developed nearly 20 years ago, they're of the view that if they do they same again then they'll get 20 years out of any new system.
So do I want to use WPF, probably not, but do I expect to use it - probably. I may need to find someone with WPF skills and a heart of gold, i.e. willing to work long hours over a couple of years for shirt buttons.
|
|
|
|
|
We're currently using DockPanel Suite[^]. It does not use WPF.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: We're currently using DockPanel Suite[^]. It does not use WPF.
I've got that too, it somehow slipped off the radar screen when I was writing my OP here. I hope you wont object to a few questions
Given it hasn't changed since Nov 2007 can I assume its robust?
Have you run into any coexistence problems with other controls?
My preference is to use VS9 and NET 3.0? Are you using VS if so which version, and which .NET do you target.
If you took another job and you were looking for a Dock Panel Control, would you look further than Dock Panel Suite, for reasons other than curiosity - in other words what deficiencies do you perceive in Dock Panel Suite?
|
|
|
|
|
urbane.tiger wrote: Given it hasn't changed since Nov 2007 can I assume its robust?
It seems to be pretty solid. The documentation quite frankly sucks, and you have to glean useful information about its implementation from the sample application, but I've managed to get it going without too much fuss. I had to implement my own MDI child tabs but that was no big deal really.
urbane.tiger wrote: Have you run into any coexistence problems with other controls?
Not yet. We have a single docking window with four content windows, each of which contain a splitcontainer that has a treeview in each pane.
urbane.tiger wrote: My preference is to use VS9 and NET 3.0? Are you using VS if so which version, and which .NET do you target.
We're using VS2008 and dotNet 3.5. I believe the current version of the library targets 2.0, but when we converted it to 3.5, there were no issues.
urbane.tiger wrote: If you took another job and you were looking for a Dock Panel Control, would you look further than Dock Panel Suite, for reasons other than curiosity - in other words what deficiencies do you perceive in Dock Panel Suite?
It feels heavy to me (but I don't have anything to compare it to. There are also some features missing that I wish it had, like a MDI child tabs strip, and a couple of other things I can't remember right now. It's certainly cheaper than the other stuff out there. If I were in charge of a development shop, I'd probably prefer a commercial product, because with something this complex, support and documentation are critical factors (you don't want your devs sitting around with their thumbs up their asses waiting for an answer to a question, or wishing they could get one).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi John
Thanks very much for your thoroughgoing response. I guess I've anticipated that a Dock Panel Control will be a fairly weighty creature, Avalon Dock looks similarly "heavy", the commercial ones are probably even more so.
We'll probably make in decision sometime in Feb09, if you're interested send me a PM & I'll try to remember to let you know which way we go - assuming we go some where, can't be sure of anything these days.
PhilD
|
|
|
|
|
How to display images randomly from a file on click of a button in C#.net
|
|
|
|
|
Well, you need to look at the Random class. Then you can use Directory.GetFiles to get a list of files to randomly select from.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|