コード例 #1
0
        private void sendSMS(string strUserID, string strSMSMessage, string strSMSMobileNo)
        {
            clsSMS SMS = new clsSMS(strUserID);

            try {
                SMS.sendMessage(strSMSMobileNo.Trim(), strSMSMessage);
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alrterror", "alert('error!! " + ex.Message.ToString().Replace("'", " ") + "');", true);
            }


            if (!SMS.propErrorMsg.Equals(""))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgFailed", "alert('Sending Failed  " + SMS.propErrorMsg.Replace("'", " ") + "');", true);
                this.mdlThirdSwitchPopup.Show();
            }

            if (!SMS.propReturnID.Equals(""))
            {
                string strMessageOuput = "You will recieve a text message to your registered mobile number. Enter the code that it contains in the Approval Code field that will appear below the portfolio that you have approved.";
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgSent", string.Format("alert('{0}');", strMessageOuput), true);
                this.mpeSecurityCodePanel.Show();
            }
        }
コード例 #2
0
ファイル: clsWorker.cs プロジェクト: rimiti/sms-application
        public clsWorker(SMSapplication app, String urlChamp, int intervalSendSMS, int ErreurLimiteAvantBlocage, SerialPort serialPort1 = null, SerialPort serialPort2 = null, SerialPort serialPort3 = null, SerialPort serialPort4 = null)
        {
            this.port1           = serialPort1;
            this.port2           = serialPort2;
            this.port3           = serialPort3;
            this.port4           = serialPort4;
            this.url             = urlChamp;
            this.intervalSendSMS = intervalSendSMS;
            this.clsobjSMS       = new clsSMS(objclsWorker: this);
            this.clsobjAPP       = app;
            this.dateThreadBorn  = DateTime.Now;
            this.razErreur       = DateTime.Now.Date.AddDays(1).AddHours(7).AddMinutes(30);
            this.nb_sim          = (this.port1 == null) ? this.nb_sim + 0 : this.nb_sim + 1;
            this.nb_sim          = (this.port2 == null) ? this.nb_sim + 0 : this.nb_sim + 1;
            this.nb_sim          = (this.port3 == null) ? this.nb_sim + 0 : this.nb_sim + 1;
            this.nb_sim          = (this.port4 == null) ? this.nb_sim + 0 : this.nb_sim + 1;

            if (this.nb_sim == 1)
            {
                this.multiSim = 1;
            }
            else if (this.nb_sim == 2)
            {
                this.multiSim = 2;
            }
            else if (this.nb_sim == 4)
            {
                this.multiSim = 4;
                arrayPortState.Add("port1", "OK");
                arrayPortState.Add("port2", "OK");
                arrayPortState.Add("port3", "OK");
                arrayPortState.Add("port4", "OK");
            }
            this.ErreurLimiteAvantBlocage = ErreurLimiteAvantBlocage;
        }
コード例 #3
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string     cellnumber = txtTo.Text;
        string     message    = txtComments.Text;
        SerialPort port       = new SerialPort();
        clsSMS     objclsSMS  = new clsSMS();
        string     portname   = ConfigurationManager.AppSettings["ComPort"];
        string     baudrate   = "57600";

        port = objclsSMS.OpenPort(portname, baudrate);
        try
        {
            if (objclsSMS.sendMsg(port, portname, "57600", cellnumber, message))
            {
                Label1.Text = "Sms-ul a fost trimis!";
            }
            else
            {
                Label1.Text = "Trimitere esuata!";
            }
            objclsSMS.ClosePort(port);
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
            objclsSMS.ClosePort(port);
        }
    }
コード例 #4
0
        //private string UpdateStatus(int intDiscretionary, int intSwitchID)
        //{
        //    if (intDiscretionary == 1 || intDiscretionary == -1)
        //    {
        //        clsSwitch.updateSwitchHeader(intSwitchID, clsSwitch.enumSwitchStatus.Approved, txtDescription.Text);
        //        return clsSwitch.enumSwitchStatus.Approved.ToString();
        //    }
        //    else
        //    {
        //        clsSwitch.updateSwitchHeader(intSwitchID, clsSwitch.enumSwitchStatus.Proposed, txtDescription.Text);
        //        return clsSwitch.enumSwitchStatus.Proposed.ToString();
        //    }
        //}
        private void sendSMS(string strUserID, string strSMSMessage, string strPopupMessage, string strSMSMobileNo)
        {
            clsSMS SMS = new clsSMS(strUserID);

            SMS.sendMessage(strSMSMobileNo.Trim(), strSMSMessage);

            if (!SMS.propErrorMsg.Equals(""))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgFailed", "alert('Sending Failed  " + SMS.propErrorMsg.Replace("'", " ") + "');", true);
            }

            if (!SMS.propReturnID.Equals(""))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgSent", "alert('" + strPopupMessage + "');", true);
            }
        }
コード例 #5
0
        private void sendSMS(int intSwitchID, string strUserID, string strSMSMessage, string strPopupMessage, string strSMSMobileNo)
        {
            clsSMS SMS = new clsSMS(strUserID);

            SMS.sendMessage(strSMSMobileNo.Trim(), strSMSMessage);

            if (!SMS.propErrorMsg.Equals(""))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgFailed", "alert('Sending Failed  " + SMS.propErrorMsg.Replace("'", " ") + "');", true);
            }

            if (!SMS.propReturnID.Equals(""))
            {
                UpdateStatus(intSwitchID);
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgSent", "alert('" + strPopupMessage + "');window.location='SchemeListDetails.aspx';", true);
            }
        }
コード例 #6
0
        private bool sendSMS(string strUserID, string strSMSMessage, string strClientName, string strSMSMobileNo)
        {
            System.Text.StringBuilder sbErrorMessage;
            bool   result = false;
            clsSMS SMS    = new clsSMS(strUserID);

            if (ViewState["SMSErrorMessage"] != null)
            {
                sbErrorMessage = (System.Text.StringBuilder)ViewState["SMSErrorMessage"];
            }
            else
            {
                sbErrorMessage = new System.Text.StringBuilder();
            }

            SMS.sendMessage(strSMSMobileNo.Trim(), strSMSMessage);

            if (!SMS.propErrorMsg.Equals(""))
            {
                string strError = string.Empty;

                if (SMS.propErrorMsg.Contains("114") || SMS.propErrorMsg.Contains("105"))
                {
                    strError = string.Format("Invalid mobile number {0} for {1}.\\n", strSMSMobileNo, strClientName);
                }
                else
                {
                    strError = string.Format("{0} for {1} with Mobile No. {2} \\n", SMS.propErrorMsg, strClientName, strSMSMobileNo);
                }
                sbErrorMessage.Append(strError);
                ViewState["SMSErrorMessage"] = sbErrorMessage;
                result = false;
            }
            if (!SMS.propReturnID.Equals(""))
            {
                result = true;
            }
            return(result);
        }
コード例 #7
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);
            }
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string adresafizicaserver = Server.MapPath("~");
        string cale_rap           = Server.MapPath("~/Documents/Sms/");
        string cale_log           = Server.MapPath("~/Documents/Sms/");

        string               logname     = "LogSmsFerme" + DataSelectie.Text.Trim().Replace(@"/", @"_") + ".txt";
        string               smsname     = "SmsTrimise" + DataSelectie.Text.Trim().Replace(@"/", @"_") + ".txt";
        string               fulllogname = adresafizicaserver + @"\Documents\Sms\" + logname;
        string               fullsmsname = adresafizicaserver + @"\Documents\Sms\" + smsname;
        string               datatestare = DataSelectie.Text;
        MostreDB             mostre      = new MostreDB();
        List <MostreFabrica> mostresms   = MostreFabrica.GetMostreSMS(datatestare);
        SerialPort           port        = new SerialPort();
        clsSMS               objclsSMS   = new clsSMS();
        string               portname    = ConfigurationManager.AppSettings["ComPort"].ToString();
        string               baudrate    = "9600";

        port = objclsSMS.OpenPort(portname, baudrate);

        StringBuilder updateSql  = new StringBuilder("update mostretancuri set SentSms=1 where ");
        int           countSms   = 0;
        int           countError = 0;

        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, "************" + "Data: " + DateTime.Now.ToString() + "**********");
        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + smsname, "************" + "Data: " + DateTime.Now.ToString() + "**********");
        int counter = 0;

        foreach (MostreFabrica ms in mostresms)
        {
            //create sms string
            // G:99,99;P:9,99;C:9,99;L:9,99;SUN:99,99;pH:9,99;Pct ing:-0,513;
            //Inhib:N;U:99,99;NTG:10000000;NCS:99999999
            // G-grasime; P-proteina; C-cazeina; L-lactoza; SUN- subst. uscata negrasa;
            //Pct. ing- punct inghet;
            //Inhib- reziduuri inhibitori ce poate fi P-pozitiv sau N-negativ; U- uree

            //TODO : uncomment !!!
            if (!string.IsNullOrEmpty(ms.TelContact))
            {
                if (ms.FermeNume.Length > 30)
                {
                    ms.FermeNume = ms.FermeNume.Substring(0, 30);
                }
                StringBuilder sms = new StringBuilder();
                sms.Append(ms.FermeNume + ";");
                sms.Append("G:" + ms.Grasime + ";");
                sms.Append("P:" + ms.Proteina + ";");
                sms.Append("C:" + ms.Casein + ";");
                sms.Append("L:" + ms.Lactoza + ";");
                sms.Append("SUN:" + ms.Substu + ";");
                sms.Append("pH:" + ms.Ph + ";");
                sms.Append("Pct.ing.:" + ms.Puncti + ";");
                sms.Append("Inhib:" + ms.Antib + ";");
                sms.Append("U:" + ms.Urea + ";");
                try
                {
                    sms.Append("NTG:" + ms.NTG + "000;");
                }
                catch
                {
                    sms.Append("NTG:>10000000;");
                }
                try
                {
                    sms.Append("NCS:" + ms.NCS + "000;");
                }
                catch
                {
                    sms.Append("NCS:" + ms.NCS + ";");
                }
                sms.Append("Cod:" + ms.CodBare);

                string cellnumber = Regex.Replace(ms.TelContact, @"[\s()-]", "");
                cellnumber = (cellnumber.StartsWith("0") ? "+4" + cellnumber : cellnumber);

                try
                {
                    bool res = objclsSMS.sendMsg(port, portname, "9600", cellnumber, sms.ToString());
                    if (res)
                    {
                        string strupdate = (countSms > 0) ? " or codbare ='" + ms.CodBare + "' " : " codbare ='" + ms.CodBare + "' ";
                        updateSql.Append(strupdate);
                        countSms++;
                        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + smsname, countSms + ". " + ms.CodFerma + " " + ms.FermeNume + " " + cellnumber + " - " + DateTime.Now.ToString());
                        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + smsname, sms.ToString());
                    }
                    else
                    {
                        countError++;
                        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, countError + ". " + ms.CodFerma + " " + ms.FermeNume + " " + cellnumber + " - " + DateTime.Now.ToString());
                        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, sms.ToString());
                    }
                }
                catch (Exception ex)
                {
                    mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, ex.Message + " - " + ex.StackTrace);
                }
                counter++;
            }
        }
        try
        {
            objclsSMS.ClosePort(port);
        }
        catch { }
        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, "************" + "End Data: " + DateTime.Now.ToString() + "**********");
        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + smsname, "************" + "End Data: " + DateTime.Now.ToString() + "**********");
        // update moste tancuri set sentsms=1
        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);

        try
        {
            if (countSms > 0)
            {
                SqlCommand cmd = new SqlCommand(updateSql.ToString(), cnn);
                cmd.Connection.Open();
                cmd.ExecuteNonQuery();
                cmd.Connection.Close();
            }
        }
        catch (Exception exU)
        {
            Label1.Text = " Update MostreTancuri failed! " + exU.Message;
        }


        fissms.NavigateUrl = HttpContext.Current.Request.ApplicationPath + @"/Documents/Sms/" + smsname;
        fissms.Visible     = true;


        fislog.NavigateUrl = HttpContext.Current.Request.ApplicationPath + @"/Documents/Sms/" + logname;
        fislog.Visible     = true;
    }
コード例 #10
0
        private void sendSMS(int intSwitchID, string strUserID, string strSMSMessage, string strPopupMessage, string strSMSMobileNo)
        {
            clsSMS SMS = new clsSMS(strUserID);
            SMS.sendMessage(strSMSMobileNo.Trim(), strSMSMessage);

            if (!SMS.propErrorMsg.Equals(""))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgFailed", "alert('Sending Failed  " + SMS.propErrorMsg.Replace("'", " ") + "');", true);
            }

            if (!SMS.propReturnID.Equals(""))
            {
                UpdateStatus(intSwitchID);
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgSent", "alert('" + strPopupMessage + "');window.location='SchemeListDetails.aspx';", true);
            }
        }
コード例 #11
0
        private void doSwitch(int intSwitchID, string strSchemeName, clsSMS.subclsSMSTemplate.enumSMSTemplateID intSmsID, string strPopupMessage, string strSMSMobileNo)
        {
            String strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString();

            clsSMS.subclsSMSTemplate osubclsSMSTemplate = new clsSMS.subclsSMSTemplate(intSmsID);
            string strReplacerVariable = clsSMS.subclsSMSTemplate.strPortfolioNameVariable;
            string strMessage = osubclsSMSTemplate.propMessage.Replace(strReplacerVariable, strSchemeName);

            if (strSMSMobileNo.Trim().Length != 0)
            {
                sendSMS(intSwitchID, strUserID, strMessage, strPopupMessage, strSMSMobileNo);
                //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + strMessage + "');", true);
            }
        }
コード例 #12
0
        private void sendSMS(string strUserID, string strSMSMessage, string strPopupMessage, string strSMSMobileNo)
        {
            clsSMS SMS = new clsSMS(strUserID);
            SMS.sendMessage(strSMSMobileNo.Trim(), strSMSMessage);

            if (!SMS.propErrorMsg.Equals(""))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alertMsgFailed", "alert('Sending Failed  " + SMS.propErrorMsg.Replace("'", " ") + "');", true);
            }

            if (!SMS.propReturnID.Equals(""))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alertMsgSent", "alert('" + strPopupMessage + "');", true);
            }
        }
コード例 #13
0
        private void sendSMS(string strUserID, string strSMSMessage, string strSMSMobileNo)
        {
            clsSMS SMS = new clsSMS(strUserID);
            try {
                SMS.sendMessage(strSMSMobileNo.Trim(), strSMSMessage);
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alrterror", "alert('error!! " + ex.Message.ToString().Replace("'", " ") + "');", true);
            }
            

            if (!SMS.propErrorMsg.Equals(""))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgFailed", "alert('Sending Failed  " + SMS.propErrorMsg.Replace("'", " ") + "');", true);
                this.mdlThirdSwitchPopup.Show();
            }

            if (!SMS.propReturnID.Equals(""))
            {
                string strMessageOuput = "You will recieve a text message to your registered mobile number. Enter the code that it contains in the Approval Code field that will appear below the portfolio that you have approved.";
                ClientScript.RegisterStartupScript(this.GetType(), "alertMsgSent", string.Format("alert('{0}');", strMessageOuput), true);
                this.mpeSecurityCodePanel.Show();
            }
        }
コード例 #14
0
        private bool sendSMS(string strUserID, string strSMSMessage, string strClientName, string strSMSMobileNo)
        {
            System.Text.StringBuilder sbErrorMessage;
            bool result = false;
            clsSMS SMS = new clsSMS(strUserID);

            if (ViewState["SMSErrorMessage"] != null)
            {
                sbErrorMessage = (System.Text.StringBuilder)ViewState["SMSErrorMessage"];
            }
            else
            {
                sbErrorMessage = new System.Text.StringBuilder();
            }
            
            SMS.sendMessage(strSMSMobileNo.Trim(), strSMSMessage);

            if (!SMS.propErrorMsg.Equals(""))
            {
                string strError = string.Empty;

                if (SMS.propErrorMsg.Contains("114") || SMS.propErrorMsg.Contains("105"))
                {
                    strError = string.Format("Invalid mobile number {0} for {1}.\\n", strSMSMobileNo, strClientName);
                }
                else
                {
                    strError = string.Format("{0} for {1} with Mobile No. {2} \\n", SMS.propErrorMsg, strClientName, strSMSMobileNo);
                }
                sbErrorMessage.Append(strError);
                ViewState["SMSErrorMessage"] = sbErrorMessage;
                result = false;
            }
            if (!SMS.propReturnID.Equals(""))
            {
                result = true;
            }
            return result;
        }
コード例 #15
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string               adresafizicaserver = Server.MapPath("~");
        string               cale_rap           = Server.MapPath("~/Documents/Sms/");
        string               cale_log           = Server.MapPath("~/Documents/Sms/");
        string               logname            = "LogSmsFerme" + DataSelectie.Text.Trim().Replace(@"/", @"_") + ".txt";
        string               smsname            = "SmsTrimise" + DataSelectie.Text.Trim().Replace(@"/", @"_") + ".txt";
        string               fulllogname        = adresafizicaserver + @"\Documents\Sms\" + logname;
        string               fullsmsname        = adresafizicaserver + @"\Documents\Sms\" + smsname;
        DateTime             datatestare        = DateTime.Parse(DataSelectie.Text);
        MostreDB             mostre             = new MostreDB();
        List <MostreFabrica> mostresms          = MostreFabrica.GetMostreSMS(datatestare);
        SerialPort           port      = new SerialPort();
        clsSMS               objclsSMS = new clsSMS();
        string               portname  = ConfigurationManager.AppSettings["ComPort"].ToString();
        string               baudrate  = "9600";

        port = objclsSMS.OpenPort(portname, baudrate);

        StringBuilder updateSql  = new StringBuilder("update mostretancuri set SentSms=1 where ");
        int           countSms   = 0;
        int           countError = 0;

        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, "************" + "Data: " + DateTime.Now.ToString() + "**********");
        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + smsname, "************" + "Data: " + DateTime.Now.ToString() + "**********");
        int counter = 0;

        foreach (MostreFabrica ms in mostresms)
        {
            // text sms
            //TODO : uncomment !!!
            if (!string.IsNullOrEmpty(ms.TelContact))
            {
                if (ms.FermeNume.Length > 30)
                {
                    ms.FermeNume = ms.FermeNume.Substring(0, 30);
                }
                //  if (string.IsNullOrEmpty(ms.TelContact))
                //  ms.TelContact = "+40722217495";
                StringBuilder sms = new StringBuilder();
                //       sms.Append(ms.FermeNume + " analizele sunt incarcate pe site");
                sms.Append("In " + datatestare + " contul dvs. " + ms.FermeNume + " a fost actualizat cu rezultatele analizelor");
                string cellnumber = Regex.Replace(ms.TelContact, @"[\s()-]", "");
                cellnumber = (cellnumber.StartsWith("0") ? "+4" + cellnumber : cellnumber);

                try
                {
                    //todo uncomment
                    bool res = objclsSMS.sendMsg(port, portname, "9600", cellnumber, sms.ToString());
                    //  bool res = true;
                    if (res == true)
                    {
                        string cond      = "(FermaID = " + ms.FermeId + " AND DataTestare = CONVERT(date, ''" + datatestare.ToShortDateString() + "', 103))";
                        string strupdate = (countSms > 0) ? " or " + cond : cond;
                        updateSql.Append(strupdate);
                        countSms++;
                        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + smsname, countSms + ". " + ms.CodFerma + " " + ms.FermeNume + " " + cellnumber + " - " + DateTime.Now.ToString());
                        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + smsname, sms.ToString());
                    }
                    else
                    {
                        countError++;
                        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, countError + ". " + ms.CodFerma + " " + ms.FermeNume + " " + cellnumber + " - " + DateTime.Now.ToString());
                        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, sms.ToString());
                    }
                }
                catch (Exception ex)
                {
                    mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, ex.Message + " - " + ex.StackTrace);
                }
                counter++;
            }
        }
        try
        {
            objclsSMS.ClosePort(port);
        }
        catch { }
        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + logname, "************" + "End Data: " + DateTime.Now + "**********");
        mostre.Addtext(adresafizicaserver + @"\Documents\Sms\" + smsname, "************" + "End Data: " + DateTime.Now + "**********");
        // update moste tancuri set sentsms=1
        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);

        try
        {
            if (countSms > 0)
            {
                SqlCommand cmd = new SqlCommand(updateSql.ToString(), cnn);
                cmd.Connection.Open();
                cmd.ExecuteNonQuery();
                cmd.Connection.Close();
            }
        }
        catch (Exception exU)
        {
            Label1.Text = " Update MostreTancuri failed! " + exU.Message;
        }

        fissms.NavigateUrl = HttpContext.Current.Request.ApplicationPath + @"/Documents/Sms/" + smsname;
        fissms.Visible     = true;

        fislog.NavigateUrl = HttpContext.Current.Request.ApplicationPath + @"/Documents/Sms/" + logname;
        fislog.Visible     = true;
    }