Exemple #1
0
        private object getConvertedDatatable(DataTable data, Type returnType)
        {
            if (data.Rows.Count == 0)
            {
                return(null);
            }

            object convertedDatatable = null;

            if (returnType == typeof(MemberPreferencesDTO))
            {
                MemberPreferencesDTO enMemberPreferences = new MemberPreferencesDTO();

                enMemberPreferences.memberId    = (int)data.Rows[0]["id"];
                enMemberPreferences.realName    = (string)data.Rows[0]["realName"];
                enMemberPreferences.displayName = (string)data.Rows[0]["displayName"];
                enMemberPreferences.email       = (string)data.Rows[0]["email"];

                convertedDatatable = enMemberPreferences;
            }
            else if (returnType == typeof(LanguagePreferencesDTO))
            {
                LanguagePreferencesDTO enLanguagePreferences = new LanguagePreferencesDTO();

                enLanguagePreferences.memberId = (int)data.Rows[0]["id"];
                enLanguagePreferences.language = (string)data.Rows[0]["language"];

                convertedDatatable = enLanguagePreferences;
            }

            return(convertedDatatable);
        }
 public void updateMemberPreferences(MemberPreferencesDTO memberPreferences)
 {
     try
     {
         preferencesDAO.updateMemberPreferences(memberPreferences);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
        protected void cmdEditPreferences_Click(object sender, EventArgs e)
        {
            try
            {
                PreferencesService   preferencesService  = new PreferencesService(SessionManager.sessionMemberInfo);
                MemberPreferencesDTO enMemberPreferences = new MemberPreferencesDTO();

                enMemberPreferences.memberId    = SessionManager.sessionMemberInfo.id;
                enMemberPreferences.realName    = txtRealName.Text;
                enMemberPreferences.displayName = txtDisplayName.Text;

                preferencesService.updateMemberPreferences(enMemberPreferences);
                InfoMessage.setMessage(HttpContext.GetGlobalResourceObject("Resource", "PreferenciasActualizadas").ToString(), Enums.infoMessageType.Success);
                loadPreferences();
            }
            catch (Exception)
            {
                showError(HttpContext.GetGlobalResourceObject("Resource", "ErrorGeneral").ToString());
            }
        }
Exemple #4
0
        public void updateMemberPreferences(MemberPreferencesDTO memberPreferences)
        {
            string sqlSentence = "";

            try
            {
                sqlSentence += "UPDATE members SET ";
                sqlSentence += "members.realName = @realName, ";
                sqlSentence += "members.displayName = @displayName ";
                sqlSentence += "WHERE members.id = @memberId ";

                List <SqlParameter> sqlParameters = new List <SqlParameter>();
                sqlParameters.Add(new SqlParameter("@realName", memberPreferences.realName));
                sqlParameters.Add(new SqlParameter("@displayName", memberPreferences.displayName));
                sqlParameters.Add(new SqlParameter("@memberId", memberInfo.id));

                dbWrapper.UpdateDelete(sqlSentence, sqlParameters);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        private void loadPreferences()
        {
            try
            {
                PreferencesService   preferencesService = new PreferencesService(SessionManager.sessionMemberInfo);
                MemberPreferencesDTO memberPreferences  = preferencesService.getMemberPreferences();

                if (memberPreferences != null)
                {
                    txtEmail.Text       = memberPreferences.email;
                    txtRealName.Text    = memberPreferences.realName;
                    txtDisplayName.Text = memberPreferences.displayName;
                }
                else
                {
                    showError(HttpContext.GetGlobalResourceObject("Resource", "ErrorGeneral").ToString());
                }
            }
            catch (Exception)
            {
                showError(HttpContext.GetGlobalResourceObject("Resource", "ErrorGeneral").ToString());
            }
        }