Example #1
0
        public U_Profile Get(string uid, EnmProfile type)
        {
            SqlParameter[] parms = { new SqlParameter("@UserId", SqlDbType.VarChar, 100),
                                     new SqlParameter("@Type",   SqlDbType.Int) };

            parms[0].Value = SqlTypeConverter.DBNullStringChecker(uid);
            parms[1].Value = (int)type;

            U_Profile entity = null;

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Sc.Sql_U_Profile_Repository_GetProfile, parms)) {
                if (rdr.Read())
                {
                    entity = new U_Profile {
                        UserId          = SqlTypeConverter.DBNullStringHandler(rdr["UserId"]),
                        Type            = SqlTypeConverter.DBNullProfileHandler(rdr["Type"]),
                        ValuesJson      = SqlTypeConverter.DBNullStringHandler(rdr["ValuesJson"]),
                        ValuesBinary    = SqlTypeConverter.DBNullBytesHandler(rdr["ValuesBinary"]),
                        LastUpdatedDate = SqlTypeConverter.DBNullDateTimeHandler(rdr["LastUpdatedDate"])
                    };
                }
            }

            return(entity);
        }
Example #2
0
        public void Delete(string uid, EnmProfile type)
        {
            SqlParameter[] parms = { new SqlParameter("@UserId", SqlDbType.VarChar, 100),
                                     new SqlParameter("@Type",   SqlDbType.Int) };

            parms[0].Value = SqlTypeConverter.DBNullStringChecker(uid);
            parms[1].Value = (int)type;

            using (var conn = new SqlConnection(this._databaseConnectionString)) {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                var trans = conn.BeginTransaction(IsolationLevel.ReadCommitted);
                try {
                    SqlHelper.ExecuteNonQuery(trans, CommandType.Text, SqlCommands_Sc.Sql_U_Profile_Repository_Delete, parms);
                    trans.Commit();
                } catch {
                    trans.Rollback();
                    throw;
                }
            }
        }
Example #3
0
 public void RemoveProfile(string uid, EnmProfile type)
 {
     _repository.Delete(uid, type);
 }
Example #4
0
 public U_Profile GetProfile(string uid, EnmProfile type)
 {
     return(_repository.Get(uid, type));
 }