コード例 #1
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();

            var data = new SkillLevelDataModel();

            UpdatedData = SkillLevelDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.SkillLevelId =
                    Convert.ToInt32(SelectedData.Rows[i][SkillLevelDataModel.DataColumns.SkillLevelId].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))
                                        : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString());

                SkillLevelDataManager.Update(data, SessionVariables.RequestProfile);
                data = new SkillLevelDataModel();
                data.SkillLevelId = Convert.ToInt32(SelectedData.Rows[i][SkillLevelDataModel.DataColumns.SkillLevelId].ToString());
                var dt = SkillLevelDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
コード例 #2
0
        public static string Save(SkillLevelDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

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

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

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

            return(sql);
        }
コード例 #3
0
        public void LoadData(int skillLevelId, bool showId)
        {
            Clear();

            var data = new SkillLevelDataModel();

            data.SkillLevelId = skillLevelId;

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

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

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.SkillLevelId;
                oHistoryList.Setup(PrimaryEntity, skillLevelId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
コード例 #4
0
        private System.Data.DataTable GetData()
        {
            var data = new SkillLevelDataModel();
            var dt   = SkillLevelDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
コード例 #5
0
        public override int?Save(string action)
        {
            var data = new SkillLevelDataModel();

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

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

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

            return(data.SkillLevelId);
        }
コード例 #6
0
        public static int Create(SkillLevelDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("SkillLevel.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
コード例 #7
0
        protected override void Clear()
        {
            base.Clear();

            var data = new SkillLevelDataModel();

            SetData(data);
        }
コード例 #8
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var skillLeveldata = new SkillLevelDataModel();

            skillLeveldata.SkillLevelId = entityKey;
            var results = SkillLevelDataManager.Search(skillLeveldata, SessionVariables.RequestProfile);

            return(results);
        }
コード例 #9
0
        private DataTable GetData(string name)
        {
            var data = new SkillLevelDataModel();

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

            return(dt);
        }
コード例 #10
0
        public static DataSet GetChildren(SkillLevelDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.SkillLevelChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, SkillLevelDataModel.DataColumns.SkillLevelId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
コード例 #11
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new SkillLevelDataModel();

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

            SkillLevelDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
コード例 #12
0
        private void UpdateData(ArrayList values)
        {
            var data = new SkillLevelDataModel();

            data.SkillLevelId = int.Parse(values[0].ToString());
            data.Name         = values[1].ToString();
            data.Description  = values[2].ToString();
            data.SortOrder    = int.Parse(values[3].ToString());
            SkillLevelDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
コード例 #13
0
        public static bool DoesExist(SkillLevelDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new SkillLevelDataModel();

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

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

            return(list.Count > 0);
        }
コード例 #14
0
        /// <summary>
        /// 技能升级
        /// </summary>
        /// <param name="client"></param>
        /// <param name="SkillId"></param>
        private void OnSkillUp(MobaClient client, int SkillId)
        {
            //1、获取房间
            int       playerId = playerCache.GetId(client);
            FightRoom room     = fightCache.GetRoom(playerId, client);

            if (room == null)
            {
                return;
            }
            //获取英雄模型
            HeroModel hero = room.GetHeroModel(playerId);

            if (hero == null)
            {
                return;
            }

            if (hero.SkillPoints <= 0)
            {
                return;
            }

            //可以加点

            for (int i = 0; i < hero.Skills.Length; i++)
            {
                SkillModel skill = hero.Skills[i];
                if (skill.Id != SkillId)
                {
                    continue;
                }
                //玩家等级没有到达技能学习要求  或者技能已满级
                if (skill.LearnLevel > hero.Level || skill.LearnLevel == -1)
                {
                    return;
                }

                //先获取技能下一级的数据
                hero.SkillPoints--;
                skill.Level++;
                SkillLevelDataModel data = SkillData.GetSkllData(SkillId).LvModels[skill.Level];
                //修改技能
                skill.LearnLevel = data.LearnLv;
                skill.Distance   = data.Distance;
                skill.CoolDown   = data.CoolDown;

                //广播谁更新了什么技能
                room.Brocast(OpCode.FightCode, OpFight.SkillUp, 0, "有人点技能了", null, playerId, JsonMapper.ToJson(skill));
                return;
            }
        }
コード例 #15
0
        /// <summary>
        /// 技能升级
        /// </summary>
        /// <param name="client"></param>
        /// <param name="v"></param>
        private void onSkillUp(MobaClient client, int skillId)
        {
            //1.获取房间模型
            int       playerid = playerCache.GetId(client);
            FightRoom room     = fightCache.GetRoom(playerid);

            if (room == null)
            {
                return;
            }
            //获取英雄数据模型
            HeroModel hero = room.GetHeroModel(playerid);

            if (hero == null)
            {
                return;
            }
            //没有技能点数了 就不作处理
            if (hero.Points <= 0)
            {
                return;
            }
            //可以加点
            foreach (var item in hero.Skills)
            {
                if (item.Id != skillId)
                {
                    continue;
                }
                //如果玩家等级没有到达 技能学习的要求 或者技能已满级
                if (item.LearnLevel > hero.Level || item.LearnLevel == -1)
                {
                    return;
                }
                //扣点数
                hero.Points--;
                //先获取技能下一级的数据
                SkillLevelDataModel data = SkillData.GetSkillData(skillId).LvModels[++item.Level];
                //修改技能
                item.LearnLevel = data.LearnLv;
                item.Distance   = data.Distance;
                item.CoolDown   = data.CoolDown;
                //等等 在这里修改想修改的数据
                //广播 谁 更新了 什么技能
                room.Brocast(OpCode.FightCode, OpFight.SkillUp, 0, "有人点技能了", null, playerid, JsonMapper.ToJson(item));
                return;
            }
        }
コード例 #16
0
        public static void Delete(SkillLevelDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.SkillLevelDelete ";

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

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
コード例 #17
0
        public static bool IsDeletable(SkillLevelDataModel 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);
        }
コード例 #18
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string[] deleteIndexList = DeleteIds.Split(',');
         foreach (string index in deleteIndexList)
         {
             var data = new SkillLevelDataModel();
             data.SkillLevelId = int.Parse(index);
             SkillLevelDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
コード例 #19
0
ファイル: FightRoom.cs プロジェクト: hlslml77/fist
 /// <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);
 }
コード例 #20
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows   = new DataTable();
                var skillLeveldata = new SkillLevelDataModel();

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

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

            return(null);
        }
コード例 #21
0
        protected override void ShowData(int skillLevelId)
        {
            base.ShowData(skillLevelId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new SkillLevelDataModel();

            data.SkillLevelId = skillLevelId;

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

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

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, skillLevelId, "SkillLevel");
            }
        }
コード例 #22
0
        public static List <SkillLevelDataModel> GetEntityDetails(SkillLevelDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.SkillLevelSearch ";

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

            List <SkillLevelDataModel> result;

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

            return(result);
        }
コード例 #23
0
        public static string ToSQLParameter(SkillLevelDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

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

            return(returnValue);
        }
コード例 #24
0
        public static DataTable Search(SkillLevelDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
コード例 #25
0
        public void SetData(SkillLevelDataModel data)
        {
            SystemKeyId = data.SkillLevelId;

            base.SetData(data);
        }
コード例 #26
0
 private void ReBindEditableGrid()
 {
     var data         = new SkillLevelDataModel();
     var dtSkillLevel = SkillLevelDataManager.Search(data, SessionVariables.RequestProfile);
 }
コード例 #27
0
        public void SetData(SkillLevelDataModel item)
        {
            SystemKeyId = item.SkillLevelId;

            base.SetData(item);
        }
コード例 #28
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                var superKey       = "";
                var newId          = Framework.Components.Core.SystemEntityTypeDataManager.GetNextSequence("Layer", (int)Framework.Components.DataAccess.SystemEntity.SkillLevel, SessionVariables.RequestProfile);
                var SkillLeveldata = new SkillLevelDataModel();
                var systemdevdata  = new SystemDevNumbersDataModel();
                systemdevdata.ApplicationUserId = SessionVariables.RequestProfile.AuditId;
                var dtnumbers = Framework.Components.Core.SystemDevNumbersDataManager.Search(systemdevdata, SessionVariables.RequestProfile);
                var rangefrom =
                    Convert.ToInt32(dtnumbers.Rows[0][SystemDevNumbersDataModel.DataColumns.RangeFrom].ToString());
                var rangeto =
                    Convert.ToInt32(dtnumbers.Rows[0][SystemDevNumbersDataModel.DataColumns.RangeTo].ToString());
                if (Request.QueryString["SuperKey"] != null)
                {
                    superKey = Request.QueryString["SuperKey"];
                    var data = new SuperKeyDetailDataModel();
                    data.SuperKeyId         = Convert.ToInt32(superKey);
                    data.SystemEntityTypeId = (int)Framework.Components.DataAccess.SystemEntity.SkillLevel;
                    var dt = Framework.Components.Core.SuperKeyDetailDataManager.Search(data, SessionVariables.RequestProfile);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (System.Data.DataRow dr in dt.Rows)
                        {
                            var key = Convert.ToInt32(dr[SuperKeyDetailDataModel.DataColumns.EntityKey]);
                            SkillLeveldata.SkillLevelId = key;

                            var SkillLeveldt = SkillLevelDataManager.GetDetails(SkillLeveldata, SessionVariables.RequestProfile);

                            if (SkillLeveldt.Rows.Count == 1)
                            {
                                var row = SkillLeveldt.Rows[0];

                                if (Request.QueryString["Mode"].Equals("Test"))
                                {
                                    SkillLeveldata.SkillLevelId = GetNextValidId(rangefrom);
                                }
                                SkillLeveldata.Name        = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]);
                                SkillLeveldata.Description = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]);
                                SkillLeveldata.SortOrder   = Convert.ToInt32(row[StandardDataModel.StandardDataColumns.SortOrder]);

                                SkillLevelDataManager.Create(SkillLeveldata, SessionVariables.RequestProfile);
                            }
                        }
                    }
                }
                else if (Request.QueryString["SetId"] != null)
                {
                    var key = int.Parse(Request.QueryString["SetId"]);
                    SkillLeveldata.SkillLevelId = key;

                    var SkillLeveldt = SkillLevelDataManager.GetDetails(SkillLeveldata, SessionVariables.RequestProfile);

                    if (SkillLeveldt.Rows.Count == 1)
                    {
                        var row = SkillLeveldt.Rows[0];

                        var newSkillLeveldata = new SkillLevelDataModel();
                        if (Request.QueryString["Mode"].Equals("Test"))
                        {
                            newSkillLeveldata.SkillLevelId = newId = (int)GetNextValidId(rangefrom);
                        }
                        newSkillLeveldata.Name        = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]);
                        newSkillLeveldata.Description = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]);
                        newSkillLeveldata.SortOrder   = Convert.ToInt32(row[StandardDataModel.StandardDataColumns.SortOrder]);

                        UpdatedFKDepenedencies(key, newId);
                        SkillLevelDataManager.Delete(SkillLeveldata, SessionVariables.RequestProfile);
                        SkillLevelDataManager.Create(newSkillLeveldata, SessionVariables.RequestProfile);
                    }
                }
                else if (Request.QueryString["Mode"].Equals("Renumber"))
                {
                    var seed = int.Parse(Request.QueryString["Seed"]);
                    //ApplicationVariables.Seed;
                    var increment = int.Parse(Request.QueryString["Increment"]);
                    //ApplicationVariables.Increment;
                    SkillLevelDataManager.Renumber(seed, increment, SessionVariables.RequestProfile);
                }
                base.OnInit(e);

                Response.Redirect("Default.aspx?Added=true", false);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
コード例 #29
0
        public static void Update(SkillLevelDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("SkillLevel.Update", sql, DataStoreKey);
        }
コード例 #30
0
        public static SkillLevelDataModel GetDetails(SkillLevelDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }