Jump to content


  • Posts

  • Joined

  • Last visited

About DooVoo

  • Birthday 01/25/1983

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location
    Derby, UK

DooVoo's Achievements


Newbie (1/7)



  1. Is anyone able to help me out with this? I'd rather not override each method that uses the mUser variable just to change it to mAdminUser.
  2. Hi All,It's been a while since I last posted here. I've come across a small issue with my latest project, a registration and login system. This will then also have a seperate login system for administrators.To try and keep the amount of duplicated code to a minimum I've created a User class which the Login:Page class accesses and then created the derived classes AdminUser and AdminLogin which inherit the properties of User and Login respectively.My problem is this. The Login class uses a User instance called mUser, but the AdminLogin class needs to use an instance of AdminUser, also called mUser to avoid having to rewrite the inheritted code. Below is a stripped down version of the problem. public class User { public virtual void DoSomething() { // Do Something. }}public class AdminUser:User { public override void DoSomething() { // Do Something Else. }}public class Login:Page { private User mUser; public Login() { mUser = new User(); mUser.DoSomething(); }}public class AdminLogin:Login { public AdminLogin() { // Something to turn mUser into an AdminUser datatype. }} I believe that the data type of mUser could be set at runtime by using the base Object class and then using boxing and unboxing to assign it, but I can't quite figure it out. Below is an example, it doesn't work but it might give someone some inspiration! // Using the same User and AdminUser examples above.public class Login:Page { private User mUserRef; protected Object mUser; public Login() { mUserRef = new User(); mUser = mUserRef; // Boxing mUserRef into mUser. mUser.DoSomething(); }}public class AdminLogin:Login { private AdminUser mAdminUserRef; public AdminLogin() { mAdminUserRef = new AdminUser(); mUser = mAdminUserRef; // Boxing mAdminUserRef into base.mUser. mUser.DoSomething(); }} I hope someone can help me with this, it's incredibly fustrating!NB: I realise a single login system with userlevels would work, but i want a coded solution to help me understand more about c# - I'm being difficult I know, but it's the only way I'll learn
  3. DooVoo

    Format data

    You could also make use of String.Format to do the job. Checkout: http://idunno.org/displayBlog.aspx/2004071401
  4. DooVoo


    aspnetguy is correct, but sometimes you may want your code to be more portable or accessable. By turning your classes into a class library you can access them by just referring to their namespace with a "using" statement. I've found this approach to be very flexible when working with other developers on the same project.Edit: It's far too early for spelling and grammer. Please excuse the poor attempt at English above
  5. So, does that work or are you still having problems?
  6. Hmmm, not a very specific question. You should really be reading up on database design and asp.net coding if you have to ask questions like this. With that in mind, I hope the following makes sense.First for the db. I would recommend having a chapter table and a sub chapter table with appriopriate primary and secondary keys linking them together to create a 1 chapter has many sub chapters relationship.Then for the code I would run a query that accesses all the chapters and then gets all the sub chapter for each main chapter. A stored procedure on your sql database would make this a little cleaner and help seperate out the database and coding logic.An alternative to using a database would be to use XML files, they would be faster to access and would leave your database to do more application critical operations, rather than worry about compiling the menu.Hope this helps to get you started!
  7. I'm beginning to think posting on this forum is the first step to solving an issue on my own. I can stare at the problem for hours and get no-where, then just by entering the problem here and continuing with my search do i stumble across the information i need. w3schools is now my lucky charm :)So, for those of you who might want to know the answer...When reading in multiple xml files with the same schema (and possible those that can be used to extend the current schema) there is no problem.However, if you are adding multiple xml files with different schemas then you need the DataSet to create a new table for each schema. This is done using one of the overloaded ReadXml(), such as ReadXml(string filename, XmlReadMode mode). By supplying the XmlReadMode you can tell the DataSet what to do when it encounters a schema that doesn't match the first one.To solve my issue I used: DataSet.ReadXml(string filename, XmlReadMode.InferSchema);This causes the DataSet to extend the xml schema in the first table if possible and if not, create a new table with the new schema.Excellent
  8. After some debugging Ive found that it is trying to load the second file, but into the first table rather than creating a new table. Anyone know if there is a way to force ReadXML to create another table?
  9. The title says it all really. I'm trying to populate a single DataSet with data from multiple xml files, to create either one DataTable for each xml file i read in. Here's the code: DataSet ds = new DataSet("myds");ds.ReadXml("somefile.xml");ds.ReadXml("somefile2.xml"); Unfortunately this doesn't seem to be working. The first file is read in correctly but the second file doesn't seem to load at all. Does anyone know if this is possible in .NET 1.1? I know that the DataTable type has a ReadXML method in v2 but it's not available in 1.1
  10. These links should be useful too:http://www.csharpfriends.com/quickstart/as...###=MailMessagehttp://www.csharpfriends.com/quickstart/as...&class=SmtpMail
  11. Typecasting is faster though, if you know there wont be any strange results that is.
  12. Hi Mohana,In your database I would store two strings, one as the url to the logo and one as the url it should link to.Then it's just a matter of SELECTing the two strings and putting them into your homepage at runtime.
  13. Okay, after some checking and reading I've found the following.Using the method ToString() will work with all classes that include it without any side effects of potential class "wierdness". The main downside is that it is slower that type-casting.However, having said that, the difference in speed is barely worth mentioning and so I conclude that using ToString() is the way forward!
  14. DooVoo


    Was this useful for anyone? I was thinking of writing something similar each time I learnt something (I think is) useful, but if it's not benefitting anyone here then there isn't much point. Please let me know
  15. DooVoo


    I personally use a text editor, since the web.config file is just that, a text config file. As for all the directives it can have, I'd recommend looking on the MSDN site. They should be all on there somewhere!
  • Create New...