Ejemplo n.º 1
0
        public frmAdsSettings()
        {
            InitializeComponent();
            var a = SettingBussines.GetAll();

            cls = a.Count > 0 ? a[0] : new SettingBussines();
        }
Ejemplo n.º 2
0
        public frmLineNumbers()
        {
            InitializeComponent();
            grpAccount.Enabled         = false;
            contextMenuStrip1.Renderer = new ToolStripProfessionalRenderer(new ContextMenuSetter());
            var a = SettingBussines.GetAll();

            clsSetting = a.Count > 0 ? a[0] : new SettingBussines();
        }
Ejemplo n.º 3
0
        public frmMain()
        {
            InitializeComponent();
            expandablePanel1.Expanded = false;
            Utility.SubmitEvent      -= UtilityOnSubmitEvent;
            Utility.SubmitEvent      += UtilityOnSubmitEvent;
            var a = SettingBussines.GetAll();

            cls = a.Count > 0 ? a[0] : new SettingBussines();
        }
Ejemplo n.º 4
0
 private void picDivar_Click(object sender, EventArgs e)
 {
     try
     {
         var res        = SettingBussines.GetAll();
         var clsSetting = res.Count == 0 ? new SettingBussines() : res[0];
         var t          = new Thread(async() => await Utility.ManageAdvSend(clsSetting));
         t.Start();
     }
     catch (Exception exception)
     {
         WebErrorLog.ErrorInstence.StartErrorLog(exception);
     }
 }
Ejemplo n.º 5
0
        public static async Task SendSMS(string reciver, string text)
        {
            try
            {
                var a   = SettingBussines.GetAll();
                var cls = a.Count > 0 ? a[0] : new SettingBussines();
                if (cls.PanelGuid == null || cls.PanelGuid == Guid.Empty)
                {
                    return;
                }
                if (cls.LineNumberGuid == null || cls.LineNumberGuid == Guid.Empty)
                {
                    return;
                }
                var panel = await PanelBussines.GetAsync(cls.PanelGuid ?? Guid.Empty);

                var line = await PanelLineNumberBussines.GetAsync(cls.LineNumberGuid ?? Guid.Empty);

                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(panel.API);

                    var content = new FormUrlEncodedContent(new[]
                    {
                        new KeyValuePair <string, string>("Action", SMSAction.Send.Value),
                        new KeyValuePair <string, string>("username", panel.UserName),
                        new KeyValuePair <string, string>("password", panel.Password),
                        new KeyValuePair <string, string>("type", ((int)SMSType.SMS).ToString()),
                        new KeyValuePair <string, string>("from", line.LineNumber.ToString()),
                        new KeyValuePair <string, string>("text", text),
                        new KeyValuePair <string, string>("receivers", reciver),
                    });
                    var result = await client.PostAsync(client.BaseAddress, content);

                    var resultContent = await result.Content.ReadAsStringAsync();
                }
            }
            catch (Exception e)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(e);
            }
        }