示例#1
0
    //to insert the Camper Info to the database
    protected void ProcessCamperInfo(UserDetails UInfo)
    {
        int            Rowsaffected;
        string         strCamperLoginId = "", strFJCID, Action;
        Administration objAdmin = new Administration();

        Action = hdnPerformAction.Value;

        //*********************************
        //for backward comarability purpose
        //*********************************
        if (UInfo.Gender != null)
        {
            if (Convert.ToInt32(UInfo.Gender) <= 0)
            {
                UInfo.Gender = null;
            }
        }
        else
        {
            UInfo.Gender = null;
        }


        try
        {
            if ((UInfo.FirstName != "" || UInfo.LastName != "") && bPerformUpdate)
            {
                if (Action == "INSERT")
                {
                    if (!string.IsNullOrEmpty(UInfo.ModifiedBy))
                    {
                        Rowsaffected = CamperAppl.InsertCamperInfo(UInfo, out strFJCID);
                        if (Session["CamperLoginID"] != null)
                        {
                            strCamperLoginId = Session["CamperLoginID"].ToString();
                        }

                        //to set the Camper Id with the FederationId
                        if (strCamperLoginId != "" && strFJCID != "")
                        {
                            objAdmin.LinkFJCIDsCamper(Convert.ToInt32(strCamperLoginId), strFJCID);
                        }

                        //getting the FJCID from the table after performing insert
                        hdnFJCID.Value = strFJCID;
                    }
                }
                else if (Action == "UPDATE" && !string.IsNullOrEmpty(UInfo.FJCID) && !string.IsNullOrEmpty(UInfo.ModifiedBy))
                {
                    Rowsaffected = CamperAppl.UpdateCamperInfo(UInfo);
                }
            }
        }
        finally
        {
            objAdmin = null;
        }
    }