Ejemplo n.º 1
0
 protected void CreatePlayerInCampaign(int UserID, int CampaignID)
 {
     Classes.cUserCampaign UserCampaign = new Classes.cUserCampaign();
     UserCampaign.CampaignPlayerID = -1;
     UserCampaign.CampaignID       = CampaignID;
     UserCampaign.Save(UserID);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// This will load the details of a particular users' campaigns
        /// Must pass a UserID
        /// </summary>
        public void Load(int UserID)
        {
            string stStoredProc    = "uspGetMyCampaigns";
            string stCallingMethod = "cUserCampaigns.Load";
            int    iTemp;

            CountOfUserCampaigns = 0;
            SortedList slParameters = new SortedList();

            slParameters.Add("@UserID", UserID);
            slParameters.Add("@CampaignID", 0); // Returning all campaigns
            DataSet dsUserCampaigns = new DataSet();

            dsUserCampaigns = cUtilities.LoadDataSet(stStoredProc, slParameters, "LARPortal", UserID.ToString(), stCallingMethod);
            foreach (DataRow dRow in dsUserCampaigns.Tables[0].Rows)
            {
                if (int.TryParse(dRow["CampaignID"].ToString(), out iTemp))
                {
                    cUserCampaign UserCampaign = new cUserCampaign();
                    UserCampaign.Load(UserID, iTemp);
                    lsUserCampaigns.Add(UserCampaign);
                    CountOfUserCampaigns++;
                }
            }
        }
Ejemplo n.º 3
0
        protected void SignUpForSelectedRole(int RoleToSignUp, int UserID, int CampaignID, int StatusID)
        {
            int    CampaignPlayerID = 0;
            string Username         = "";

            if (Session["Username"] == null)
            {
                Username = "";
            }
            else
            {
                Username = Session["Username"].ToString();
            }
            Classes.cUserCampaign CampaignPlayer = new Classes.cUserCampaign();
            CampaignPlayer.Load(UserID, CampaignID);
            CampaignPlayerID = CampaignPlayer.CampaignPlayerID; // if this comes back empty (-1) make one
            if (CampaignPlayerID == -1)
            {
                CreatePlayerInCampaign(UserID, CampaignID);
                CampaignPlayer.Load(UserID, CampaignID);
                CampaignPlayerID = CampaignPlayer.CampaignPlayerID;
            }
            int RoleAlignment = 2;

            if (RoleToSignUp == 8)
            {
                RoleAlignment = 1;
            }
            Classes.cPlayerRole PlayerRole = new Classes.cPlayerRole();
            PlayerRole.CampaignPlayerRoleID = -1;
            PlayerRole.CampaignPlayerID     = CampaignPlayerID;
            PlayerRole.RoleID          = RoleToSignUp;
            PlayerRole.RoleAlignmentID = RoleAlignment;
            PlayerRole.Save(UserID);
            if (Username != "")
            {
                Classes.cUser LastLogged   = new Classes.cUser(Username, "Password");
                string        LastCampaign = LastLogged.LastLoggedInCampaign.ToString();
                if (LastCampaign == null || LastCampaign == "0")
                {
                    LastLogged.LastLoggedInCampaign = CampaignID;
                    LastLogged.Save();
                    Session["CampaignID"] = CampaignID;
                }
            }
        }