Ejemplo n.º 1
0
        private void SendCatalogRequest()
        {
            try
            {
                // Delete all previous content requests
                FoeClientRequest.DeleteOldRequest(_requestInterval);

                // Create Foe Message
                string requestId = FoeClientRequest.GenerateId();

                FoeClientMessage.SendMessage(
                    FoeClientMessage.GetSmtpServer(),
                    FoeClientRegistry.GetEntry("useremail").Value,
                    FoeClientRegistry.GetEntry("processoremail").Value,
                    SubjectGenerator.RequestSubject(RequestType.Catalog, requestId, FoeClientRegistry.GetEntry("userid").Value),
                    "");

                // save requestid to DB
                FoeClientRequestItem reqItem = new FoeClientRequestItem();
                reqItem.Id          = requestId;
                reqItem.Type        = "catalog";
                reqItem.DtRequested = DateTime.Now;
                FoeClientRequest.Add(reqItem);

                // remember when the request was sent
                _lastRequestSent = DateTime.Now;
                // Set status
                tssStatus.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " requested catalog.";
            }
            catch (Exception)
            {
                tssStatus.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " error sending request.";
            }
        }
Ejemplo n.º 2
0
        private void SendSubscriptionRequest()
        {
            try
            {
                // Delete all previous content requests
                FoeClientRequest.DeleteOldRequest(_requestInterval);

                // Create Foe Message
                string catalogs = "";
                List <FoeClientCatalogItem> catalog = FoeClientCatalog.GetAll();
                if (catalog.Count == 0)
                {
                    return;
                }
                foreach (FoeClientCatalogItem item in catalog)
                {
                    if (item.IsSubscribed)
                    {
                        catalogs += item.Code + ",";
                    }
                }
                string requestId = FoeClientRequest.GenerateId();

                FoeClientMessage.SendMessage(
                    FoeClientMessage.GetSmtpServer(),
                    FoeClientRegistry.GetEntry("useremail").Value,
                    FoeClientRegistry.GetEntry("processoremail").Value,
                    SubjectGenerator.RequestSubject(RequestType.Content, requestId, FoeClientRegistry.GetEntry("userid").Value),
                    catalogs);

                // save requestid to DB
                FoeClientRequestItem reqItem = new FoeClientRequestItem();
                reqItem.Id          = requestId;
                reqItem.Type        = "content";
                reqItem.DtRequested = DateTime.Now;
                FoeClientRequest.Add(reqItem);

                // remember when the request was sent
                _lastRequestSent = DateTime.Now;
                // Set status
                tssStatus.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " requested update.";
            }
            catch (Exception)
            {
                tssStatus.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " error sending request.";
            }
        }