Esempio n. 1
0
        private void LoadAffiliations(DataTable dtAffiliations)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            try
            {
                foreach (DataRow ldr in dtAffiliations.Rows)
                {
                    cPlayerAffiliation cAdd = new
                                              cPlayerAffiliation
                    {
                        AffiliationName = ldr["AffiliationName"].ToString(),
                        AffiliationRole = ldr["AffiliationRole"].ToString(),
                        PlayerComments  = ldr["PlayerComments"].ToString(),
                        Comments        = ldr["Comments"].ToString(),
                        RecordStatus    = RecordStatuses.Active
                    };
                    int iTemp;

                    if (int.TryParse(ldr["PlayerProfileID"].ToString(), out iTemp))
                    {
                        cAdd.PlayerProfileID = iTemp;
                    }
                    if (int.TryParse(ldr["PlayerAffiliationID"].ToString(), out iTemp))
                    {
                        cAdd.PlayerAffiliationID = iTemp;
                    }

                    PlayerAffiliations.Add(cAdd);
                }
            }
            catch (Exception ex)
            {
                ErrorAtServer lobjError = new ErrorAtServer();
                lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName);
            }
        }
Esempio n. 2
0
        public void Load(string UserName, Int32 intUserID)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            SortedList slParams = new SortedList(); // I use a sortedlist  wich is a C# hash table to store the paramter and value

            slParams.Add("@PlayerResumeID", PlayerProfileID);
            try
            {
                DataSet ldsPlayerInfo = cUtilities.LoadDataSet("uspGetPlayerResumeByID", slParams, "LARPortal", UserName, lsRoutineName);
                if (ldsPlayerInfo.Tables[0].Rows.Count > 0)
                {
                    PlayerComments = ldsPlayerInfo.Tables[0].Rows[0]["ResumeContents"].ToString();
                }

                PlayerSkills = new List <cPlayerSkill>();

                foreach (DataRow dRow in ldsPlayerInfo.Tables[1].Rows)
                {
                    cPlayerSkill NewSkill = new cPlayerSkill
                    {
                        SkillName      = dRow["SkillName"].ToString(),
                        SkillLevel     = dRow["SkillLevel"].ToString(),
                        PlayerComments = dRow["PlayerComments"].ToString()
                    };

                    NewSkill.PlayerProfileID = PlayerProfileID;

                    int iTemp;
                    if (int.TryParse(dRow["'PlayerSkillID"].ToString(), out iTemp))
                    {
                        NewSkill.PlayerSkillID = iTemp;
                    }

                    PlayerSkills.Add(NewSkill);
                }

                PlayerAffiliations = new List <cPlayerAffiliation>();

                foreach (DataRow dRow in ldsPlayerInfo.Tables[2].Rows)
                {
                    cPlayerAffiliation NewAffil = new cPlayerAffiliation
                    {
                        AffiliationName = dRow["AffiliationName"].ToString(),
                        AffiliationRole = dRow["AffiliationRole"].ToString(),
                        PlayerComments  = dRow["PlayerComments"].ToString(),
                        Comments        = dRow["Comments"].ToString()
                    };

                    NewAffil.PlayerProfileID = PlayerProfileID;

                    int iTemp;
                    if (int.TryParse(dRow["'PlayerAffiliationID"].ToString(), out iTemp))
                    {
                        NewAffil.PlayerAffiliationID = iTemp;
                    }

                    PlayerAffiliations.Add(NewAffil);
                }
            }
            catch (Exception ex)
            {
                ErrorAtServer lobjError = new ErrorAtServer();
                lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName);
            }
        }