?
Solved

need to create a custom class called Personal.cs. I have done some things. Need someone to check it out.

Posted on 2009-02-16
10
Medium Priority
?
183 Views
Last Modified: 2012-05-06
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


/// <summary>
/// Summary description for Personal
/// </summary>
[Serializable()]
public class Personal
{
    public Personal() { }

    public Personal

        (
         string username,
         string password,
         string email,
         string firstname,
         string lastname,
         DateTime dob,
         int age,
         string gender,
         string seeking,
         string confirmationguid,
         string userid,
         string sessionid)
    {
        this.UserName = username;
        this.Password = password;
        this.Email = email;
        this.FirstName = firstname;
        this.LastName = lastname;
        this.DOB = dob;
        this.Age = age;
        this.Gender = gender;
        this.Seeking = seeking;
        this.ConfirmationGUID = confirmationguid;
        this.UserIP = userip;
        this.SessionID = sessionid;
    }    

    private string username = string.Empty;
    public string UserName
    {
         get { return username;}
         set { username = value;}
    }

    private string password = string.Empty;
    public string Password
    {
        get { return password;}
        set { password = value;}
    }

    private string email = string.Empty;
    public string Email
    {
        get { return email;}
        set { email = value;}
    }

    private string firstname = string.Empty;
    public string FirstName
    {
        get { return FirstName;}
        set { FirstName = value;}
    }

    private string lastname = string.Empty;
    public string LastName
    {
        get { return LastName;}
        set { LastName = value;}
    }

    private DateTime dob = DateTime.Now;
    public DateTime DOB
    {
        get { return DOB;}
        set { DOB = value;}
    }

    private int age = 0;
    public int Age
    {
        get { return Age;}
        set { Age = value;}
    }  

    private string gender = string.Empty;
    public string Gender
    {
        get { return Gender;}
        set { Gender = value;}  
    }

    private string seeking = string.Empty;
    public string Seeking
    {
        get { return Seeking;}
        set { Seeking = value;}
    }

    private string confirmationguid = string.Empty;
    public string ConfirmationGUID
    {
        get { return ConfirmationGUID;}
        set { ConfirmationGUID = value;}
 
    }
 
    private string userip = string.Empty;
    public string UserIP
    {
        get { return UserIP;}
        set { UserIP = value;}
    }

    private string sessionid = string.Empty;
    public string SessionID
    {
        get { return SessionID; }
        set { SessionID = value; }

    }
   
}
0
Comment
Question by:mathieu_cupryk
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 16

Accepted Solution

by:
sunithnair earned 1000 total points
ID: 23651942
It should be like this
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
 
 
/// <summary>
/// Summary description for Personal
/// </summary>
[Serializable()]
public class Personal
{
    public Personal() { }
 
    public Personal
 
        (
         string username,
         string password,
         string email,
         string firstname,
         string lastname,
         DateTime dob,
         int age,
         string gender,
         string seeking,
         string confirmationguid,
         string userip,
         string sessionid)
    {
        this.username = username;
        this.password = password;
        this.email = email;
        this.firstname = firstname;
        this.lastname = lastname;
        this.dob = dob;
        this.age = age;
        this.gender = gender;
        this.seeking = seeking;
        this.confirmationguid = confirmationguid;
        this.userip = userip;
        this.sessionid = sessionid;
    }
 
    private string username = string.Empty;
    public string UserName
    {
        get { return username; }
        set { username = value; }
    }
 
    private string password = string.Empty;
    public string Password
    {
        get { return password; }
        set { password = value; }
    }
 
    private string email = string.Empty;
    public string Email
    {
        get { return email; }
        set { email = value; }
    }
 
    private string firstname = string.Empty;
    public string FirstName
    {
        get { return firstname; }
        set { firstname = value; }
    }
 
    private string lastname = string.Empty;
    public string LastName
    {
        get { return lastname; }
        set { lastname = value; }
    }
 
    private DateTime dob = DateTime.Now;
    public DateTime DOB
    {
        get { return dob; }
        set { dob = value; }
    }
 
    private int age = 0;
    public int Age
    {
        get { return age; }
        set { age = value; }
    }
 
    private string gender = string.Empty;
    public string Gender
    {
        get { return gender; }
        set { gender = value; }
    }
 
    private string seeking = string.Empty;
    public string Seeking
    {
        get { return seeking; }
        set { seeking = value; }
    }
 
    private string confirmationguid = string.Empty;
    public string ConfirmationGUID
    {
        get { return confirmationguid; }
        set { confirmationguid = value; }
 
    }
 
    private string userip = string.Empty;
    public string UserIP
    {
        get { return userip; }
        set { userip = value; }
    }
 
    private string sessionid = string.Empty;
    public string SessionID
    {
        get { return sessionid; }
        set { sessionid = value; }
 
    }
 
}

Open in new window

0
 
LVL 10

Assisted Solution

by:jabcoco
jabcoco earned 600 total points
ID: 23652011
If using .NET 3.5 you can do that way.
This will simplifier your code.
//Declare you class object with properties
-----------------------------------------------
public class MyClass
{
    public string LastName { get; set; }
    public string FirstName { get; set; }
 
    public MyClass(){}
}
 
//Create a new instance of the MyClass object
-----------------------------------------------
MyClass oMc = new MyClass(){
    LastName = "MyLastName",
    FirstName = "MyFirstName"
};

Open in new window

0
 
LVL 41

Assisted Solution

by:guru_sami
guru_sami earned 400 total points
ID: 23652047
looks good ..had some problem ... part of your code is shown below with changes in bold:

private string firstname = string.Empty;
    public string FirstName
    {
        get { return firstname; }
        set { firstname = value; }
    }

    private string lastname = string.Empty;
    public string LastName
    {
        get { return lastname; }
        set { lastname = value; }
    }

    private DateTime dob = DateTime.Now;
    public DateTime DOB
    {
        get { return dob; }
        set { dob = value; }
    }

    private int age = 0;
    public int Age
    {
        get { return age; }
        set { age = value; }
    }

    private string gender = string.Empty;
    public string Gender
    {
        get { return gender; }
        set { gender = value; }
    }

    private string seeking = string.Empty;
    public string Seeking
    {
        get { return seeking; }
        set { seeking = value; }
    }

    private string confirmationguid = string.Empty;
    public string ConfirmationGUID
    {
        get { return confirmationguid; }
        set { confirmationguid = value; }

    }

    private string userip = string.Empty;
    public string UserIP
    {
        get { return userip; }
        set { userip = value; }
    }

    private string sessionid = string.Empty;
    public string SessionID
    {
        get { return sessionid; }
        set { sessionid = value; }

    }

//Also just wondering if you want your ConfirmationGuid of type string or Guid...depending if you are storing in DB.


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mathieu_cupryk
ID: 23652153
also what do I need to assign the dob = ????

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


/// <summary>
/// Summary description for Personal
/// </summary>
[Serializable()]
public class Personal
{
    public Personal() { }

    public Personal

        (
         string username,
         string password,
         string email,
         string firstname,
         string lastname,
         DateTime dob,
         int age,
         string gender,
         string seeking,
         string confirmationguid,
         string userid,
         string sessionid)
    {
        this.UserName = username;
        this.Password = password;
        this.Email = email;
        this.FirstName = firstname;
        this.LastName = lastname;
        this.DOB = dob;
        this.Age = age;
        this.Gender = gender;
        this.Seeking = seeking;
        this.ConfirmationGUID = confirmationguid;
        this.UserIP = userip;
        this.SessionID = sessionid;
    }    

    private string username = string.Empty;
    public string UserName
    {
         get { return username;}
         set { username = value;}
    }

    private string password = string.Empty;
    public string Password
    {
        get { return password;}
        set { password = value;}
    }

    private string email = string.Empty;
    public string Email
    {
        get { return email;}
        set { email = value;}
    }

    private string firstname = string.Empty;
    public string FirstName
    {
        get { return firstname; }
        set { firstname = value; }
    }

    private string lastname = string.Empty;
    public string LastName
    {
        get { return lastname; }
        set { lastname = value; }
    }

    private DateTime dob = DateTime.Now;
    public DateTime DOB
    {
        get { return dob; }
        set { dob = value; }
    }

    private int age = 0;
    public int Age
    {
        get { return age; }
        set { age = value; }
    }  

    private string gender = string.Empty;
    public string Gender
    {
        get { return gender; }
        set { gender = value; }  
    }

    private string seeking = string.Empty;
    public string Seeking
    {
        get { return seeking; }
        set { seeking = value; }
    }

    private string confirmationguid = string.Empty;
    public string ConfirmationGUID
    {
        get { return confirmationguid; }
        set { confirmationguid = value; }
 
    }
 
    private string userip = string.Empty;
    public string UserIP
    {
        get { return userip; }
        set { userip = value; }
    }

    private string sessionid = string.Empty;
    public string SessionID
    {
        get { return sessionid; }
        set { sessionid = value; }

    }
   
}

and i think in 3.5 we can do a get set in less code.
0
 
LVL 27

Expert Comment

by:nmarun
ID: 23652177
You have to pass a DateTime parameter.
0
 
LVL 10

Assisted Solution

by:jabcoco
jabcoco earned 600 total points
ID: 23652268
To avoid multiples syntax error possibility (like i can see) use my solution if using .net 3.5.

You don't need to declare a private variable until you need to manipulate this variable in the "set" or "get" action.
0
 
LVL 16

Assisted Solution

by:sunithnair
sunithnair earned 1000 total points
ID: 23652325
You can also assign dob as DateTime.MinValue so that you can identify that it is a default value
private DateTime dob = DateTime.MinValue;

Open in new window

0
 

Author Comment

by:mathieu_cupryk
ID: 23654526
jacob can u fix this?
0
 

Author Comment

by:mathieu_cupryk
ID: 23654571
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


/// <summary>
/// Summary description for Personal
/// </summary>
[Serializable()]
public class Personal
{
    public Personal() { }

    public Personal

        (
         string username,
         string password,
         string email,
         string firstname,
         string lastname,
         DateTime dob,
         int age,
         string gender,
         string seeking,
         string confirmationguid,
         string userid,
         string sessionid)
    {
        this.UserName = username;
        this.Password = password;
        this.Email = email;
        this.FirstName = firstname;
        this.LastName = lastname;
        this.DOB = dob;
        this.Age = age;
        this.Gender = gender;
        this.Seeking = seeking;
        this.ConfirmationGUID = confirmationguid;
        this.UserIP = userip;
        this.SessionID = sessionid;
    }    

    private string username = string.Empty;
    public string UserName { get; set; }

    private string password = string.Empty;
    public string Password { get; set; }

    private string email = string.Empty;
    public string Email { get; set; }

    private string firstname = string.Empty;
    public string FirstName { get; set; }

    private string lastname = string.Empty;
    public string LastName { get; set; }

    private DateTime dob = DateTime.MinValue;
    public DateTime DOB { get; set; }
 
    private int age = 0;
    public int Age { get; set; }
   
    private string gender = string.Empty;
    public string Gender { get; set; }
   
    private string seeking = string.Empty;
    public string Seeking { get; set; }

    private string confirmationguid = string.Empty;
    public string ConfirmationGUID { get; set; }
   
    private string userip = string.Empty;
    public string UserIP { get; set; }
   
    private string sessionid = string.Empty;
    public string SessionID { get; set; }
   
}
0
 
LVL 27

Expert Comment

by:nmarun
ID: 23654582

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
 
 
/// <summary>
/// Summary description for Personal
/// </summary>
[Serializable()]
public class Personal
{
    public Personal() { }
 
    public Personal
 
        (
         string username,
         string password,
         string email,
         string firstname,
         string lastname,
         DateTime dob,
         int age,
         string gender,
         string seeking,
         string confirmationguid,
         string userid,
         string sessionid)
    {
        this.UserName = username;
        this.Password = password;
        this.Email = email;
        this.FirstName = firstname;
        this.LastName = lastname;
        this.DOB = dob;
        this.Age = age;
        this.Gender = gender;
        this.Seeking = seeking;
        this.ConfirmationGUID = confirmationguid;
        this.UserIP = userip;
        this.SessionID = sessionid;
    }    
 
    public string UserName { get; set; }
 
    public string Password { get; set; }
 
    public string Email { get; set; }
 
    public string FirstName { get; set; }
 
    public string LastName { get; set; }
 
    public DateTime DOB { get; set; }
 
    public int Age { get; set; }
   
    public string Gender { get; set; }
   
    public string Seeking { get; set; }
 
    public string ConfirmationGUID { get; set; }
   
    public string UserIP { get; set; }
   
    public string SessionID { get; set; }
   
}

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question