Esempio n. 1
0
        public SimpleOperationModel AddPersonNickname(PersonEN pPerson, string pNickname)
        {
            SimpleOperationModel result = new SimpleOperationModel();

            result.Message = "error";
            result.Result  = false;

            try
            {
                var profile = personDAL.GetGamerProfileByNickname(pNickname);

                if (profile == null)
                {
                    profile          = new GamerProfileEN();
                    profile.Nickname = pNickname;
                    profile.PersonID = pPerson.PersonID;
                    profile.RegDate  = DateTime.Now;

                    if (personDAL.InsertGamerProfile(profile) > 0)
                    {
                        result.Result  = true;
                        result.Message = "inserted";
                    }
                }
                else
                {
                    result.Result  = false;
                    result.Message = "conflict";
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException);
                EventViewerLoggerBL.LogError("AddPersonNickname: " + ex.Message);
            }

            return(result);
        }