コード例 #1
0
        protected void Retrimitere(object sender, EventArgs e)
        {
            var grdrow = (GridViewRow)((LinkButton)sender).NamingContainer;
            string id = grdrow.Cells[0].Text;

            var smsArchiveManager = new SmsArchiveManager(ConfigurationManager.ConnectionStrings["fccl_v2"].ConnectionString);
            var sms = smsArchiveManager.GetSmsById(id);
            SmsHelper.SendSms(sms);
            BindData();
        }
コード例 #2
0
        public void BindData()
        {
            var smsArchiveManager = new SmsArchiveManager(ConfigurationManager.ConnectionStrings["fccl_v2"].ConnectionString);
            var values = smsArchiveManager.GetAllUnsendSms();

            GridView1.Columns[0].Visible = true;
            GridView1.DataSource = values;
            GridView1.DataBind();
            GridView1.Columns[0].Visible = false;
        }
コード例 #3
0
        public void RunProcess(string[] args)
        {
            Logger.Info("SendSmsWorker | Sms Worker started");

            var smsArchiveManager = new SmsArchiveManager(ConfigurationManager.ConnectionStrings["fccl_v2"].ConnectionString);

            Sms sms = null;

            while ((sms = smsArchiveManager.Dequeue()) != null)
            {
                Logger.Info(string.Format("SendSmsWorker | Sending sms with Id: {0}", sms.Id));
                SmsHelper.SendSms(sms);
            }

        }
コード例 #4
0
ファイル: SmsHelper.cs プロジェクト: veronica1981/veronica
        public static void SendSms(Sms sms)
        {
            var smsArchiveManager = new SmsArchiveManager(ConfigurationManager.ConnectionStrings["fccl_v2"].ConnectionString);
            SerialPort port = new SerialPort();
            clsSMS objclsSMS = new clsSMS();
            string portname = ConfigurationManager.AppSettings["ComPort"].ToString();
            string baudrate = "57600";
            port = objclsSMS.OpenPort(portname, baudrate);
            try
            {
                if (objclsSMS.sendMsg(port, portname, "57600", sms.CellNr, sms.Message))
                {
                    Logger.Info(string.Format("SendSmsWorker | Sms-ul cu id-ul: {0} a fost trimis", sms.Id));
                    sms.DateSend = DateTime.Now;
                    smsArchiveManager.UpdateSms(sms);
                }
                else
                {
                    sms.TryNr++;
                    smsArchiveManager.UpdateSms(sms);
                    Logger.Error(string.Format("SendSmsWorker | Trimitere esuata a sms-ului cu id-ul: {0}", sms.Id));
                }
                objclsSMS.ClosePort(port);
            }
            catch (Exception ex)
            {
                sms.TryNr++;
                smsArchiveManager.UpdateSms(sms);
                Logger.Error(string.Format("SendSmsWorker | Trimitere esuata a sms-ului cu id-ul: {0} error: {1}",
                    sms.Id, ex.Message));

            }
            finally
            {
                objclsSMS.ClosePort(port);
            }
        }