1

I am confused with the following issue:

The data I get looks like this:

emailadress       value1    value2 
test@test.com     Hello     Hello 
test@test.com     Hello     Hello 
test@test.com     Hello     Hello
newuser@new.com   Hy        Hello

I have tried the following so far:

I made a List and a Dictionary, but so far unfortunately not working. Email gets sent to all user(Simulation) with same content.

So User: test@test.com gets following: Hello+Hello Hello+Hello Hello+Hello + Hy+Hello <- wrong and same for user newuser@new.com

Update: Here is Code:

ErrorData Class

public class ErrorListData
    {

        public string mailadress;
        public string queryName;
        public string queryDesc;
        public string todo;
        public string key;
        public string link;


    }

The Data i get:

string errordataKey = rs.Fields[2].Value.ToString();
                        string errordatalink = fileName;
                        string errordatamailadress = rs.Fields[3].Value.ToString();
                        string errordataqueryDesc = rs.Fields[6].Value.ToString();
                        string errordataqueryName = rs.Fields[5].Value.ToString();
                        string errordatatodo = rs.Fields[7].Value.ToString();

How i add:

this.errorData.Add(new ErrorListData
                        { key= errordataKey, link= errordatalink, mailadress= errordatamailadress,
                        queryDesc=errordataqueryDesc, queryName= errordataqueryName
                        , todo= errordatatodo
                        });

And how i go throw them:

var distinctItems = errorData.GroupBy(c => new { c.mailadress })
                     .Select(c => c.First()).ToList();


        foreach (var item in distinctItems)
        {
            Logger.Debug("In Distinc Items:"+item.mailadress);
            Logger.Debug("In Distinc Items:" + item.queryDesc);
            Logger.Debug("In Distinc Items:" + item.queryName);
            Logger.Debug("In Distinc Items:" + item.todo);
        }
Erik Philips
  • 53,428
  • 11
  • 128
  • 150
wyde
  • 11
  • 2

0 Answers0