You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
2 weeks ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using iMonitorApp.Properties;
|
||
|
using MySql.Data.MySqlClient;
|
||
|
|
||
|
namespace iMonitorApp.Classes
|
||
|
{
|
||
|
// Token: 0x02000026 RID: 38
|
||
|
public class ExternalPhoneCalls
|
||
|
{
|
||
|
// Token: 0x060001A6 RID: 422 RVA: 0x0000CFBC File Offset: 0x0000B1BC
|
||
|
public static void SendPhoneCalls(BindingListInvoked<ParseStackAlarms> li)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
IEnumerable<ParseStackAlarms> enumerable = from p in li
|
||
|
where p.Phoneit
|
||
|
select p;
|
||
|
bool flag = enumerable.Count<ParseStackAlarms>() == 0;
|
||
|
if (!flag)
|
||
|
{
|
||
|
enumerable = (from t in enumerable
|
||
|
orderby t.ReceivingTime descending
|
||
|
select t).Take(Settings.Default.ExternalPhoneCallLimit);
|
||
|
string text = "10.153.65.44";
|
||
|
string text2 = "external";
|
||
|
string connectionString = string.Concat(new string[]
|
||
|
{
|
||
|
"SERVER=",
|
||
|
text,
|
||
|
";DATABASE=",
|
||
|
text2,
|
||
|
";UID=mktData;PASSWORD=yVayWrqT5Tjce3Nt;"
|
||
|
});
|
||
|
MySqlConnection mySqlConnection = new MySqlConnection(connectionString);
|
||
|
mySqlConnection.Open();
|
||
|
string text3 = "DELETE FROM phonecalls";
|
||
|
MySqlCommand mySqlCommand = new MySqlCommand(text3, mySqlConnection);
|
||
|
mySqlCommand.ExecuteNonQuery();
|
||
|
text3 = "INSERT INTO phonecalls(alarmtext,call_time) VALUES ";
|
||
|
string text4 = "";
|
||
|
foreach (ParseStackAlarms parseStackAlarms in enumerable)
|
||
|
{
|
||
|
text4 = string.Concat(new string[]
|
||
|
{
|
||
|
text4,
|
||
|
"('",
|
||
|
parseStackAlarms.Subject,
|
||
|
"','",
|
||
|
parseStackAlarms.ReceivingTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
||
|
"'),"
|
||
|
});
|
||
|
}
|
||
|
text4 = text4.Substring(0, text4.Length - 1);
|
||
|
mySqlCommand = new MySqlCommand(text3 + text4, mySqlConnection);
|
||
|
mySqlCommand.ExecuteNonQuery();
|
||
|
mySqlConnection.Close();
|
||
|
}
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|