Exemple #1
0
        private int Send()
        {
            DAL.Tables.T_SMS sms = new DAL.Tables.T_SMS();
            DataTable        dt  = sms.Open(ConnectionString, " top 100 [ID], [To], [DateTime], [Content]", "IsSent = 0", "[DateTime]");

            if (dt == null)
            {
                log.Write("Send is Fail: Data read fail.");

                return(-1);
            }

            if (dt.Rows.Count == 0)
            {
                return(0);
            }

            int Count = 0;

            segg = new SMS.Eucp.Gateway.Gateway(Betting_SMS_UserID, Betting_SMS_UserPassword);

            if (segg == null)
            {
                State = 0;

                msg.Send("SendSMSTask: SMS Gateway open error.");
                log.Write("SendSMSTask: SMS Gateway open error.");

                return(-1);
            }

            foreach (DataRow dr in dt.Rows)
            {
                SMS.Eucp.Gateway.CallResult Result = segg.Send(dr["To"].ToString(), dr["Content"].ToString());

                if (Result.Code < 0)
                {
                    log.Write("Send is Fail: " + Result.Description);
                }
                else
                {
                    Count++;
                }

                sms.IsSent.Value = true;
                sms.Update(ConnectionString, "[ID] = " + dr["ID"].ToString());

                System.Threading.Thread.Sleep(500);
            }

            return(Count);
        }
Exemple #2
0
        private void Receive()  // 接收短信
        {
            if ((Betting_SMS_UserID == "") || (Betting_SMS_UserPassword == "") || (segg == null))
            {
                return;
            }

            SMS.Eucp.Gateway.CallResult Result = segg.ReceiveSMS();

            if (Result.Code < 0)
            {
                msg.Send("Receive SMS fail." + Result.Description);
                log.Write("Receive SMS fail." + Result.Description);

                return;
            }

            if (segg.rsc.Count < 1)
            {
                return;
            }

            // 写入数据库
            DAL.Tables.T_SmsBettings t_SmsBettings = new DAL.Tables.T_SmsBettings();

            for (int i = 0; i < segg.rsc.Count; i++)
            {
                t_SmsBettings.SMSID.Value        = 0;
                t_SmsBettings.From.Value         = segg.rsc[i].FromMobile;
                t_SmsBettings.Content.Value      = segg.rsc[i].Content;
                t_SmsBettings.HandleResult.Value = 0;

                if (t_SmsBettings.Insert(ConnectionString) < 0)
                {
                    msg.Send("Write SMS fail.");
                    log.Write("Write SMS fail.");

                    continue;
                }
            }
        }
Exemple #3
0
        private void SchemeCheck()
        {
            if ((DateTime.Now.Hour < 9) || (DateTime.Now.Hour > 21) || ((DateTime.Now.Hour > 21) && (DateTime.Now.Minute > 30)))
            {
                return;
            }

            DataTable dt = new DAL.Views.V_Schemes().Open(ConnectionString, "id", "DATEDIFF(minute, case when UpdateDatetime < StartTime then dateadd(minute, 2, StartTime) else UpdateDatetime end, getdate()) > 4 and Schedule >= 100 and Buyed = 0 and QuashStatus = 0 and State = 1", "");

            if (dt == null)
            {
                msg.Send("读取未出票方案错误(SchemeCheck)。");
                log.Write("读取未出票方案错误(SchemeCheck)。");

                return;
            }

            if (dt.Rows.Count > 0)
            {
                string[] strMobile = new string[1];

                strMobile[0] = "13537697101";

                for (int i = 0; i < strMobile.Length; i++)
                {
                    SMS.Eucp.Gateway.CallResult Result = segg.Send(strMobile[i], "爱彩乐出现紧急票,需要立即处理。");

                    if (Result.Code < 0)
                    {
                        log.Write("Send is Fail: " + Result.Description);
                    }
                }

                Shove._Net.Email.SendEmail("*****@*****.**", "*****@*****.**", "爱彩乐出现紧急票,需要立即处理。", "爱彩乐出现紧急票,需要立即处理。", "mail.icaile.com", "*****@*****.**", "1314521");
            }
        }
Exemple #4
0
        // 满员方案拆分为票
        private void WriteTickets()
        {
            DataTable dt = new DAL.Views.V_SchemeSchedules().Open(ConnectionString, "ID, LotteryID, PlayTypeID, LotteryNumber, Multiple, Money, (case LotteryID when 29 then -29 else LotteryID end) as LotteryID_2", "Buyed = 0 and (GetDate() between StartTime and EndTime) and BuyedShare >= Share and isnull(Identifiers, '') = '' and PrintOutType = 102 and State = 1 and dateadd(mi, 1, StateUpdateTime) <= GetDate() and LotteryID = 29", "LotteryID_2, UserType desc, [ID]");

            if (dt == null)
            {
                msg.Send("读取方案错误(WriteTickets)。");
                log.Write("读取方案错误(WriteTickets)。");

                return;
            }

            DAL.Tables.T_Schemes t_Schemes = new DAL.Tables.T_Schemes();

            foreach (DataRow dr in dt.Rows)
            {
                long   SchemeID     = Shove._Convert.StrToLong(dr["ID"].ToString(), -1);
                int    LotteryID    = Shove._Convert.StrToInt(dr["LotteryID"].ToString(), -1);
                string LotterNumber = dr["LotteryNumber"].ToString();
                int    PlayTypeID   = Shove._Convert.StrToInt(dr["PlayTypeID"].ToString(), -1);
                int    Multiple     = Shove._Convert.StrToInt(dr["Multiple"].ToString(), -1);

                if ((SchemeID < 0) || (LotteryID < 0) || (PlayTypeID < 0) || (Multiple < 1))
                {
                    msg.Send("读取方案错误(WriteTickets)。方案号:" + SchemeID.ToString());
                    log.Write("读取方案错误(WriteTickets)。方案号:" + SchemeID.ToString());

                    continue;
                }

                double Money = 0;
                SLS.Lottery.Ticket[] Tickets = null;

                try
                {
                    Tickets = new SLS.Lottery()[LotteryID].ToElectronicTicket_HPSH(PlayTypeID, LotterNumber, Multiple, 200, ref Money);
                }
                catch (Exception e)
                {
                    msg.Send("拆票错误(WriteTickets)。方案号:" + SchemeID.ToString() + "," + e.Message);
                    log.Write("拆票错误(WriteTickets)。方案号:" + SchemeID.ToString() + "," + e.Message);

                    continue;
                }

                if (Tickets == null)
                {
                    msg.Send("分解票错误(WriteTickets)。方案号:" + SchemeID.ToString());
                    log.Write("分解票错误(WriteTickets)。方案号:" + SchemeID.ToString());

                    continue;
                }

                if (Money != Shove._Convert.StrToDouble(dr["Money"].ToString(), -1))
                {
                    msg.Send("异常警告!!!!(WriteTickets)。方案号: " + SchemeID.ToString() + " 的购买金额与实际票的金额不符合!!!!");
                    log.Write("异常警告!!!!(WriteTickets)。方案号: " + SchemeID.ToString() + " 的购买金额与实际票的金额不符合!!!!");

                    SMS.Eucp.Gateway.CallResult SmsResult = segg.Send("13537697101", "异常警告!!!!(WriteTickets)。方案号: " + SchemeID.ToString() + " 的购买金额与实际票的金额不符合!!!!");

                    if (SmsResult.Code < 0)
                    {
                        log.Write("Send is Fail: " + SmsResult.Description);
                    }

                    SmsResult = segg.Send("13612833534", "异常警告!!!!(WriteTickets)。方案号: " + SchemeID.ToString() + " 的购买金额与实际票的金额不符合!!!!");

                    continue;
                }

                int TicketPlayTypeID = Tickets[0].PlayTypeID;

                string TicketXML = "<Tickets>";

                foreach (SLS.Lottery.Ticket ticket in Tickets)
                {
                    TicketXML += "<Ticket LotteryNumber=\"" + ticket.Number + "\" Multiple=\"" + ticket.Multiple + "\" Money=\"" + ticket.Money + "\" />";
                }

                TicketXML += "</Tickets>";

                int    ReturnValue       = 0;
                string ReturnDescription = "";

                int Result = DAL.Procedures.P_SchemesSendToCenterAdd(ConnectionString, SchemeID, TicketPlayTypeID, TicketXML, ref ReturnValue, ref ReturnDescription);

                if ((Result < 0) || (ReturnValue < 0))
                {
                    msg.Send("票写入错误(WriteTickets):方案号:" + SchemeID.ToString() + "," + ReturnDescription);
                    log.Write("票写入错误(WriteTickets):方案号:" + SchemeID.ToString() + "," + ReturnDescription);
                }
            }
        }