Exemplo n.º 1
0
        private void WriteTickets()
        {   
            DataTable dt = new SLS.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 PrintOutType = 301 and State = 1 and dateadd(mi, 1, StateUpdateTime) <= GetDate() and LotteryID <> 29", "LotteryID_2, UserType desc, [ID]"); // and isnull(Identifiers, '') = '' removed from condition
            if (dt == null)
            {
                //msg.Send("读取方案错误(WriteTickets)。");
                log.Write("读取方案错误(WriteTickets)。");
                return;
            }

            SLS.Dal.Tables.T_Schemes t_Schemes = new SLS.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 LotteryNumber = 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;
                //etSunLotto.slTicket[] Tickets = null;
                SLS.Lottery.Ticket[] tics = null;
                try
                {
                    if (LotteryID == SLS.Lottery.CQSSC.ID)
                    {
                        if (PlayTypeID == 2803)
                            tics = eTicketProvider.ToElectronicTicket_ZH(PlayTypeID, LotteryNumber, Multiple, 50, ref Money);
                        else
                            tics = new SLS.Lottery()[LotteryID].ToElectronicTicket_HPCQ(PlayTypeID, LotteryNumber, Multiple, 50, ref Money);
                    }
                    else
                        tics = new SLS.Lottery()[LotteryID].ToElectronicTicket_HPSH(PlayTypeID, LotteryNumber, Multiple, 50, ref Money);
                }
                catch(Exception e)
                {
                    log.Write("拆票错误(WriteTickets)。方案号:" + SchemeID.ToString() + "," + e.Message);
                    continue;
                }

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

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

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

                int ReturnValue = 0;
                string ReturnDescription = "";
                int Result = SLS.Dal.Procedures.P_SchemesSendToCenterAdd(ConnectionString, SchemeID, PlayTypeID, TicketXML, ref ReturnValue, ref ReturnDescription);
                if ((Result < 0) || (ReturnValue < 0))
                {
                    log.Write("票写入错误(WriteTickets):方案号:" + SchemeID.ToString() + "," + ReturnDescription);
                }
            }
        }
Exemplo n.º 2
0
        private void WriteTickets()
        {
            DataTable dt = new SLS.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 PrintOutType = 301 and State = 1 and dateadd(mi, 1, StateUpdateTime) <= GetDate() and LotteryID <> 29", "LotteryID_2, UserType desc, [ID]"); // and isnull(Identifiers, '') = '' removed from condition

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

            SLS.Dal.Tables.T_Schemes t_Schemes = new SLS.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 LotteryNumber = 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;
                //etSunLotto.slTicket[] Tickets = null;
                SLS.Lottery.Ticket[] tics = null;
                try
                {
                    if (LotteryID == SLS.Lottery.CQSSC.ID)
                    {
                        if (PlayTypeID == 2803)
                        {
                            tics = eTicketProvider.ToElectronicTicket_ZH(PlayTypeID, LotteryNumber, Multiple, 50, ref Money);
                        }
                        else
                        {
                            tics = new SLS.Lottery()[LotteryID].ToElectronicTicket_HPCQ(PlayTypeID, LotteryNumber, Multiple, 50, ref Money);
                        }
                    }
                    else
                    {
                        tics = new SLS.Lottery()[LotteryID].ToElectronicTicket_HPSH(PlayTypeID, LotteryNumber, Multiple, 50, ref Money);
                    }
                }
                catch (Exception e)
                {
                    log.Write("拆票错误(WriteTickets)。方案号:" + SchemeID.ToString() + "," + e.Message);
                    continue;
                }

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

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

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

                int    ReturnValue       = 0;
                string ReturnDescription = "";
                int    Result            = SLS.Dal.Procedures.P_SchemesSendToCenterAdd(ConnectionString, SchemeID, PlayTypeID, TicketXML, ref ReturnValue, ref ReturnDescription);
                if ((Result < 0) || (ReturnValue < 0))
                {
                    log.Write("票写入错误(WriteTickets):方案号:" + SchemeID.ToString() + "," + ReturnDescription);
                }
            }
        }