Click here to Skip to main content
15,887,371 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Special Characters using a label Pin
T M Gray17-Sep-10 6:29
T M Gray17-Sep-10 6:29 
AnswerRe: Special Characters using a label Pin
Yusuf17-Sep-10 17:53
Yusuf17-Sep-10 17:53 
GeneralRe: Special Characters using a label Pin
CodeScribbler18-Sep-10 1:50
CodeScribbler18-Sep-10 1:50 
QuestionCheck in and Check out for folders Pin
Satish_S16-Sep-10 23:26
Satish_S16-Sep-10 23:26 
AnswerRe: Check in and Check out for folders Pin
David Mujica17-Sep-10 3:26
David Mujica17-Sep-10 3:26 
AnswerRe: Check in and Check out for folders Pin
T M Gray17-Sep-10 6:38
T M Gray17-Sep-10 6:38 
QuestionWhich version ODP.net is exactly required for oracle 11.2 and .net 2.0? Pin
padmanabhan N16-Sep-10 20:44
padmanabhan N16-Sep-10 20:44 
QuestionAnalysing sample program Pin
future383916-Sep-10 17:54
future383916-Sep-10 17:54 
Hi,I am following a sample project. but I don't understand some code of this program.Could you please help me. I put comment in front of lines.


Business Object Layer
[DataObjectFieldAttribute(true, true, false)] why use this line?

public int Id
    {
      get
      {
        return id;
      }
      set
      {
        id = value;
      }
    }

    
    public string FirstName
    {
      get
      {
        return firstName;
      }
      set
      {
        firstName = value;
      }
    }

    public string MiddleName
    {
      get
      {
        return middleName;
      }
      set
      {
        middleName = value;
      }
    }
    public string LastName
    {
      get
      {
        return lastName;
      }
      set
      {
        lastName = value;
      }
    }

    public DateTime DateOfBirth
    {
      get
      {
        return dateOfBirth;
      }
      set
      {
        dateOfBirth = value;
      }
    }

    public PersonType Type
    {
      get
      {
        return type;
      }
      set
      {
        type = value;
      }
    }

    public string FullName
    {
      get
      {
        string tempValue = firstName;
        if (!String.IsNullOrEmpty(middleName))
        {
          tempValue += " " + middleName;
        }
        tempValue += " " + lastName;
        return tempValue;
      }
    }

    public AddressList Addresses
    {
      get
      {
        return addresses;
      }
      set
      {
        addresses = value;
      }
    }

    public PhoneNumberList PhoneNumbers
    {
      get
      {
        return phoneNumbers;
      }
      set
      {
        phoneNumbers = value;
      }
    }

    public EmailAddressList EmailAddresses
    {
      get
      {
        return emailAddresses;
      }
      set
      {
        emailAddresses = value;
      }
    }
    #endregion

  }
}
 

Business Logic Layer
[DataObjectMethod(DataObjectMethodType.Update, true)] why use this line?
    public static int Save(ContactPerson myContactPerson)
    {
      using (TransactionScope myTransactionScope = new TransactionScope())
      {
        int contactPersonId = ContactPersonDB.Save(myContactPerson); why use this line?

        foreach (Address myAddress in myContactPerson.Addresses) why use this line?
        {
          myAddress.ContactPersonId = contactPersonId; why use this line?
          AddressDB.Save(myAddress); why use this line?
        }

        foreach (EmailAddress myEmailAddress in myContactPerson.EmailAddresses)
        {
          myEmailAddress.ContactPersonId = contactPersonId;
          EmailAddressDB.Save(myEmailAddress);
        }

        foreach (PhoneNumber myPhoneNumber in myContactPerson.PhoneNumbers)
        {
          myPhoneNumber.ContactPersonId = contactPersonId;
          PhoneNumberDB.Save(myPhoneNumber);
        }

        //  Assign the ContactPerson its new (or existing ID).
        myContactPerson.Id = contactPersonId;

        myTransactionScope.Complete();

        return contactPersonId;
      }
    }

 

Data Access Layer
public static int Save(ContactPerson myContactPerson)
    {
      int result = 0;
      using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
      {
        SqlCommand myCommand = new SqlCommand("sprocContactPersonInsertUpdateSingleItem", myConnection);
        myCommand.CommandType = CommandType.StoredProcedure;

        if (myContactPerson.Id == -1)
        {
          myCommand.Parameters.AddWithValue("@id", DBNull.Value);
        }
        else
        {
          myCommand.Parameters.AddWithValue("@id", myContactPerson.Id);
        }

        myCommand.Parameters.AddWithValue("@firstName", myContactPerson.FirstName);
        myCommand.Parameters.AddWithValue("@lastName", myContactPerson.LastName);
        if (String.IsNullOrEmpty(myContactPerson.MiddleName))
        {
          myCommand.Parameters.AddWithValue("@middleName", DBNull.Value);
        }
        else
        {
          myCommand.Parameters.AddWithValue("@middleName", myContactPerson.MiddleName);
        }
        myCommand.Parameters.AddWithValue("@dateOfBirth", myContactPerson.DateOfBirth);
        myCommand.Parameters.AddWithValue("@contactpersonType", myContactPerson.Type);

        DbParameter returnValue;
        returnValue = myCommand.CreateParameter();
        returnValue.Direction = ParameterDirection.ReturnValue;
        myCommand.Parameters.Add(returnValue);

        myConnection.Open();
        myCommand.ExecuteNonQuery();
        result = Convert.ToInt32(returnValue.Value);
        myConnection.Close();
      }
      return result;
    }

AnswerRe: Analysing sample program Pin
Yusuf17-Sep-10 18:00
Yusuf17-Sep-10 18:00 
Questionhow to get Ranked?! Pin
Jassim Rahma16-Sep-10 12:24
Jassim Rahma16-Sep-10 12:24 
AnswerRe: how to get Ranked?! Pin
Arun Jacob16-Sep-10 23:41
Arun Jacob16-Sep-10 23:41 
AnswerRe: how to get Ranked?! Pin
raju melveetilpurayil17-Sep-10 10:31
professionalraju melveetilpurayil17-Sep-10 10:31 
AnswerRe: how to get Ranked?! Pin
Keith Barrow21-Sep-10 6:17
professionalKeith Barrow21-Sep-10 6:17 
Questionhow to trap a Enter Key from the Server Side Pin
Vimalsoft(Pty) Ltd16-Sep-10 10:19
professionalVimalsoft(Pty) Ltd16-Sep-10 10:19 
AnswerRe: how to trap a Enter Key from the Server Side Pin
David Mujica16-Sep-10 10:46
David Mujica16-Sep-10 10:46 
AnswerRe: how to trap a Enter Key from the Server Side Pin
T M Gray17-Sep-10 6:40
T M Gray17-Sep-10 6:40 
AnswerRe: how to trap a Enter Key from the Server Side Pin
Yusuf17-Sep-10 18:03
Yusuf17-Sep-10 18:03 
QuestionCheck Chackbox in repeater Pin
polycom12316-Sep-10 3:35
polycom12316-Sep-10 3:35 
AnswerRe: Check Chackbox in repeater Pin
polycom12316-Sep-10 3:51
polycom12316-Sep-10 3:51 
GeneralRe: Check Chackbox in repeater Pin
T M Gray16-Sep-10 8:48
T M Gray16-Sep-10 8:48 
Questionconfigure 'Impersonation' in IIS Pin
Manas Bhardwaj16-Sep-10 3:21
professionalManas Bhardwaj16-Sep-10 3:21 
AnswerRe: configure 'Impersonation' in IIS Pin
T M Gray16-Sep-10 8:44
T M Gray16-Sep-10 8:44 
QuestionMigration from Oracle 9i to Oracle 11.2 Pin
padmanabhan N16-Sep-10 3:04
padmanabhan N16-Sep-10 3:04 
AnswerRe: Migration from Oracle 9i to Oracle 11.2 Pin
m@dhu16-Sep-10 3:18
m@dhu16-Sep-10 3:18 
AnswerRe: Migration from Oracle 9i to Oracle 11.2 Pin
David Mujica16-Sep-10 3:30
David Mujica16-Sep-10 3:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.