Example #1
0
        public void Execute()
        {
            Utils.FileLog("Service execution started...");

            while (isServiceRunning)
            {
                Utils.FileLog(Environment.NewLine + "Fetching pending snapmails...");
                List <SnapmailRowData> snapmails = SnapmailDao.GetAll();

                if (snapmails.Count > 0)
                {
                    List <string> keys = new List <string>();
                    foreach (SnapmailRowData data in snapmails)
                    {
                        ///// TESTING ONLY
                        //if (data.UserId != "shakeelanjum")
                        //    continue;

                        if (string.IsNullOrEmpty(data.AccessToken))
                        {
                            Utils.FileLog("Skipping snapmail (" + data.RowKey + ") No access token");
                            continue;
                        }
                        if (string.IsNullOrEmpty(data.Recipients))
                        {
                            Utils.FileLog("Skipping snapmail (" + data.RowKey + ") No more recipients");
                            continue;
                        }

                        if (string.IsNullOrEmpty((SnapmailExePath = CopySnapmailer(data.RowKey))))
                        {
                            Utils.FileLog("Skipping snapmail (" + data.RowKey + ") Unable to create copy of Snapmailer.exe");
                            continue;
                        }

                        StartSnapmailer(data);
                    }
                }
                Thread.Sleep(Settings.CheckInterval);
            }
        }
Example #2
0
 public List <SnapmailInfoModel> GetAll(string id)
 {
     return(SnapmailModel.ToInfoModel(SnapmailDao.GetAll(id)));
 }