Пример #1
0
        public List <string> CheckCombs(ICollection <string> wills, int[] pIds)
        {
            if (null == wills || wills.Count == 0)
            {
                return(null);
            }
            var lst = CheckCombs(pIds);

            if (null == lst || lst.Count == 0)
            {
                return(null);
            }
            DicManagerwillEntity cfg = null;
            var dic = new Dictionary <string, int>();

            foreach (var code in wills)
            {
                if (!TryGetWill(code, out cfg) || string.IsNullOrEmpty(cfg.CombSkillCode))
                {
                    continue;
                }
                dic[cfg.CombSkillCode] = 0;
            }
            for (int i = lst.Count - 1; i >= 0; i--)
            {
                if (!dic.ContainsKey(lst[i]))
                {
                    lst.RemoveAt(i);
                }
            }
            return(lst);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="skillCode">skillCode</param>
        /// <returns>DicManagerwillEntity</returns>
        /// <remarks>2015/10/19 16:24:09</remarks>
        public DicManagerwillEntity GetById(System.String skillCode)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("P_DicManagerwill_GetById");

            database.AddInParameter(commandWrapper, "@SkillCode", DbType.AnsiString, skillCode);


            DicManagerwillEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
        /// <summary>
        /// 将IDataReader的当前记录读取到DicManagerwillEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public DicManagerwillEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new DicManagerwillEntity();

            obj.SkillId       = (System.Int32)reader["SkillId"];
            obj.SkillCode     = (System.String)reader["SkillCode"];
            obj.SkillName     = (System.String)reader["SkillName"];
            obj.WillRank      = (System.Int32)reader["WillRank"];
            obj.DriveFlag     = (System.Int32)reader["DriveFlag"];
            obj.PartMap       = (System.String)reader["PartMap"];
            obj.CombSkillCode = (System.String)reader["CombSkillCode"];
            obj.MaxCombLevel  = (System.Int32)reader["MaxCombLevel"];
            obj.BuffMemo      = (System.String)reader["BuffMemo"];
            obj.BuffArg       = (System.Decimal)reader["BuffArg"];
            obj.BuffArg2      = (System.Decimal)reader["BuffArg2"];
            obj.SortNo        = (System.Int32)reader["SortNo"];
            obj.DenyFlag      = (System.Boolean)reader["DenyFlag"];
            obj.Icon          = (System.String)reader["Icon"];
            obj.Memo          = (System.String)reader["Memo"];
            obj.RowTime       = (System.DateTime)reader["RowTime"];

            return(obj);
        }
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2015/10/19 16:24:10</remarks>
        public bool Update(DicManagerwillEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_DicManagerwill_Update");

            database.AddInParameter(commandWrapper, "@SkillId", DbType.Int32, entity.SkillId);
            database.AddInParameter(commandWrapper, "@SkillCode", DbType.AnsiString, entity.SkillCode);
            database.AddInParameter(commandWrapper, "@SkillName", DbType.String, entity.SkillName);
            database.AddInParameter(commandWrapper, "@WillRank", DbType.Int32, entity.WillRank);
            database.AddInParameter(commandWrapper, "@DriveFlag", DbType.Int32, entity.DriveFlag);
            database.AddInParameter(commandWrapper, "@PartMap", DbType.AnsiString, entity.PartMap);
            database.AddInParameter(commandWrapper, "@CombSkillCode", DbType.AnsiString, entity.CombSkillCode);
            database.AddInParameter(commandWrapper, "@MaxCombLevel", DbType.Int32, entity.MaxCombLevel);
            database.AddInParameter(commandWrapper, "@BuffMemo", DbType.String, entity.BuffMemo);
            database.AddInParameter(commandWrapper, "@BuffArg", DbType.Currency, entity.BuffArg);
            database.AddInParameter(commandWrapper, "@BuffArg2", DbType.Currency, entity.BuffArg2);
            database.AddInParameter(commandWrapper, "@SortNo", DbType.Int32, entity.SortNo);
            database.AddInParameter(commandWrapper, "@DenyFlag", DbType.Boolean, entity.DenyFlag);
            database.AddInParameter(commandWrapper, "@Icon", DbType.AnsiString, entity.Icon);
            database.AddInParameter(commandWrapper, "@Memo", DbType.String, entity.Memo);
            database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, entity.RowTime);


            int results = 0;

            if (trans != null)
            {
                results = database.ExecuteNonQuery(commandWrapper, trans);
            }
            else
            {
                results = database.ExecuteNonQuery(commandWrapper);
            }


            return(Convert.ToBoolean(results));
        }
Пример #5
0
 public static bool HighFlag(this DicManagerwillEntity src)
 {
     return(src.WillRank > 1);
 }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2015/10/19 16:24:10</remarks>
 public bool Update(DicManagerwillEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2015/10/19 16:24:10</remarks>
 public bool Insert(DicManagerwillEntity entity)
 {
     return(Insert(entity, null));
 }
Пример #8
0
        public static bool Update(DicManagerwillEntity dicManagerwillEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new DicManagerwillProvider(zoneId);

            return(provider.Update(dicManagerwillEntity, trans));
        }
Пример #9
0
 public bool TryGetWill(string skillCode, out DicManagerwillEntity cfg)
 {
     s_dicWill.TryGetValue(skillCode, out cfg);
     return(null != cfg);
 }