Exemple #1
0
        public static List <TreasureDataInfo> CreateTreasureData(int UserID)
        {
            List <TreasureDataInfo>            list       = new List <TreasureDataInfo>();
            Dictionary <int, TreasureDataInfo> dictionary = new Dictionary <int, TreasureDataInfo>();
            int num = 0;

            while (list.Count < 16)
            {
                List <TreasureDataInfo> treasureData = TreasureAwardMgr.GetTreasureData();
                int index = TreasureAwardMgr.rand.Next(treasureData.Count);
                TreasureDataInfo treasureDataInfo = treasureData[index];
                treasureDataInfo.UserID = UserID;
                if (!Enumerable.Contains <int>((IEnumerable <int>)dictionary.Keys, treasureDataInfo.TemplateID))
                {
                    dictionary.Add(treasureDataInfo.TemplateID, treasureDataInfo);
                    list.Add(treasureDataInfo);
                }
                ++num;
            }
            return(list);
        }
Exemple #2
0
 public bool UpdateTreasureData(TreasureDataInfo item)
 {
     bool flag = false;
     try
     {
         SqlParameter[] SqlParameters = new SqlParameter[9]
     {
       new SqlParameter("@ID", (object) item.ID),
       new SqlParameter("@UserID", (object) item.UserID),
       new SqlParameter("@TemplateID", (object) item.TemplateID),
       new SqlParameter("@Count", (object) item.Count),
       new SqlParameter("@Validate", (object) item.ValidDate),
       new SqlParameter("@Pos", (object) item.pos),
       new SqlParameter("@BeginDate", (object) item.BeginDate),
       new SqlParameter("@IsExit", (object) (int) (item.IsExit ? 1 : 0)),
       new SqlParameter("@Result", SqlDbType.Int)
     };
         SqlParameters[8].Direction = ParameterDirection.ReturnValue;
         this.db.RunProcedure("SP_UpdateTreasureData", SqlParameters);
         flag = (int)SqlParameters[8].Value == 0;
     }
     catch (Exception ex)
     {
         if (BaseBussiness.log.IsErrorEnabled)
             BaseBussiness.log.Error((object)"SP_UpdateTreasureData", ex);
     }
     return flag;
 }
Exemple #3
0
 public bool AddTreasureData(TreasureDataInfo item)
 {
     bool flag = false;
     try
     {
         SqlParameter[] SqlParameters = new SqlParameter[9];
         SqlParameters[0] = new SqlParameter("@ID", (object)item.ID);
         SqlParameters[0].Direction = ParameterDirection.Output;
         SqlParameters[1] = new SqlParameter("@UserID", (object)item.UserID);
         SqlParameters[2] = new SqlParameter("@TemplateID", (object)item.TemplateID);
         SqlParameters[3] = new SqlParameter("@Count", (object)item.Count);
         SqlParameters[4] = new SqlParameter("@Validate", (object)item.ValidDate);
         SqlParameters[5] = new SqlParameter("@Pos", (object)item.pos);
         SqlParameters[6] = new SqlParameter("@BeginDate", (object)item.BeginDate);
         SqlParameters[7] = new SqlParameter("@IsExit", (object)(int)(item.IsExit ? 1 : 0));
         SqlParameters[8] = new SqlParameter("@Result", SqlDbType.Int);
         SqlParameters[8].Direction = ParameterDirection.ReturnValue;
         this.db.RunProcedure("SP_TreasureData_Add", SqlParameters);
         flag = (int)SqlParameters[8].Value == 0;
         item.ID = (int)SqlParameters[0].Value;
         item.IsDirty = false;
     }
     catch (Exception ex)
     {
         if (BaseBussiness.log.IsErrorEnabled)
             BaseBussiness.log.Error((object)"Init", ex);
     }
     return flag;
 }