Ejemplo n.º 1
0
    //to post the parent info to the database
    protected void ProcessParentInfoValues()
    {
        int    Rowsaffected;
        string strActiontobePerformed, strComments;

        //PARENT 1 INFO

        //to get the comments value
        strComments            = txtComments.Text.Trim();
        strActiontobePerformed = hdnPerformAction.Value;

        //to get the parent 1 info
        UserInfo = new UserDetails();
        UserInfo = ConstructParentInfo("1"); //for parent 1 info
        if (UserInfo.FirstName != "" || UserInfo.LastName != "")
        {
            if (strActiontobePerformed == "INSERT")
            {
                //to insert the parent 1 info to the table
                Rowsaffected = CamperAppl.InsertParentInfo(UserInfo);
            }
            else if (strActiontobePerformed == "UPDATE" && bPerformUpdate) //UPDATE
            {
                Rowsaffected = CamperAppl.UpdateParentInfo(UserInfo);
            }
        }
        //END OF PARENT 1 INFO


        //PARENT 2 INFO

        //to get the parent 2 info
        UserInfo = new UserDetails();
        UserInfo = ConstructParentInfo("2"); //for parent 2 info
        //if (UserInfo.FirstName != "" || UserInfo.LastName != "")
        //{
        if (strActiontobePerformed == "INSERT")
        {
            //to insert the parent 2 info to the table
            Rowsaffected = CamperAppl.InsertParentInfo(UserInfo);
        }
        else if (strActiontobePerformed == "UPDATE" && string.IsNullOrEmpty(UserInfo.Parent2Id))//If Parent2 info is not present, insert the same else update it
        {
            Rowsaffected = CamperAppl.InsertParentInfo(UserInfo);
        }
        else if (strActiontobePerformed == "UPDATE" && bPerformUpdate)
        {
            Rowsaffected = CamperAppl.UpdateParentInfo(UserInfo);
        }
        //END OF PARENT 2 INFO
        //}
    }