Example #1
0
        private void send_sms_thread()
        {
            try
            {
                var phones = IOUtil.read_file(ConfigKeys.KEY_PHONES_FILE);
                if (phones.Count == 0)
                {
                    return;
                }

                smsPort = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSPORT);
                smsBaud = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSBAUD);
                if (smsPort == "" || smsBaud == "")
                {
                    SMmsForm smsForm = new SMmsForm();
                    if (smsForm.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    smsPort = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSPORT);
                    smsBaud = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSBAUD);
                }

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

                var      dao = new DAO(LogIn.connectionString);
                var      dts = dao.get_last_index_clear_time(2);
                DateTime st  = DateTime.Parse("2013-01-01 00:00:00");
                DateTime et  = dts[0].Value;
                if (dts.Count == 2)
                {
                    st = dts[1].Value;
                }

                string sms_msg = dao.get_sms_msg(st, et);
                send_SMS(phones, sms_msg);
            }
            catch
            {
            }
        }
Example #2
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
            {}
        }
Example #3
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
            {}
        }
 private void ToolSmsSet_Click(object sender, EventArgs e)
 {
     SMmsForm smsForm = new SMmsForm();
     smsForm.ShowDialog();
 }
        private void send_sms_thread()
        {
            try
            {
                var phones = IOUtil.read_file(ConfigKeys.KEY_PHONES_FILE);
                if (phones.Count == 0)
                    return;

                smsPort = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSPORT);
                smsBaud = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSBAUD);
                if (smsPort == "" || smsBaud == "")
                {
                    SMmsForm smsForm = new SMmsForm();
                    if (smsForm.ShowDialog() != DialogResult.OK)
                        return;

                    smsPort = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSPORT);
                    smsBaud = IOUtil.get_config_by_key(ConfigKeys.KEY_SMSBAUD);
                }

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

                var dao = new DAO(LogIn.connectionString);
                var dts = dao.get_last_index_clear_time(2);
                DateTime st = DateTime.Parse("2013-01-01 00:00:00");
                DateTime et = dts[0].Value;
                if (dts.Count == 2)
                    st = dts[1].Value;

                string sms_msg = dao.get_sms_msg(st, et);
                send_SMS(phones,sms_msg);
            }
            catch
            {

            }
        }
Example #6
0
        private void ToolSmsSet_Click(object sender, EventArgs e)
        {
            SMmsForm smsForm = new SMmsForm();

            smsForm.ShowDialog();
        }