|
sos_amin wrote: to smo
The answer is still no
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
If you want a complete program, you can buy one. If you want complete source code, you should ask on the job board for someone to write it for you. Be careful, the web is full of people who claim to be programmers and are not, they just take your bid then ask people in online forums like this to do the work for them.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi All.
I have a StaffMember class in my app that is inherited by my data access layer to StaffMemberOracleUDT. My reasoning for this is that the OracleUDT version has the data access part needed to convert an Oracle object to something I can use and then I can just send back the StaffMember base to be used in the UI layer.
The problem I'm having is that I need to access the properties in the base class (Name, ID etc) but I also need to over ride these in the inherited class as each property needs a special OracleObjectMappingAttribute added to it that cannot be added to the base as I would then need to reference the Data Access Layer in my UI layer which shouldn't really be done.
Any help is greatly appreciated.
The FoZ
|
|
|
|
|
The short answer is "yes".
I think it's a slightly odd dependency pattern you're creating - your DALs will depend on the business layer - but it is possible. And you don't need to reference the DAL from the UI - just the business layer.
In your business layer you'll have:
public class StaffMember
{
virtual public string Name { get; set; }
}
and in the Oracle DAL
public class StaffMemberOracle : StaffMember
{
[SomeAttribute]
override public string Name { get; set; }
}
You never actually "convert" between these two types: The derived class IS the base class plus something of it's own.
public StaffMember LoadStaffMember(int id)
{
switch (DB)
{
case "Oracle": return OracleDAL.LoadStaffMember(id);
case "MSSQL": return MssqlDAL.LoadStaffMember(id);
...
}
}
Not that I'd do that! Rather than have a bunch of switches in every method in the business layer that uses the DAL, create an interface that all DALs implement. Then your code will be something like
public StaffMember LoadStaffMember(int id)
{
return CreateDAL().LoadStaffMember(id);
}
public Something LoadSomething(int id)
{
return CreateDAL().LoadSomething(id);
}
IDAL CreateDAL()
{
get
{
switch (DB)
{
case "O": return new OracleDAL();
case "MS": return new MsSqlDAL();
...
}
}
}
HTH
|
|
|
|
|
Thanks for you reply but I am having a few problems. I have set it out like you have above but my properties have private members associated to them. If I have code in the get & set on the base I get an error in the inherited class "inherited.staffid.set cannot override inherited member base.StaffID.set because it is not marked virtual, abstract or overrride." My base class property is marked virtual and the inherited is marked override.
public class StaffMember
{
protected int staffID;
virtual public int StaffID
{
get { return staffID; }
set { staffID = value }
}
}
public class StaffMemberOracle : StaffMember, INullable, IOracleCustomType
{
[OracleObjectMappingAttribute("STAFFID")]
override void int StaffID
{
get { return staffID; }
set { staffID = value }
}
}
I think I may be going about this the wrong way.
Cheers
The FoZ
|
|
|
|
|
override void int StaffID should be override public int StaffID .
|
|
|
|
|
Sorry that was a typo!
I think I have solved it. I need to use the new keyword new public int StaffID to declare a new version of the property. Intellisense seems to like it
Thanks for your effort
The FoZ
|
|
|
|
|
No, you don't need "new". You need "override". The "new" keyword is for member *hiding*, not overriding.
To understand why, you need to know about the difference between virtual and non-virtual members, also often described as "late-bound" and "early-bound" members. It's also helpful to understand the concepts of reference types and value types.
A couple resources I dug up for you quickly (you may want to google for others if they don't work for you):
Value Types vs Reference Types[^]
Virtual Members vs Non-Virtual[^]
Or google "polymorphism" and these other terms I've mentioned.
In brief, virtual members work as follows: When a member is accessed, such as method Foo(), the implementation of that method is resolved ("bound") at run-time, based on the run-time (actual) type of the object. For non-virtual members, the implementation is resolved at compile time (when you compile), based on the declared type of the reference.
For example:
public class A
{
virtual public string Foo() { return "A.Foo()"; }
}
public class B : A
{
override public string Foo() { return "B.Foo()"; }
}
void test()
{
A obj = new A();
MessageBox.Show(obj.Foo()); // "A.Foo()"
obj = new B();
// Now, "obj" is still of declared type "A", but run-time type "B".
MessageBox.Show(obj.Foo()); // "B.Foo()"
}
If instead you declared A.Foo without the virtual keyword and used new to hide this method in B, the second call to "obj.Foo" would still resolve to A.Foo, because obj is of declared type A.
|
|
|
|
|
Thanks for your reply but it wouldn't work for me earlier. Probably to much going on.
Just tried and it is working. Thanks again for you help.
The FoZ
|
|
|
|
|
Hi,
I have created a winform using c# in visual studios 2008 professional. I am trying to deploy the application on a different pc, other than the one it was developed in, am getting the following error.
"Unable to run or install the application. The application requires that assembly Microsoft.Office.Tools.Excel Version 8.0.0.0 be installed in the Global assembly cache GAC first."
Can any1 help me solve this issue. Thanks
|
|
|
|
|
Gee, have you considered installing the dll it's asking for ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
How much more clear could the message be?!?
Hold on, with my psychic powers I can determine that your application has some functionality that relates to Microsoft Excel. Am I right?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
But from where do i downmoad it from, i tried updating office with sp3. has not solved the problem yet.
Could any one provide a link to the download,..
Thanks
|
|
|
|
|
I tried looked for dll files for office before and could not find. you need full version and maybe you can copy them from there.
I believe the version you want (8.0.0.0) is excel '98 so you need to get a copy of that and use those files. If you did not want to use such an early version then you need to specify the version in your code. But you will still need the appropriate files on your target machines.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
hi guys,
i am trying to get the text from the checked checkbox in my checkedlistbox ..
i write this code this.textBox1.Text = this.checkedListBox1.CheckedItems.ToString(); but i don't get it...
it retutns this
System.Windows.Forms.CheckedListBox+CheckedItemCollection
i would appreciate if someone help me..
thanks in advance... 
|
|
|
|
|
Checked Items is a collection, as you can see. You need to use foreach to step over this collection, and get the names of all the checked items.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You mean you want to see Check
foreach (string checkedval in this.checkedListBox1.CheckedItems)
{
}
|
|
|
|
|
Hi there.
I'm trying to write a c# code that will automaticaly initiate a user login, if the user is logged off for a given period of time.
I've tried using the ADVAPI32.DLL's function LogonUser, but apparently that is used for impresonation (am i wrong?).
So, how is that done?
In addition, i failed to find a way to check if a specific user is logged on or not.
Any idea?
Thanks,
SummerBulb
|
|
|
|
|
Although I believe you can write C# code in a service that will run when a user is logged off, I doubt you can log on through such code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
How are you planning to run your code while there is no user logged in? Do you not think this defeats the purpose of having a login?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
The code will run as a service.
I've already managed to run a c# application as a service.
That's the easy part.
Although, is should be takan into consideration that in order to run a c# app in th logon window, is has to run under SYSTEM.
That might make things more complicated.
|
|
|
|
|
|
Hi,
i have a form with 3 combobox which is bind to datatable
i use combobox.datasoure to bind to datatable
And on 1st combobox selectedvalue i need to send the cbo text to database and get another set of datas and populate 2nd cbo with datatable
So for this, if i use selectedindexchanged event it is fired so many times...
this event is fired when i bind the combobox to datatable using
combobox.datasource = datatable;
so after googling i use selection change committed event
this event is fired after user selection and before combobox dropdown closed....
and this event doesnt fire on datatable bind.
But my problem now is, in selectionChangeCommitted event, the combobox selectedvalue is currently selected value and the combobox.text is previously selected text , so i cudnt pass the combobox selected text to database to retreive the datatable...
cud anyone plz help me to resolve this issue?
thank u
|
|
|
|
|
Are they all bound to the same table, or to copies of it ? If they bind to the same table, they will keep in synch with each other.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
No they are not bind to the same datatable...
depending on 1st combobox's text, i need to fetch different set of data from database and populate 2nd combobox
|
|
|
|