Example #1
0
        public bool notify_admin_of_error(Newsletter_entry entry)
        {
            // SIMULATING API CALL
            bool reply = true;
            // SIMULATING API CALL

            return reply;
        }
Example #2
0
        public bool send_entry(Newsletter_entry entry,string msg)
        {
            // contact api here

            // SIMULATING API CALL
            bool reply = true;
            // SIMULATING API CALL

            return reply;
        }
Example #3
0
        public bool send_entry(Newsletter_entry entry, string message)
        {
            // contact api here
            string[] parts   = entry.receit_forms.Split(' ');
            string   channel = parts[1];
            var      t       = Task.Run(() => request(channel, message));

            t.Wait();
            bool reply = t.Result;


            return(reply);
        }
        public bool send_email(Newsletter_entry entry, string msg)
        {
            if (entry.receit_forms.Contains("email"))
            {
                bool lockWasTaken = false;
                var  temp         = entry;
                try
                {
                    Monitor.Enter(temp, ref lockWasTaken);
                    // call discord controller
                    var reply = email.send_entry(entry, msg);
                    // update to delivered or update to failed
                    if (reply == true)
                    {
                        var success = entry.update_to_delivered();
                    }
                    else
                    {
                        var success      = entry.update_to_failed_to_deliver();
                        var notification = email.notify_admin_of_error(entry);
                    }
                }
                finally
                {
                    if (lockWasTaken)
                    {
                        Monitor.Exit(temp);
                    }
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }