示例#1
0
        public static bool UpdateSendStatus(int internalReference, Tab_Sent.Confirmation confirmation)
        {
            const string query = "UPDATE Sent SET Confirmation = @Confirmation WHERE Id IN ( SELECT Id FROM Sent WHERE Reference = @Reference ORDER BY Id DESC LIMIT 1 ); ";

            Dictionary <string, object> args = new Dictionary <string, object>
            {
                { "@Confirmation", confirmation },
                { "@Reference", internalReference }
            };

            return(Sql.NonQuery(query, args));
        }
示例#2
0
        private static void Gsm_StatusReportRecievedEvent(object sender, StatusReport e)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("SMS-Sendebestätigungs-Nr. intern: " + e.InternalReference);
            Console.ForegroundColor = ConsoleColor.Gray;

            //TEST: In Hilfstabelle schreiben
            MelBoxSql.Sql.InsertReportProtocoll(e.DischargeTimeUtc, e.InternalReference);

            int gsmSendStatus = e.SendStatus; //<st> 0-31 erfolgreich versandt; 32-63 versucht weiter zu senden: 64-127 Sendeversuch abgebrochen

            Tab_Sent.Confirmation confirmation = Tab_Sent.Confirmation.Unknown;

            if (gsmSendStatus > 127)
            {
                confirmation = Tab_Sent.Confirmation.AwaitingRefernece;
            }
            else if (gsmSendStatus > 63)
            {
                confirmation = Tab_Sent.Confirmation.AbortedSending;

                string email = $"SMS Absender >{e.Reciever}<\r\n" +
                               $"SMS Text >{e.Message}<\r\n" +
                               $"SMS Sendezeit >{e.DischargeTimeUtc}<\r\n" +
                               $"Interne Refernez >{e.InternalReference}<\r\n\r\n" +
                               $"Senden durch Mobilfunknetzbetreiber abgebrochen! Empfänger empfangsbereit?";

                MelBoxSql.Tab_Log.Insert(Tab_Log.Topic.Gsm, 1, $"SMS konnte nicht an >{e.Reciever}< versendet werden: {e.Message}");
                Email.Send(Email.Admin, email, $"Sendefehler >{e.Reciever}<");
            }
            else if (gsmSendStatus > 31)
            {
                confirmation = Tab_Sent.Confirmation.RetrySending;
            }
            else if (gsmSendStatus >= 0)
            {
                confirmation = Tab_Sent.Confirmation.SentSuccessful;
            }

            //Sendebestätigung in Datenbank schreiben
            if (!MelBoxSql.Tab_Sent.UpdateSendStatus(e.InternalReference, confirmation))
            {
                Console.WriteLine("Gsm_StatusReportRecievedEvent(): Statusreport für Referrenz " + e.InternalReference + " konnte keiner gesendeten SMS zugeordnet werden.");
            }
        }
示例#3
0
        public static System.Data.DataTable Sent_View(DateTime start, DateTime end, string sentTo = "", string content = "", Tab_Contact.Communication via = Tab_Contact.Communication.NaN, Tab_Sent.Confirmation status = Tab_Sent.Confirmation.SentSuccessful)
        {
            string query = "SELECT Gesendet, An, Inhalt, Via, Sendestatus FROM " + Sent_ViewName +
                           " WHERE Gesendet BETWEEN '" + start.ToUniversalTime() + "' AND '" + end.ToUniversalTime() + "' ";

            if (sentTo.Length > 2)
            {
                query += " AND Von LIKE '%" + sentTo + "%' ";
            }
            if (content.Length > 2)
            {
                query += " AND Inhalt LIKE '%" + content + "%' ";
            }
            if (via != Tab_Contact.Communication.NaN)
            {
                query += " AND Via = " + via + " ";
            }
            if (status != Tab_Sent.Confirmation.SentSuccessful)
            {
                query += " AND Sendestatus = " + status + " ";
            }

            return(Sql.SelectDataTable("Gesendet", query));
        }