Beispiel #1
0
        /// <summary>
        /// 扣款
        /// </summary>
        public static bool FC20147(DBMA1DataContext dbma1, string userSN, decimal amount, string type, string referSN)
        {
            //从余额中扣除服务费 F000
            F000 f000 = dbma1.F000s.Where(c => c.userSN == userSN).First();

            if (f000.balance < amount)
            {
                return(false);
            }
            f000.balance -= amount;

            //加入收支明细表中 F003
            string F003max33SN = C101.FC10102("F003", 8, "UA");
            F003   f003        = new F003();

            f003.revenueExpenditureSN = F003max33SN;
            f003.generetorUserSN      = userSN;
            f003.generateDate         = DateTime.Now;
            f003.type        = type;
            f003.expenditure = amount;
            f003.balance     = f000.balance;
            f003.referSN     = referSN;
            dbma1.F003s.InsertOnSubmit(f003);

            return(true);
        }
Beispiel #2
0
        //unavailable:短信开关关闭。0:发送短信成功。其他:发送失败状态码。
        public string CF10113(DBMA1DataContext dbma1, string userSN, string phone, string content, int seqid, int priority, bool ifNeedPay)
        {
            //验证短信开关是否打开
            if (dbma1.A034s.First().switchStatus != true)
            {
                return("unavailable");
            }

            //发送短信
            string res = CF10109(phone, content, seqid, priority);

            //添加短信记录表
            T000 t000 = new T000();

            t000.smSN         = C101.FC10102("T000", 8, "T");
            t000.generateDate = DateTime.Now;
            t000.sendDate     = DateTime.Now;
            t000.ifSuc        = res == "0" ? true : false;
            dbma1.T000s.InsertOnSubmit(t000);

            //扣款
            if (ifNeedPay == true && res == "0")
            {
                decimal smFee = Convert.ToInt32(dbma1.A028s.First().shortMessageCost);
                C201.FC20154(dbma1, userSN, smFee, "短信发送", t000.smSN);
            }

            return("");
        }
Beispiel #3
0
        //unavailable:短信开关关闭。balanceNotEnough:余额不足。0:发送短信成功。其他:发送失败状态码。
        public static string F001(DBMA1DataContext dbma1, string userSN, string phone, string content, int priority, bool ifNeedPay)
        {
            try
            {
                //验证短信开关是否打开
                if (dbma1.A034s.First().switchStatus != true)
                {
                    return("unavailable");
                }

                decimal smFee = Convert.ToDecimal(dbma1.A028s.First().shortMessageCost);

                //余额不足
                if (ifNeedPay == true)
                {
                    if (dbma1.F000s.Where(c => c.userSN == userSN).First().balance < smFee)
                    {
                        return("balanceNotEnough");
                    }
                }

                string smSN  = C101.FC10102("T000", 8, "T");
                int    seqid = Comm.C101.CF10112(smSN, 1, 8);

                //发送短信
                string res = SendSM(phone, content, seqid, priority);

                //添加短信记录表
                T000 t000 = new T000();
                t000.smSN         = smSN;
                t000.userSN       = userSN;
                t000.phoneNum     = phone;
                t000.smContent    = content;
                t000.generateDate = DateTime.Now;
                t000.sendDate     = DateTime.Now;
                t000.ifSuc        = res == "0" ? true : false;
                dbma1.T000s.InsertOnSubmit(t000);

                //扣款
                if (ifNeedPay == true && res == "0")
                {
                    C201.FC20154(dbma1, userSN, smFee, "短信发送", t000.smSN);
                }

                return(res);
            }
            catch (Exception ex)
            {
                return("");
            }
        }
Beispiel #4
0
        public static bool FC20154(DBMA1DataContext dbma1, string userSN, decimal amount, string type, string referSN)
        {
            //从余额中扣除服务费 F000
            F000 f000 = dbma1.F000s.Where(c => c.userSN == userSN).First();

            if (f000.balance < amount)
            {
                return(false);
            }
            f000.balance -= amount;

            //加入收支明细表中 F003
            string F003max33SN = C101.FC10102("F003", 8, "UA");
            F003   f003        = new F003();

            f003.revenueExpenditureSN = F003max33SN;
            f003.generetorUserSN      = userSN;
            f003.generateDate         = DateTime.Now;
            f003.type        = type;
            f003.expenditure = amount;
            f003.balance     = f000.balance;
            f003.referSN     = referSN;
            dbma1.F003s.InsertOnSubmit(f003);

            //加入成长值表 F006
            F006 f006 = new F006();

            f006.groupUpSN              = C101.FC10102("F006", 7, "UD");
            f006.userSN                 = userSN;
            f006.businessSN             = referSN;
            f006.businessType           = type;
            f006.transactionMoneyAmount = amount;
            f006.groupUpValue           = amount;
            f006.acquireDate            = DateTime.Now;
            dbma1.F006s.InsertOnSubmit(f006);

            return(true);
        }
Beispiel #5
0
        /// <summary>
        /// 发送邮件
        /// </summary>
        public static void FC10106(DBMA1DataContext dbma1, string userSN, string fromEmail, string pwd, string toEmail, string smtp, int port, string subject, string body)
        {
            try
            {
                bool   ifBodyHtml   = false;
                string fromEmailPwd = pwd;

                MailMessage message = new MailMessage();
                message.From = new MailAddress(fromEmail, "凡奇金融"); //源邮件地址
                message.To.Add(new MailAddress(toEmail));          //增加要发送的邮件地址,可以多个
                message.Subject    = subject;                      //发送邮件的标题
                message.IsBodyHtml = ifBodyHtml;                   //发送邮件是否是html格式
                message.Body       = body;                         //发送邮件的内容


                SmtpClient client = new SmtpClient();

                client.Host        = smtp;
                client.Port        = port;
                client.Credentials = new System.Net.NetworkCredential(fromEmail, fromEmailPwd);

                client.Send(message);

                //发送记录添加到邮件发送记录表 T001
                T001 t001 = new T001();
                t001.emialSN      = C101.FC10102("T001", 8, "T");
                t001.userSN       = userSN;
                t001.email        = toEmail;
                t001.subjuct      = subject;
                t001.emailContent = body;
                t001.generateDate = DateTime.Now;
                t001.sendDate     = DateTime.Now;
                dbma1.T001s.InsertOnSubmit(t001);
            }
            catch (Exception ex)
            {
            }
        }