Beispiel #1
0
        public override int?Save(string action)
        {
            var data = new SkillDataModel();

            data.SkillId     = SystemKeyId;
            data.Name        = Name;
            data.Description = Description;
            data.SortOrder   = SortOrder;

            if (action == "Insert")
            {
                var dtSkill = SkillDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtSkill.Rows.Count == 0)
                {
                    SkillDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                SkillDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(data.SkillId);
        }
Beispiel #2
0
        public static int Create(SkillDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("Skill.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
Beispiel #3
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();

            var data = new SkillDataModel();

            UpdatedData = SkillDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.SkillId =
                    Convert.ToInt32(SelectedData.Rows[i][SkillDataModel.DataColumns.SkillId].ToString());
                data.Name        = SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name].ToString();
                data.Description =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description))
                                        ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description)
                                        : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Description].ToString();

                data.SortOrder =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder).ToString())
                                        : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString());

                SkillDataManager.Update(data, SessionVariables.RequestProfile);
                data         = new SkillDataModel();
                data.SkillId = Convert.ToInt32(SelectedData.Rows[i][SkillDataModel.DataColumns.SkillId].ToString());
                var dt = SkillDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Beispiel #4
0
        internal static Dictionary <int, SkillDataModel> ReadSkillModel(string dir, int sheetIndex)
        {
            FileInfo     file    = new FileInfo(dir);
            ExcelPackage package = new ExcelPackage(file);
            Dictionary <int, SkillDataModel> skillModelList = null;

            if (package.Workbook.Worksheets.Count > 0)
            {
                skillModelList = new Dictionary <int, SkillDataModel>();
                ExcelWorksheet excelWorksheet = package.Workbook.Worksheets[sheetIndex];
                for (int m = excelWorksheet.Dimension.Start.Row + 1, n = excelWorksheet.Dimension.End.Row; m <= n; m++)
                {
                    SkillDataModel skillModel = new SkillDataModel();
                    skillModel.code       = excelWorksheet.GetValue <int>(m, 1);
                    skillModel.name       = excelWorksheet.GetValue <string>(m, 2);
                    skillModel.info       = excelWorksheet.GetValue <string>(m, 17);
                    skillModel.type       = (SkillType)excelWorksheet.GetValue <int>(m, 3);
                    skillModel.targetType = (SkillTargetType)excelWorksheet.GetValue <int>(m, 4);
                    skillModel.costType   = (SkillCostType)excelWorksheet.GetValue <int>(m, 5);
                    string[] costs          = excelWorksheet.GetValue <string>(m, 6).Split('/');
                    int      levelCount     = costs.Length;
                    string[] preloadTimes   = excelWorksheet.GetValue <string>(m, 7).Split('/');
                    string[] bootTimes      = excelWorksheet.GetValue <string>(m, 8).Split('/');
                    string[] cdTimes        = excelWorksheet.GetValue <string>(m, 9).Split('/');
                    string[] ranges         = excelWorksheet.GetValue <string>(m, 10).Split('/');
                    string[] damages        = excelWorksheet.GetValue <string>(m, 11).Split('/');
                    string[] heals          = excelWorksheet.GetValue <string>(m, 12).Split('/');
                    string[] atkSpeedUps    = excelWorksheet.GetValue <string>(m, 13).Split('/');
                    string[] moveSpeedUps   = excelWorksheet.GetValue <string>(m, 14).Split('/');
                    string[] lastingTimes   = excelWorksheet.GetValue <string>(m, 15).Split('/');
                    string[] requiredLevels = excelWorksheet.GetValue <string>(m, 16).Split('/');

                    List <SkillLevelData> levelData = new List <SkillLevelData>(5);
                    for (int i = 0; i < levelCount; i++)
                    {
                        SkillLevelData skillLevelData = new SkillLevelData();

                        skillLevelData.nextLevel   = int.Parse(GetData(requiredLevels, i));
                        skillLevelData.cost        = int.Parse(GetData(costs, i));
                        skillLevelData.preloadTime = int.Parse(GetData(preloadTimes, i));
                        skillLevelData.bootTime    = int.Parse(GetData(bootTimes, i));
                        skillLevelData.cdTime      = int.Parse(GetData(cdTimes, i));
                        skillLevelData.lastingTime = float.Parse(GetData(lastingTimes, i));
                        skillLevelData.damage      = int.Parse(GetData(damages, i));
                        skillLevelData.heal        = int.Parse(GetData(heals, i));
                        skillLevelData.range       = float.Parse(GetData(ranges, i));

                        levelData.Add(skillLevelData);
                    }

                    if (!skillModelList.ContainsKey(skillModel.code))
                    {
                        skillModelList.Add(skillModel.code, skillModel);
                    }
                }
            }

            package.Dispose();
            return(skillModelList);
        }
Beispiel #5
0
        public static string Save(SkillDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

            switch (action)
            {
            case "Create":
                sql += "dbo.SkillInsert  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                       ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);
                break;

            case "Update":
                sql += "dbo.SkillUpdate  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId);
                break;

            default:
                break;
            }
            sql = sql + ", " + ToSQLParameter(data, SkillDataModel.DataColumns.SkillId) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder);

            return(sql);
        }
Beispiel #6
0
    public static void RefreshSkill(this SkillDataModel skillData)
    {
        if (skillData.AllSkills.Count < 4)
        {
            Logger.Error("Missing normalAttack skill .allSkills < 4 !");
            return;
        }

        skillData.NormailAttack.Clear();
        skillData.OtherSkills.Clear();


        {
            // foreach(var skillItemDataModel in skillData.AllSkills)
            var __enumerator1 = (skillData.AllSkills).GetEnumerator();
            while (__enumerator1.MoveNext())
            {
                var skillItemDataModel = __enumerator1.Current;
                {
                    skillItemDataModel.RefreshCast();
                    var tbSkill = Table.GetSkill(skillItemDataModel.SkillId);
                    if (tbSkill.Type == 0)
                    {
                        skillData.NormailAttack.Add(skillItemDataModel);
                    }
                    else
                    {
                        skillData.OtherSkills.Add(skillItemDataModel);
                    }
                }
            }
        }
    }
Beispiel #7
0
        public void LoadData(int skillId, bool showId)
        {
            Clear();

            var data = new SkillDataModel();

            data.SkillId = skillId;

            var items = SkillDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count != 1)
            {
                return;
            }

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.SkillId;
                oHistoryList.Setup(PrimaryEntity, skillId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
Beispiel #8
0
        private System.Data.DataTable GetData()
        {
            var data = new SkillDataModel();
            var dt   = SkillDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
    public static void InitTalents(this SkillDataModel skillData, Dictionary <int, int> talentDictionary)
    {
        skillData.Talents.Clear();
        skillData.AttrPanel.Clear();
        PlayerDataManager.Instance.mAllTalents.Clear();
        var talentCache = PlayerDataManager.Instance.mAllTalents;
        var enumerator  = talentDictionary.GetEnumerator();

        while (enumerator.MoveNext())
        {
            var i          = enumerator.Current;
            var talentCell = new TalentCellDataModel();
            talentCell.TalentId = i.Key;
            talentCell.Count    = i.Value;
            talentCell.InitializeTalentCell();
            skillData.Talents.Add(talentCell);
            AddTalentAttrToPanel(skillData.AttrPanel, talentCell);
            talentCache.Add(i.Key, talentCell);
        }

        //刷新天赋影响的技能,必须天赋初始化完成后
        var enumerator2 = PlayerDataManager.Instance.mAllSkills.GetEnumerator();

        while (enumerator2.MoveNext())
        {
            var skill = enumerator2.Current.Value;
            skill.RefreshSkillData();
        }
    }
Beispiel #10
0
        protected override void Clear()
        {
            base.Clear();

            var data = new SkillDataModel();

            SetData(data);
        }
Beispiel #11
0
        public static DataSet GetChildren(SkillDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.SkillChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, SkillDataModel.DataColumns.SkillId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Beispiel #12
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var skilldata = new SkillDataModel();

            skilldata.SkillId = entityKey;
            var results = SkillDataManager.Search(skilldata, SessionVariables.RequestProfile);

            return(results);
        }
Beispiel #13
0
        private DataTable GetData(string name)
        {
            var data = new SkillDataModel();

            data.Name = name;
            var dt = SkillDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Beispiel #14
0
        private void UpdateData(ArrayList values)
        {
            var data = new SkillDataModel();

            data.SkillId     = int.Parse(values[0].ToString());
            data.Name        = values[1].ToString();
            data.Description = values[2].ToString();
            data.SortOrder   = int.Parse(values[3].ToString());
            SkillDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
Beispiel #15
0
        public static bool DoesExist(SkillDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new SkillDataModel();

            doesExistRequest.ApplicationId = data.ApplicationId;
            doesExistRequest.Name          = data.Name;

            var list = GetEntityDetails(doesExistRequest, requestProfile, 0);

            return(list.Count > 0);
        }
Beispiel #16
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new SkillDataModel();

            // copies properties from values dictionary object to data object
            PropertyMapper.CopyProperties(data, values);


            SkillDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Beispiel #17
0
 /// <summary>
 /// 初始化英雄的技能
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 FightSkill[] initSkill(int[] value)
 {
     FightSkill[] skills = new FightSkill[value.Length];
     for (int i = 0; i < value.Length; i++)
     {
         int            skillCode = value[i];
         SkillDataModel data      = SkillData.skillMap[skillCode];
         SkillLevelData levelData = data.levels[0];
         FightSkill     skill     = new FightSkill(skillCode, 0, levelData.level, levelData.time, data.name, levelData.range, data.info, data.target, data.type);
         skills[i] = skill;
     }
     return(skills);
 }
Beispiel #18
0
        private FightSkill[] initSkill(int[] skills)
        {
            FightSkill[] skill = new FightSkill[skills.Length];

            for (int i = 0; i < skills.Length; i++)
            {
                int            skillCode = skills[i];
                SkillDataModel data      = SkillData.skillMap[skillCode];
                SkillLevelData lData     = data.levels[0];
                FightSkill     temp      = new FightSkill(skillCode, 0, lData.level, lData.time, lData.mp, lData.range, data.name, data.info, data.target, data.type);
                skill[i] = temp;
            }
            return(skill);
        }
Beispiel #19
0
        public static void Delete(SkillDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.SkillDelete ";

            var parameters =
                new
            {
                AuditId   = requestProfile.AuditId
                , SkillId = data.SkillId
            };

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
Beispiel #20
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string[] deleteIndexList = DeleteIds.Split(',');
         foreach (string index in deleteIndexList)
         {
             var data = new SkillDataModel();
             data.SkillId = int.Parse(index);
             SkillDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Beispiel #21
0
        public static bool IsDeletable(SkillDataModel data, RequestProfile requestProfile)
        {
            var isDeletable = true;
            var ds          = GetChildren(data, requestProfile);

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataTable dt in ds.Tables)
                {
                    if (dt.Rows.Count > 0)
                    {
                        isDeletable = false;
                        break;
                    }
                }
            }
            return(isDeletable);
        }
Beispiel #22
0
 /// <summary>
 /// 根据技能ID获取具体的 技能的数据实体
 /// </summary>
 /// <param name="skillIds"></param>
 /// <returns></returns>
 public SkillModel[] getSkillModel(int[] skillIds)
 {
     SkillModel[] skillModels = new SkillModel[skillIds.Length];
     for (int i = 0; i < skillIds.Length; i++)
     {
         //获取技能数据
         SkillDataModel data = SkillData.GetSkillData(skillIds[i]);
         //初始化的时候 就是最低级
         SkillLevelDataModel lvData = data.LvModels[0];
         skillModels[i] = new SkillModel()
         {
             Id          = data.Id,
             Level       = 0,
             LearnLevel  = lvData.LearnLv,
             CoolDown    = lvData.CoolDown,
             Name        = data.Name,
             Description = data.Description,
             Distance    = lvData.Distance
         };
     }
     return(skillModels);
 }
Beispiel #23
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows = new DataTable();
                var skilldata    = new SkillDataModel();

                selectedrows = SkillDataManager.GetDetails(skilldata, SessionVariables.RequestProfile).Clone();
                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var systemEntityTypeId = (int)PrimaryEntity;
                    var lstEntityKeys      = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey);

                    foreach (var entityKey in lstEntityKeys)
                    {
                        skilldata.SkillId = entityKey;
                        var result = SkillDataManager.GetDetails(skilldata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    skilldata.SkillId = SetId;
                    var result = SkillDataManager.GetDetails(skilldata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            return(null);
        }
Beispiel #24
0
        protected override void ShowData(int skillId)
        {
            base.ShowData(skillId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new SkillDataModel();

            data.SkillId = skillId;

            var items = SkillDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count == 1)
            {
                var item = items[0];

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, skillId, "Skill");
            }
        }
Beispiel #25
0
        public static string ToSQLParameter(SkillDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

            switch (dataColumnName)
            {
            case SkillDataModel.DataColumns.SkillId:
                if (data.SkillId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SkillDataModel.DataColumns.SkillId, data.SkillId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SkillDataModel.DataColumns.SkillId);
                }
                break;

            default:
                returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName);
                break;
            }

            return(returnValue);
        }
Beispiel #26
0
        public static List <SkillDataModel> GetEntityDetails(SkillDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.SkillSearch ";

            var parameters =
                new
            {
                AuditId           = requestProfile.AuditId
                , ApplicationId   = requestProfile.ApplicationId
                , ApplicationMode = requestProfile.ApplicationModeId
                , ReturnAuditInfo = returnAuditInfo
                , SkillId         = dataQuery.SkillId
                , Name            = dataQuery.Name
            };

            List <SkillDataModel> result;

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                result = dataAccess.Connection.Query <SkillDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList();
            }

            return(result);
        }
Beispiel #27
0
        public static DataTable Search(SkillDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
Beispiel #28
0
 private void ReBindEditableGrid()
 {
     var data    = new SkillDataModel();
     var dtSkill = SkillDataManager.Search(data, SessionVariables.RequestProfile);
 }
Beispiel #29
0
        public static void Update(SkillDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("Skill.Update", sql, DataStoreKey);
        }
Beispiel #30
0
        public void SetData(SkillDataModel item)
        {
            SystemKeyId = item.SkillId;

            base.SetData(item);
        }