public static string GetToKen(string session)
        {
            ApiContext     context = AppSettingHelper.GetGenericApiContext("US");
            FetchTokenCall call    = new FetchTokenCall(context);

            return(call.FetchToken(session));
        }
        public static string GetSessionID()
        {
            ApiContext       context = AppSettingHelper.GetGenericApiContext("US");
            GetSessionIDCall calla   = new GetSessionIDCall(context);

            return(calla.GetSessionID(context.RuName));
        }
Example #3
0
        public static void Upload(AccountType account, ISession NSession)
        {
            ApiContext context = AppSettingHelper.GetGenericApiContext("US");

            context.ApiCredential.eBayToken = account.ApiToken;
            AddMemberMessageRTQCall   addMsgApicall = new AddMemberMessageRTQCall(context);
            ReviseMyMessagesCall      revMsgApicall = new ReviseMyMessagesCall(context);
            IList <EbayMessageReType> list          = NSession.CreateQuery("from EbayMessageReType where IsUpload<>'1'").List <EbayMessageReType>();

            if (list.Count != 0)
            {
                foreach (var item in list)
                {
                    MemberMessageType mm = new MemberMessageType();
                    mm.SenderID        = item.SenderID;
                    mm.SenderEmail     = item.SenderEmail;
                    mm.MessageID       = item.EbayId;
                    mm.Body            = item.BodyRe;
                    mm.ParentMessageID = item.EbayId;

                    addMsgApicall.AddMemberMessageRTQ(item.ItemId, mm);
                    revMsgApicall.ReviseMyMessages(true, false, new StringCollection(new string[] { mm.MessageID }));

                    item.IsUpload = 1;
                }
            }
        }
Example #4
0
        public static void GetEmailByAPI(AccountType account, DateTime beginDate, DateTime endDate, ISession NSession)
        {
            ApiContext context = AppSettingHelper.GetGenericApiContext("US");

            context.ApiCredential.eBayToken = account.ApiToken;
            GetMemberMessagesCall apicall = new GetMemberMessagesCall(context);

            apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            TimeFilter fltr = new TimeFilter();

            fltr.TimeFrom = beginDate;
            fltr.TimeTo   = endDate;
            MemberMessageExchangeTypeCollection messages;
            int i = 1;

            do
            {
                apicall.Pagination                = new eBay.Service.Core.Soap.PaginationType();
                apicall.Pagination.PageNumber     = i;
                apicall.Pagination.EntriesPerPage = 100;
                messages = apicall.GetMemberMessages(fltr, MessageTypeCodeType.All, MessageStatusTypeCodeType.Unanswered);

                for (int k = 0; k < messages.Count; k++)
                {
                    MemberMessageExchangeType mmet  = messages[k];
                    EbayMessageType           email = new EbayMessageType();

                    email.Body          = mmet.Question.Body;
                    email.CreationDate  = mmet.CreationDate;
                    email.MessageId     = mmet.Question.MessageID;
                    email.MessageStatus = "未回复";
                    email.MessageType   = MessageType(mmet.Question.MessageType.ToString());
                    email.SenderEmail   = mmet.Question.SenderEmail;
                    email.SenderID      = mmet.Question.SenderID;
                    email.Subject       = mmet.Question.Subject;
                    if (mmet.Item != null)
                    {
                        email.ItemId = mmet.Item.ItemID;
                        email.Title  = mmet.Item.Title;
                    }
                    email.Shop     = mmet.Question.RecipientID[0];
                    email.CreateOn = DateTime.Now;
                    email.ReplayOn = Convert.ToDateTime("2000-01-01");
                    if (HasExist(email.MessageId, NSession))
                    {
                    }
                    else
                    {
                        NSession.Save(email);
                        NSession.Flush();
                    }
                }
                i++;
            } while (messages != null && messages.Count == 100);
        }