Beispiel #1
0
        /// <summary>
        /// 保存福彩设置
        /// </summary>
        /// <param name="prs">福彩设置对象</param>
        /// <returns></returns>
        public int SaveWelfareLottery(WelfareLottery prs)
        {
            int    i = -1;
            string sqlWelfareLottery = "update WelfareLotteryTable set [IssueF]=@IssueF,[Delay]=@Delay,[CompoundTime]=@CompoundTime,[Compound]=@Compound,[UnionLotto]=@UnionLotto,[BeforePage]=@BeforePage,[BPageExportOne]=@BPageExportOne,[BPageExportTow]=@BPageExportTow,[BPageExportThree]=@BPageExportThree,[StakesPage]=@StakesPage,[SEachnoteOne]=@SEachnoteOne,[SEachnoteTow]=@SEachnoteTow,[SEachnoteThree]=@SEachnoteThree,[TicketAfter]=@TicketAfter,[TicketOne]=@TicketOne,[TicketTow]=@TicketTow,[TicketThree]=@TicketThree,[PrintingState]=@PrintingState,[PrintingStateCom]=@PrintingStateCom,[Bet]=@Bet,Logo=1 where ID=2";

            OleDbParameter[] oldepls = new OleDbParameter[] {
                new OleDbParameter("@IssueF", prs.IssueF),
                new OleDbParameter("@Delay", prs.Delay),
                new OleDbParameter("@CompoundTime", prs.CompoundTime),
                new OleDbParameter("@Compound", prs.Compound),
                new OleDbParameter("@UnionLotto", prs.UnionLotto),
                new OleDbParameter("@BeforePage", prs.BeforePage),
                new OleDbParameter("@BPageExportOne", prs.BPageExportOne),
                new OleDbParameter("@BPageExportTow", prs.BPageExportTow),
                new OleDbParameter("@BPageExportThree", prs.BPageExportThree),
                new OleDbParameter("@StakesPage", prs.StakesPage),
                new OleDbParameter("@SEachnoteOne", prs.SEachnoteOne),
                new OleDbParameter("@SEachnoteTow", prs.SEachnoteTow),
                new OleDbParameter("@SEachnoteThree", prs.SEachnoteThree),
                new OleDbParameter("@TicketAfter", prs.TicketAfter),
                new OleDbParameter("@TicketOne", prs.TicketOne),
                new OleDbParameter("@TicketTow", prs.TicketTow),
                new OleDbParameter("@TicketThree", prs.TicketThree),
                new OleDbParameter("@PrintingState", prs.PrintingState),
                new OleDbParameter("@PrintingStateCom", prs.PrintingStateCom),
                new OleDbParameter("@Bet", prs.Bet)//20
            };
            i = DAL.OLEDBHelp.GetExecute(sqlWelfareLottery, oldepls);
            return(i);
        }
Beispiel #2
0
 private static void ValidNormal(WelfareLottery pWelfareLottery)
 {
     String one = pWelfareLottery.Lottery[NumericType.Ones];
     String ten = pWelfareLottery.Lottery[NumericType.Tens];
     String hundred = pWelfareLottery.Lottery[NumericType.Hundreds];
     ValidNumbers(one);
     ValidNumbers(ten);
     ValidNumbers(hundred);
 }
Beispiel #3
0
        /// <summary>
        /// 是否成功保存福彩的方法
        /// </summary>
        /// <param name="prs">福彩设置对象</param>
        /// <returns></returns>
        public int IsSaveWelfareLottery(WelfareLottery prs)
        {
            int k = -1;

            if (SaveWelfareLottery(prs) >= 0)
            {
                k = 1;
            }
            return(k);
        }
 public static void ValidNumbers(WelfareLottery pWelfareLottery, LotteryType pLotteryType)
 {
     IValidNumber valid = null;
     switch (pLotteryType)
     {
         case LotteryType.TwoColor: valid = new TwoColor(); break;
         case LotteryType.FuCai3D: valid = new FuCai3D(); break;
         default: break;
     }
     if (null != valid)
     {
         valid.Valid(pWelfareLottery);
     }
 }
Beispiel #5
0
 /// <summary>
 /// 福彩设置
 /// </summary>
 public void GiveWelfareLotteryTable()
 {
     if (bll.IsTypeWelfareLottery() == true)
     {
         //载入数据福彩设置
         wl = bll.GetWelfareLottery(1);
         SetWelfareLottery(wl);
     }
     else
     {
         //默认福彩设置数据
         wl = bll.GetWelfareLottery(0);
         SetWelfareLottery(wl);
     }
 }
Beispiel #6
0
        public void Valid(WelfareLottery pWelfareLottery)
        {
            switch (pWelfareLottery.PlayType)
            {
                case (PlayType.Zu6 | PlayType.DanTuo):
                case (PlayType.Normal | PlayType.DanTuo): ValidNormalDan(pWelfareLottery); break;

                case (PlayType.Zu3 | PlayType.DanTuo): ValidZu3Dan(pWelfareLottery); break;

                case PlayType.Normal: ValidNormal(pWelfareLottery); break;
                case PlayType.Zu3: ValidZu3(pWelfareLottery); break;
                case PlayType.Zu6: ValidZu6(pWelfareLottery); break;

                default: throw new FormatException("error:playtype is wrong");
            }
        }
Beispiel #7
0
 private static void ValidNormalDan(WelfareLottery pWelfareLottery)
 {
     String dan = pWelfareLottery.Lottery[NumericType.Dan];
     String tuo = pWelfareLottery.Lottery[NumericType.Tuo];
     Int32 dancount=dan.Length/2+1;
     Int32 tuocount = tuo.Length / 2 + 1;
     if (dancount != 1 && dancount != 2)
     { throw new FormatException("error:dan numbers must be 1-2"); }
     if (tuocount < 2)
     { throw new FormatException("error:dan length less than 2"); }
     if ((dancount + tuocount)<3)
     { throw new FormatException("error:numbers is not enough"); }
     if (NumberHelper.IsRepeat(dan.Split(SplitStr), tuo.Split(SplitStr)))
     { throw new FormatException("error:tuo number is repeat with dan"); }
     ValidNumbers(dan);
     ValidNumbers(tuo);
 }
Beispiel #8
0
        public void Valid(WelfareLottery pWelfareLottery)
        {
            PlayType playtype = pWelfareLottery.PlayType;
            String red = pWelfareLottery.Lottery[NumericType.Red];
            String blue = pWelfareLottery.Lottery[NumericType.Blue];
            String dan = String.Empty;

            ValidNumbers(red, NumericType.Red);
            ValidNumbers(blue, NumericType.Blue);

            if (playtype == PlayType.DanTuo)
            {
                dan = pWelfareLottery.Lottery[NumericType.Dan];
                ValidNumbers(dan, NumericType.Dan);
                if (NumberHelper.IsRepeat(red.Split(SplitStr), dan.Split(SplitStr)))
                {
                    throw new FormatException("error:dan number is repeat");
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// 读取福彩设置
        /// </summary>
        /// <param name="i">0:默认设置,1:还原上次保存的设置</param>
        /// <returns></returns>
        public WelfareLottery GetWelfareLottery(int i)
        {
            WelfareLottery  ps      = new WelfareLottery();
            OleDbDataReader oleRead = null;

            if (i == 0)
            {
                oleRead = DAL.OLEDBHelp.GetReader("select * from WelfareLotteryTable where ID=1");
            }
            else if (i == 1)
            {
                oleRead = DAL.OLEDBHelp.GetReader("select * from WelfareLotteryTable where ID=2");
            }
            while (oleRead.Read())
            {
                ps.IssueF           = Convert.ToInt32(oleRead["IssueF"]);
                ps.Delay            = Convert.ToInt32(oleRead["Delay"]);
                ps.CompoundTime     = Convert.ToInt32(oleRead["CompoundTime"]);
                ps.Compound         = Convert.ToInt32(oleRead["Compound"]);
                ps.UnionLotto       = Convert.ToInt32(oleRead["UnionLotto"]);
                ps.BeforePage       = Convert.ToInt32(oleRead["BeforePage"]);
                ps.BPageExportOne   = Convert.ToInt32(oleRead["BPageExportOne"]);
                ps.BPageExportTow   = Convert.ToInt32(oleRead["BPageExportTow"]);
                ps.BPageExportThree = Convert.ToInt32(oleRead["BPageExportThree"]);
                ps.StakesPage       = Convert.ToInt32(oleRead["StakesPage"]);
                ps.SEachnoteOne     = Convert.ToInt32(oleRead["SEachnoteOne"]);
                ps.SEachnoteTow     = Convert.ToInt32(oleRead["SEachnoteTow"]);
                ps.SEachnoteThree   = Convert.ToInt32(oleRead["SEachnoteThree"]);
                ps.TicketAfter      = Convert.ToInt32(oleRead["TicketAfter"]);
                ps.TicketOne        = Convert.ToInt32(oleRead["TicketOne"]);
                ps.TicketTow        = Convert.ToInt32(oleRead["TicketTow"]);
                ps.TicketThree      = Convert.ToInt32(oleRead["TicketThree"]);
                ps.PrintingState    = Convert.ToInt32(oleRead["PrintingState"]);
                ps.PrintingStateCom = Convert.ToInt32(oleRead["PrintingStateCom"]);
                ps.Bet = Convert.ToInt32(oleRead["Bet"]);
            }
            return(ps);
        }
Beispiel #10
0
 /// <summary>
 /// 恢复福彩设置
 /// </summary>
 /// <param name="prs"></param>
 public void SetWelfareLottery(WelfareLottery prs)
 {
     com_IssueF.SelectedIndex           = prs.IssueF;
     che_Delay.Checked                  = prs.Delay == 1 ? true : false;
     num_CompoundKey.Value              = prs.CompoundTime;
     com_Compound.SelectedIndex         = prs.Compound;
     com_UnionLotto.SelectedIndex       = prs.UnionLotto;
     che_BeforePage.Checked             = prs.BeforePage == 1 ? true : false;
     com_BPageExportOne.SelectedIndex   = prs.BPageExportOne;
     com_BPageExportTow.SelectedIndex   = prs.BPageExportTow;
     com_BPageExportThree.SelectedIndex = prs.BPageExportThree;
     che_StakesPage.Checked             = prs.StakesPage == 1 ? true : false;
     com_SEachnoteOne.SelectedIndex     = prs.SEachnoteOne;
     com_SEachnoteTow.SelectedIndex     = prs.SEachnoteTow;
     com_SEachnoteThree.SelectedIndex   = prs.SEachnoteThree;
     che_TicketAfter.Checked            = prs.TicketAfter == 1 ? true : false;
     com_TicketOne.SelectedIndex        = prs.TicketOne;
     com_TicketTow.SelectedIndex        = prs.TicketTow;
     com_TicketThree.SelectedIndex      = prs.TicketThree;
     che_PrintingState.Checked          = prs.PrintingState == 1 ? true : false;
     com_PrintingStateCom.SelectedIndex = prs.PrintingStateCom;
     che_Bet.Checked = prs.Bet == 1 ? true : false;
 }
Beispiel #11
0
 private static void ValidZu3(WelfareLottery pWelfareLottery)
 {
     String zu3 = pWelfareLottery.Lottery[NumericType.Zu3];
     if ((zu3.Length / 2 + 1) < 2)
     { throw new FormatException("error:z3 length large than 1"); }
     ValidNumbers(zu3);
 }
Beispiel #12
0
 private static void ValidZu6(WelfareLottery pWelfareLottery)
 {
     String zu6 = pWelfareLottery.Lottery[NumericType.Zu6];
     if ((zu6.Length / 2 + 1) < 3)
     { throw new FormatException("error:z3 length less than 3"); }
     ValidNumbers(zu6);
 }
Beispiel #13
0
 private static void ValidZu3Dan(WelfareLottery pWelfareLottery)
 {
     String dan = pWelfareLottery.Lottery[NumericType.Dan];
     String tuo = pWelfareLottery.Lottery[NumericType.Tuo];
     Int32 tuocount = tuo.Length / 2 + 1;
     if (dan.Length != 1)
     { throw new FormatException("error:dan length must be 1"); }
     if (tuocount < 2)
     { throw new FormatException("error:dan length less than 2"); }
     if (NumberHelper.IsRepeat(dan.Split(SplitStr), tuo.Split(SplitStr)))
     {throw new FormatException("error:tuo number is repeat with dan"); }
     ValidNumbers(dan);
     ValidNumbers(tuo);
 }