Ejemplo n.º 1
0
        public static bool TryGenerateNewHuangChengBangHui()
        {
            int  newBHid = WangChengManager.GetTheOnlyOneBangHui();
            bool result;

            if (newBHid <= 0 || WangChengManager.WangZuBHid == newBHid)
            {
                WangChengManager.LastTheOnlyOneBangHui = -1;
                result = false;
            }
            else if (WangChengManager.LastTheOnlyOneBangHui != newBHid)
            {
                WangChengManager.LastTheOnlyOneBangHui     = newBHid;
                WangChengManager.BangHuiTakeHuangGongTicks = TimeUtil.NOW();
                result = false;
            }
            else
            {
                if (WangChengManager.LastTheOnlyOneBangHui > 0)
                {
                    long ticks = TimeUtil.NOW();
                    if (ticks - WangChengManager.BangHuiTakeHuangGongTicks > (long)WangChengManager.MaxTakingHuangGongSecs)
                    {
                        WangChengManager.WangZuBHid = WangChengManager.LastTheOnlyOneBangHui;
                        WangChengManager.UpdateWangZuBHNameFromDBServer(newBHid);
                        return(true);
                    }
                }
                result = false;
            }
            return(result);
        }