コード例 #1
0
        private void send_SMS(List <string> phones, string msg)
        {
            String TypeStr        = "";
            String CopyRightToCOM = "";
            String CopyRightStr   = "//上海迅赛信息技术有限公司,网址www.xunsai.com//";

            if (SmsClass.Sms_Connection(CopyRightStr, uint.Parse(smsPort[3].ToString()), uint.Parse(smsBaud), out TypeStr, out CopyRightToCOM) != 1)
            {
                BathClass.printErrorMsg("短信猫连接失败,请重试!");
                return;
            }

            string fileName = "短信发送-" + DateTime.Now.ToString("yyMMddHHmm") + ".txt";

            foreach (var phone in phones)
            {
                if (phone.Length != 11)
                {
                    continue;
                }
                if (SmsClass.Sms_Send(phone, msg) == 0)
                {
                    BathClass.printErrorMsg("电话:" + phone + "短信发送失败!");
                }
            }

            IOUtil.insert_file("一共发送:" + phones.Count.ToString() + "条短信", fileName);
            SmsClass.Sms_Disconnection();
        }
コード例 #2
0
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            String TypeStr        = "";
            String CopyRightToCOM = "";
            String CopyRightStr   = "//上海迅赛信息技术有限公司,网址www.xunsai.com//";

            if (SmsClass.Sms_Connection(CopyRightStr, (uint)(port.SelectedIndex + 1), uint.Parse(baud.Text), out TypeStr, out CopyRightToCOM) != 1)
            {
                BathClass.printErrorMsg("设置出错,请重试!");
                return;
            }

            SmsClass.Sms_Disconnection();
            BathClass.set_config_by_key("smsPort", port.Text);
            BathClass.set_config_by_key("smsBaud", baud.Text);
            this.DialogResult = DialogResult.OK;
        }
コード例 #3
0
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            String TypeStr        = "";
            String CopyRightToCOM = "";
            String CopyRightStr   = "//上海迅赛信息技术有限公司,网址www.xunsai.com//";

            if (SmsClass.Sms_Connection(CopyRightStr, (uint)(port.SelectedIndex + 1), uint.Parse(baud.Text), out TypeStr, out CopyRightToCOM) != 1)
            {
                BathClass.printErrorMsg("设置出错,请重试!");
                return;
            }

            BathClass.printInformation("设置成功!");
            SmsClass.Sms_Disconnection();
            IOUtil.set_config_by_key(ConfigKeys.KEY_SMSPORT, port.Text);
            IOUtil.set_config_by_key(ConfigKeys.KEY_CARD_BAUD, baud.Text);
            this.DialogResult = DialogResult.OK;
        }
コード例 #4
0
        private void send_sms(string cardno)
        {
            try
            {
                //var dc = new BathDBDataContext(LogIn.connectionString);
                var ci = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == cardno);
                if (ci.CI_Telephone == null || ci.CI_Telephone.Length != 11)
                {
                    return;
                }

                var mt = db.MemberType.FirstOrDefault(x => x.id == ci.CI_CardTypeNo);
                if (!BathClass.ToBool(mt.smsAfterUsing))
                {
                    return;
                }

                string msg = "尊敬的贵宾,您好!";
                msg += "您的" + mt.name + ",卡号:" + ci.CI_CardNo + ",";
                var cc            = db.CardCharge.Where(y => y.CC_CardNo == ci.CI_CardNo);
                var debit         = cc.Sum(y => y.CC_DebitSum);
                var lend          = cc.Sum(y => y.CC_LenderSum);
                var cu            = db.MemberSetting.FirstOrDefault().money;
                var balance_money = Convert.ToDouble(debit - lend);
                msg += "余额为:" + balance_money.ToString();

                if (mt.credits)
                {
                    var cexpense = db.CardCharge.Where(y => y.CC_CardNo == ci.CI_CardNo);
                    var cvs      = cexpense.Sum(y => y.expense);
                    if (cvs.HasValue)
                    {
                        double cds = cvs.Value;
                        if (ci.CI_CreditsUsed == null)
                        {
                            msg += "积分为:" + (cds / cu).ToString();
                        }
                        else
                        {
                            msg += "积分为:" + (cds / cu - ci.CI_CreditsUsed).ToString();
                        }
                    }
                }

                String TypeStr        = "";
                String CopyRightToCOM = "";
                String CopyRightStr   = "//上海迅赛信息技术有限公司,网址www.xunsai.com//";
                string smsPort        = BathClass.get_config_by_key("smsPort");
                string smsBaud        = BathClass.get_config_by_key("smsBaud");
                if (smsPort == "" || smsBaud == "")
                {
                    SMmsForm smsForm = new SMmsForm();
                    if (smsForm.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    smsPort = BathClass.get_config_by_key("smsPort");
                    smsBaud = BathClass.get_config_by_key("smsBaud");
                }

                if (smsPort == "" || smsBaud == "")
                {
                    return;
                }

                //SmsClass.Sms_Disconnection();
                if (SmsClass.Sms_Connection(CopyRightStr, uint.Parse(smsPort[3].ToString()), uint.Parse(smsBaud), out TypeStr, out CopyRightToCOM) != 1)
                {
                    return;
                }

                SmsClass.Sms_Send(ci.CI_Telephone, msg);
                SmsClass.Sms_Disconnection();
            }
            catch
            {}
        }