Example #1
0
        public static DapperResult CommonSqlPage(string sqlid, IIdentity _identity, int startpage, int limit, string orderby)
        {
            var result = string.Empty;
            var dar    = new DapperResult();

            var _sql = $@"
                            SELECT sqlcontent
                FROM TBL_T_DataSql a
                LEFT JOIN tb_SQL b ON a.sqlid = b.NewSqlID
                WHERE 
                CAST(a.sqlid AS NVARCHAR(50)) = '{sqlid}' 
                OR b.sqlid = '{sqlid}'";


            List <Dictionary <string, object> > sqls = QueryNormal(_sql, false).rows;

            if (sqls.Count == 0)
            {
                dar.rows    = null;
                dar.total   = 0;
                dar.msg     = "Querynodata";
                dar.success = 0;
                return(dar);
            }


            string sql = sqls[0]["sqlcontent"].ToString();

            sql = sql.Replace("@RenYuanId", CharacterUtil.SQLEncode(ExtendIdentity.GetUserId(_identity))).Replace("@CompanyCode", CharacterUtil.SQLEncode(ExtendIdentity.GetOrganizationId(_identity)));


            return(QueryPage(sql, startpage, limit, orderby));
        }
        public PartialViewResult DateDataView(string theDate)
        {
            string          thedate         = CharacterUtil.ConvertToEnglishDigit(theDate);
            PersianDateTime persianDateTime = new PersianDateTime(thedate);

            return(PartialView("_DateDataView", persianDateTime));
        }
Example #3
0
 public Character GetCharacter(string region, string realm, string name,
                               bool getGuildInfo,
                               bool getStatsInfo,
                               bool getTalentsInfo,
                               bool getItemsInfo,
                               bool getReputationInfo,
                               bool getTitlesInfo,
                               bool getProfessionsInfo,
                               bool getAppearanceInfo,
                               bool getCompanionsInfo,
                               bool getMountsInfo,
                               bool getPetsInfo,
                               bool getAchievementsInfo,
                               bool getProgressionInfo)
 {
     return(GetData <Character>(string.Format(baseAPIurl + CharacterUtil.basePath + "{1}/{2}", region, realm, name)
                                + CharacterUtil.buildOptionalQuery(
                                    getGuildInfo,
                                    getStatsInfo,
                                    getTalentsInfo,
                                    getItemsInfo,
                                    getReputationInfo,
                                    getTitlesInfo,
                                    getProfessionsInfo,
                                    getAppearanceInfo,
                                    getCompanionsInfo,
                                    getMountsInfo,
                                    getPetsInfo,
                                    getAchievementsInfo,
                                    getProgressionInfo)));
 }
Example #4
0
        private void RefreshPlayerLevelAndAttributes()
        {
            PlayerInfo playerInfo     = GameProxy.instance.PlayerInfo;
            int        playerLevel    = playerInfo.level;
            int        playerMaxLevel = GlobalData.GetGlobalData().playerLevelMax;
            float      playerExpPercentToNextLevel = PlayerUtil.GetPlayerExpPercentToNextLevel(playerInfo);

            playerExpSlider.value       = playerExpPercentToNextLevel;
            playerExpPercentText.text   = string.Format(Localization.Get("common.percent"), ((int)(playerExpPercentToNextLevel * 100)));
            playerNameAndLevelText.text = string.Format(Localization.Get("ui.player_view.profession_name_and_level"), Localization.Get(playerInfo.heroData.name), playerLevel, playerMaxLevel);

            Dictionary <RoleAttributeType, RoleAttribute> playerAttributeDictionary = PlayerUtil.CalcPlayerAttributesDic(playerInfo);
            Dictionary <RoleAttributeType, RoleAttribute> playerAddAttrByEquipDic   = PlayerUtil.CalcPlayerAttributesDicByEquip(playerInfo);

            hpText.text = playerAttributeDictionary[RoleAttributeType.HP].ValueString;


            RoleAttackAttributeType roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(playerInfo.heroData.roleType);
            int offence   = 0;
            int attackAdd = 0;

            if (roleAttackAttributeType == RoleAttackAttributeType.PhysicalAttack)
            {
                offence   = (int)playerAttributeDictionary[RoleAttributeType.NormalAtk].value;
                attackAdd = GetRoleAttrValue(playerAddAttrByEquipDic.GetValue(RoleAttributeType.NormalAtk));
            }
            else if (roleAttackAttributeType == RoleAttackAttributeType.MagicalAttack)
            {
                offence   = (int)playerAttributeDictionary[RoleAttributeType.MagicAtk].value;
                attackAdd = GetRoleAttrValue(playerAddAttrByEquipDic.GetValue(RoleAttributeType.MagicAtk));
            }
            offenceText.text = offence.ToString();

            defenceText.text = playerAttributeDictionary[RoleAttributeType.Normal_Def].ValueString;
            speedText.text   = playerAttributeDictionary[RoleAttributeType.Speed].ValueString;

            float crit  = playerAttributeDictionary.ContainsKey(RoleAttributeType.Crit) ? playerAttributeDictionary[RoleAttributeType.Crit].value : 0;
            float dodge = playerAttributeDictionary.ContainsKey(RoleAttributeType.Dodge) ? playerAttributeDictionary[RoleAttributeType.Dodge].value : 0;
            float block = playerAttributeDictionary.ContainsKey(RoleAttributeType.Block) ? playerAttributeDictionary[RoleAttributeType.Block].value : 0;
            float hit   = playerAttributeDictionary.ContainsKey(RoleAttributeType.Hit) ? playerAttributeDictionary[RoleAttributeType.Hit].value : 0;

            critText.text  = string.Format(Localization.Get("common.percent"), crit);
            dodgeText.text = string.Format(Localization.Get("common.percent"), dodge);
            blockText.text = string.Format(Localization.Get("common.percent"), block);
            hitText.text   = string.Format(Localization.Get("common.percent"), hit);

            hpAddText.text          = playerAddAttrByEquipDic.ContainsKey(RoleAttributeType.HP) ? string.Format("(+{0})", playerAddAttrByEquipDic[RoleAttributeType.HP].ValueString) : string.Empty;
            attackAddText.text      = attackAdd == 0 ? string.Empty : string.Format("(+{0})", attackAdd);
            defenceAddText.text     = playerAddAttrByEquipDic.ContainsKey(RoleAttributeType.Normal_Def) ? string.Format("(+{0})", playerAddAttrByEquipDic[RoleAttributeType.Normal_Def].ValueString) : string.Empty;
            actionPointAddText.text = playerAddAttrByEquipDic.ContainsKey(RoleAttributeType.Speed) ? string.Format("(+{0})", playerAddAttrByEquipDic[RoleAttributeType.Speed].ValueString) : string.Empty;
            float critAdd  = playerAddAttrByEquipDic.ContainsKey(RoleAttributeType.Crit) ? playerAddAttrByEquipDic[RoleAttributeType.Crit].value : 0;
            float dodgeAdd = playerAddAttrByEquipDic.ContainsKey(RoleAttributeType.Dodge) ? playerAddAttrByEquipDic[RoleAttributeType.Dodge].value : 0;
            float blockAdd = playerAddAttrByEquipDic.ContainsKey(RoleAttributeType.Block) ? playerAddAttrByEquipDic[RoleAttributeType.Block].value : 0;
            float hitAdd   = playerAddAttrByEquipDic.ContainsKey(RoleAttributeType.Hit) ? playerAddAttrByEquipDic[RoleAttributeType.Hit].value : 0;

            critAddText.text  = critAdd == 0 ? string.Empty : string.Format(Localization.Get("common.percent"), string.Format("(+{0})", critAdd));
            dodgeAddText.text = dodgeAdd == 0 ? string.Empty : string.Format(Localization.Get("common.percent"), string.Format("(+{0})", dodgeAdd));
            blockAddText.text = blockAdd == 0 ? string.Empty : string.Format(Localization.Get("common.percent"), string.Format("(+{0})", blockAdd));
            hitAddText.text   = hitAdd == 0 ? string.Empty : string.Format(Localization.Get("common.percent"), string.Format("(+{0})", hitAdd));
        }
Example #5
0
        /// <summary>
        ///获取主属性
        /// </summary>

        public static List <RoleAttribute> CalcHeroMainAttributesList(HeroInfo hero)
        {
            List <RoleAttribute>    mainAttriList = new List <RoleAttribute>();
            List <RoleAttribute>    attriList     = CalcHeroAttributes(hero);
            RoleAttribute           attribute;
            RoleAttackAttributeType roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(hero.heroData.roleType);


            for (int i = 0, count = attriList.Count; i < count; i++)
            {
                attribute = attriList[i];
                if (attribute.type == RoleAttributeType.HP)
                {
                    mainAttriList.Add(attribute);
                }
                else if (attribute.type == RoleAttributeType.MagicAtk && roleAttackAttributeType == RoleAttackAttributeType.MagicalAttack)
                {
                    mainAttriList.Add(attribute);
                }
                else if (attribute.type == RoleAttributeType.NormalAtk && roleAttackAttributeType == RoleAttackAttributeType.PhysicalAttack)
                {
                    mainAttriList.Add(attribute);
                }
                else if (attribute.type == RoleAttributeType.Normal_Def)
                {
                    mainAttriList.Add(attribute);
                }
            }
            return(mainAttriList);
        }
    public Monster addPVPPlayerUnitToStage(TranscendData td, int[] transcendLevel, string monId, Vector3 position)
    {
        Monster mon;

        _tempMonResource = GameManager.info.unitData[monId].resource;
        _tempMonType     = Monster.TYPE.UNIT;

        mon = GameManager.me.characterManager.getMonster(false, false, _tempMonResource, true);
        CharacterUtil.setRare(GameManager.info.unitData[monId].rare, mon);

        position.x -= (float)(GameManager.inGameRandom.Range(0, 101)) / 100.0f;

//		Log.log("addPVPPlayerUnitToStage : " + mon.resourceId);

        mon.init(td, transcendLevel, true, monId, false, _tempMonType);

        mon.setPositionCtransform(position);

        mon.isCutSceneOnlyCharacter = false;

        _tempMonCategory = GameManager.info.monsterData[_tempMonResource].category;

        mon.action.setFirstPosition(mon.cTransformPosition);

        mon.setVisible(true);
        mon.isEnabled = true;

        return(mon);
    }
Example #7
0
        public static EquipmentType GetRoleCorrespondingWeaponType(RoleInfo roleInfo)
        {
            RoleAttackAttributeType roleAttackAttributeType = RoleAttackAttributeType.Invalid;
            EquipmentType           equipmentType           = EquipmentType.None;

            if (roleInfo is PlayerInfo)
            {
                PlayerInfo playerInfo = roleInfo as PlayerInfo;
                roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(playerInfo.heroData.roleType);
            }
            else if (roleInfo is HeroInfo)
            {
                HeroInfo heroInfo = roleInfo as HeroInfo;
                roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(heroInfo.heroData.roleType);
            }

            if (roleAttackAttributeType == RoleAttackAttributeType.PhysicalAttack)
            {
                equipmentType = EquipmentType.PhysicalWeapon;
            }
            else if (roleAttackAttributeType == RoleAttackAttributeType.MagicalAttack)
            {
                equipmentType = EquipmentType.MagicalWeapon;
            }
            return(equipmentType);
        }
        public PartialViewResult HoliDayDataView(string theDate)
        {
            string thedate = CharacterUtil.ConvertToEnglishDigit(theDate);
            //PersianDateTime.GetLongHoliDays(Convert.ToInt32(thedate.Substring(0, 4)));
            var result = PersianDateTime.GetLongHoliDays(Convert.ToInt32(thedate.Substring(0, 4)));

            foreach (var itemX in result)
            {
                foreach (var itemY in itemX)
                {
                    if (itemY.DateMetaDatas.Count(a => a.IsHoliDay) == 0)
                    {
                        itemY.DateMetaDatas = new List <DateMetaData> {
                            (new DateMetaData {
                                Id = itemY.ToString("yyyy-MM-dd"), IsHoliDay = true, CalenderType = CalenderType.Jalali, DateType = DateType.HoliDay, Description = "تعطیلی آخر هفته"
                            })
                        };
                    }
                }
            }
            List <PersianDateTime> MainResult = new List <PersianDateTime>();

            foreach (List <PersianDateTime> item in result)
            {
                MainResult.AddRange(item);
            }
            return(PartialView("_BestHolidays", result));
        }
Example #9
0
 static void Main(string[] args)
 {
     foreach (var s in "0aB在ス☆")
     {
         Console.WriteLine(s + " -> " + CharacterUtil.GetCharType(s));
     }
     Console.ReadLine();
 }
Example #10
0
        public ParseResultCollection Recognize(string text, ParserPattern pattern)
        {
            ParserContext context = new ParserContext();

            context.Pattern = pattern;
            context.Text    = text;

            ParseResultCollection result = new ParseResultCollection();

            char[] chars = text.ToCharArray();

            int i = 0;

            while (i < chars.Length)
            {
                char c = chars[i];

                if (CharacterUtil.IsChinesePunctuation(c))
                {
                    i++;
                    continue;
                }
                bool isFound = false;
                //扫描地名(优先于姓名,用于排除不正确人名)
                foreach (ConstructorInfo ci in parserConstructors)
                {
                    IParser parser = ci.Invoke(new object[] { context }) as IParser;

                    try
                    {
                        ParseResultCollection prc = parser.Parse(i);

                        if (prc.Count > 0)
                        {
                            foreach (ParseResult pr in prc)
                            {
                                result.Add(pr);
                                i += pr.Length;
                            }
                            isFound = true;
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }

                    if (!isFound)
                    {
                        i++;
                    }
                }
            }
            return(result);
        }
Example #11
0
        private void RefreshAttributes()
        {
            Dictionary <RoleAttributeType, RoleAttribute> roleAttributesDic = RoleUtil.CalcRoleAttributesDic(_playerInfo);
            Dictionary <RoleAttributeType, RoleAttribute> roleAttributeAddByEquipmentDic = RoleUtil.CalcRoleAttributesDicByEquip(_playerInfo);
            RoleAttackAttributeType roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(_playerInfo.heroData.roleType);

            int hpValue       = (int)roleAttributesDic[RoleAttributeType.HP].value;
            int offenceValue  = 0;
            int defenceValue  = 0;
            int speedValue    = (int)roleAttributesDic[RoleAttributeType.Speed].value;
            int criticalValue = roleAttributesDic.ContainsKey(RoleAttributeType.Crit) ? (int)roleAttributesDic[RoleAttributeType.Crit].value : 0;
            int dodgeValue    = roleAttributesDic.ContainsKey(RoleAttributeType.Dodge) ? (int)roleAttributesDic[RoleAttributeType.Dodge].value : 0;
            int blockValue    = roleAttributesDic.ContainsKey(RoleAttributeType.Block) ? (int)roleAttributesDic[RoleAttributeType.Block].value : 0;
            int hitValue      = roleAttributesDic.ContainsKey(RoleAttributeType.Hit) ? (int)roleAttributesDic[RoleAttributeType.Hit].value : 0;

            int hpAddValue       = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.HP) ? (int)roleAttributeAddByEquipmentDic[RoleAttributeType.HP].value : 0;
            int offenceAddValue  = 0;
            int defenceAddValue  = 0;
            int speedAddValue    = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.Speed) ? (int)roleAttributeAddByEquipmentDic[RoleAttributeType.Speed].value : 0;
            int criticalAddValue = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.Crit) ? (int)roleAttributeAddByEquipmentDic[RoleAttributeType.Crit].value : 0;
            int dodgeAddValue    = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.Dodge) ? (int)roleAttributeAddByEquipmentDic[RoleAttributeType.Dodge].value : 0;
            int blockAddValue    = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.Block) ? (int)roleAttributeAddByEquipmentDic[RoleAttributeType.Block].value : 0;
            int hitAddValue      = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.Hit) ? (int)roleAttributeAddByEquipmentDic[RoleAttributeType.Hit].value : 0;

            if (roleAttackAttributeType == RoleAttackAttributeType.PhysicalAttack)
            {
                offenceValue    = (int)roleAttributesDic[RoleAttributeType.NormalAtk].value;
                offenceAddValue = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.NormalAtk) ? (int)roleAttributeAddByEquipmentDic.GetValue(RoleAttributeType.NormalAtk).value : 0;
            }
            else if (roleAttackAttributeType == RoleAttackAttributeType.MagicalAttack)
            {
                offenceValue    = (int)roleAttributesDic[RoleAttributeType.MagicAtk].value;
                offenceAddValue = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.MagicAtk) ? (int)roleAttributeAddByEquipmentDic.GetValue(RoleAttributeType.MagicAtk).value : 0;
            }
            defenceValue    = (int)roleAttributesDic[RoleAttributeType.Normal_Def].value;
            defenceAddValue = roleAttributeAddByEquipmentDic.ContainsKey(RoleAttributeType.Normal_Def) ? (int)roleAttributeAddByEquipmentDic.GetValue(RoleAttributeType.Normal_Def).value : 0;
            hpItem.SetValue(hpValue);
            hpItem.SetAddValue(hpAddValue);
            offenceItem.SetValue(offenceValue);
            offenceItem.SetAddValue(offenceAddValue);
            defenceItem.SetValue(defenceValue);
            defenceItem.SetAddValue(defenceAddValue);
            speedItem.SetValue(speedValue);
            speedItem.SetAddValue(speedAddValue);
            criticalItem.SetValue(criticalValue);
            criticalItem.SetAddValue(criticalAddValue);
            dodgeItem.SetValue(dodgeValue);
            dodgeItem.SetAddValue(dodgeAddValue);
            blockItem.SetValue(blockValue);
            blockItem.SetAddValue(blockAddValue);
            hitItem.SetValue(hitValue);
            hitItem.SetAddValue(hitAddValue);
        }
Example #12
0
        protected void gvVoteItem_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (SessionUtil.Current == null)
            {
                ShowLoginBox();
                return;
            }

            if (SessionUtil.Current.IsLogin == false)
            {
                ShowLoginBox();
                return;
            }

            GridViewRow row      = gvVoteItem.Rows[e.RowIndex];
            TextBox     txtScore = (TextBox)row.Cells[3].FindControl("txtScore");

            if (CharacterUtil.isNumber(txtScore.Text.Trim()) == false)
            {
                ShowMessageBox("请填写一个0至100的数字分数值");
                return;
            }

            int score = Convert.ToInt32(txtScore.Text.Trim());

            if (score < 0 || score > 100)
            {
                ShowMessageBox("请填写一个0至100的数字分数值");
                return;
            }

            string message = "操作失败,请与管理员联系";
            //HiddenField hidVoteItemId = (HiddenField)row.Cells[5].FindControl("hidVoteItemId");

            RelUserVoteitemModel voteInfo = new RelUserVoteitemModel();

            voteInfo.UserId        = SessionUtil.Current.UserId;
            voteInfo.VoteProjectId = "A0B4B4C5-B196-48E2-B00D-7E50921E0675";
            voteInfo.VoteItemId    = gvVoteItem.DataKeys[e.RowIndex].Value.ToString();
            voteInfo.Score         = txtScore.Text;
            voteInfo.Status        = 0;

            if (VoteProjectItemInfoService.Instance.ProjectItemVote(voteInfo, out message))
            {
                ShowMessageBox(message);
                gvVoteItem.EditIndex = -1;
                BindVoteItemData();
            }
            else
            {
                ShowMessageBox(message);
            }
        }
Example #13
0
 int MatchPunctation(string text, int startIndex, int maxlength)
 {
     for (int i = startIndex; i < startIndex + maxlength; i++)
     {
         if (i + 1 < text.Length &&
             CharacterUtil.IsChinesePunctuation(text[i + 1]))
         {
             return(i + 1);
         }
     }
     return(-1);
 }
        public bool UpdateGroupInfo(CustomerAttributeGroupInfoModel model, out string message)
        {
            bool result = false;

            message       = "操作失败,请与管理员联系";
            model.Tabname = "customer_info_" + CharacterUtil.ConvertToPinyin(model.GroupName);
            Dictionary <string, CustomerAttributeGroupInfoModel> dict = GetCustomeGroupInfoList(true);

            CustomerAttributeGroupInfoModel oldInfo = dict[model.GroupId];

            try
            {
                BeginTransaction();

                if (oldInfo.GroupName != model.GroupName)
                {
                    string NewsTableName = "customer_info_" + CharacterUtil.ConvertToPinyin(model.GroupName);
                    string TableName     = "customer_info_" + CharacterUtil.ConvertToPinyin(oldInfo.GroupName);
                    string renSQL        = DTableUtil.GetRenameTableSQL(TableName, NewsTableName);
                    ExecuteNonQuery(renSQL);
                }

                if (Update(model) == 1)
                {
                    GetGroupInfoById(model.GroupId, true);
                    message = "成功更新客户分组属性";
                    result  = true;

                    CommitTransaction();
                }
                else
                {
                    RollbackTransaction();
                    message = "更新产客户分组属性失败,请与管理员联系";
                    result  = false;
                }
            }
            catch (Exception ex)
            {
                RollbackTransaction();
                LogUtil.Error("更新客户分组属性异常", ex);
                throw ex;
            }

            return(result);
        }
        // 在此添加你的代码....


        public bool UpdateCustomerAttribute(CustomerExtAttributesModel attInfo, out string message, string oldName)
        {
            bool result = false;

            message = "操作失败,请与管理员联系";
            CustomerExtAttributesModel model = GetCustomerAttributeById(attInfo.ExtAttributeId, true);


            Dictionary <string, CustomerAttributeGroupInfoModel> dict = CustomerAttributeGroupInfoService.Instance.GetCustomeGroupInfoList(true);

            CustomerAttributeGroupInfoModel oldInfo = dict[model.GroupId];

            try
            {
                BeginTransaction();
                if (attInfo.AttributeName != oldName)
                {
                    string TableName      = "customer_info_" + CharacterUtil.ConvertToPinyin(oldInfo.GroupName);
                    string renameFieldSQL = DTableUtil.GetRenameFieldSQL(TableName, oldName, attInfo.AttributeName);
                    ExecuteNonQuery(renameFieldSQL);
                }
                if (Update(attInfo) == 1)
                {
                    GetCustomerAttributeList(attInfo.ExtAttributeId, true);
                    message = "成功更新客户属性";
                    result  = true;

                    CommitTransaction();
                }
                else
                {
                    RollbackTransaction();
                    message = "更新产客户属性失败,请与管理员联系";
                    result  = false;
                }
            }
            catch (Exception ex)
            {
                RollbackTransaction();
                LogUtil.Error("更新客户属性异常", ex);
                throw ex;
            }

            return(result);
        }
Example #16
0
        /// <summary>
        /// 对指定列名使用IN表达式
        /// </summary>
        /// <param name="_identity"></param>
        /// <param name="xml"></param>
        /// <param name="sql"></param>
        /// <param name="columnName"></param>
        /// <returns></returns>
        public static DapperResult searchInSpecifiedColunm(IIdentity _identity, string xml, string sql, string columnName)
        {
            var executeSql = string.Empty;

            var parameterValue = "'";

            var ht = Utility.HtFromPage(_identity);

            var valueList = ht[columnName]?.ToString().Replace("'[", "").Replace("]'", "").Replace("\r\n", "").Replace(" ", "").Split(',');

            if (valueList == null || valueList.Count() == 0)
            {
                ht.Remove($"{columnName}_Off");
                ht.Add($"{columnName}_Off", "--");
            }
            else
            {
                ht.Remove($"{columnName}_Off");
                ht.Add($"{columnName}_Off", string.Empty);

                foreach (var value in valueList)
                {
                    if (string.IsNullOrEmpty(value))
                    {
                        continue;
                    }

                    parameterValue += value + "','";
                }

                ht.Remove(columnName);
                ht.Add(columnName, parameterValue.Substring(0, parameterValue.Length - 2));
            }

            ht.Remove("CompanyCode");
            var orgId = ExtendIdentity.GetOrganizationId(_identity);

            ht.Add("CompanyCode", CharacterUtil.SQLEncode(orgId));

            executeSql = SQLLoaderComponent.GetSQLQuery(xml, sql, ht);

            var dar = DapperContext.QueryPage(executeSql, int.Parse(ht["offset"].ToString().Replace("'", "")), int.Parse(ht["limit"].ToString().Replace("'", "")));

            return(dar);
        }
Example #17
0
        public static DapperResult CommonSql(string sqlid, IIdentity _identity)
        {
            var result = string.Empty;
            var dar    = new DapperResult();

            var _sql = string.Format(@"
                            SELECT sqlcontent
                FROM TBL_T_DataSql a
                LEFT JOIN tb_SQL b ON a.sqlid = b.NewSqlID
                WHERE 
                CAST(a.sqlid AS NVARCHAR(50)) = '{0}' 
                OR b.sqlid = '{0}'", sqlid);

            var dr = QueryNormal(_sql, false);

            if (dr == null || dr.success == 0 || dr.rows == null)
            {
                dar.rows    = null;
                dar.total   = 0;
                dar.msg     = "Querynodata";
                dar.success = 0;
                return(dar);
            }
            List <Dictionary <string, object> > sqls = dr.rows;

            if (sqls.Count == 0)
            {
                dar.rows    = null;
                dar.total   = 0;
                dar.msg     = "Querynodata";
                dar.success = 0;
                return(dar);
            }


            string sql = sqls[0]["sqlcontent"].ToString();

            sql = sql.Replace("@RenYuanId", CharacterUtil.SQLEncode(ExtendIdentity.GetUserId(_identity))).Replace("@CompanyCode", CharacterUtil.SQLEncode(ExtendIdentity.GetOrganizationId(_identity)));
            //  sql = ControlNPrefix(sql);


            return(QueryNormal(sql, false));
        }
        protected string GetImportProductInfoSQL(ProductCategoryInfoModel catInfo, Dictionary <string, ProductCategoryAttributesModel> proAttList)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("INSERT INTO [{0}] ( ", catInfo.TableName);
            foreach (ProductCategoryAttributesModel item in proAttList.Values)
            {
                sb.AppendFormat(" [{0}],", item.AttributeName);
            }
            sb.Append("product_id, product_category_id, category_group_id, created_on, created_by, status_code ) VALUES ( ");
            foreach (ProductCategoryAttributesModel item in proAttList.Values)
            {
                sb.AppendFormat(" ${0}$,", CharacterUtil.ConvertToPinyin(item.AttributeName));
            }

            sb.AppendFormat("$product_id$, $product_category_id$, $category_group_id$, $created_on$, $created_by$, 0 ) ");

            return(sb.ToString());
        }
Example #19
0
        private void InitAttribute()
        {
            _attrDic.Clear();
            _attrDic.Add(RoleAttributeType.HP, 1);

            RoleType roleType = _roleInfo.heroData.roleType;
            RoleAttackAttributeType roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(roleType);

            if (roleAttackAttributeType == RoleAttackAttributeType.PhysicalAttack)
            {
                _attrDic.Add(RoleAttributeType.NormalAtk, 1);
            }
            else
            {
                _attrDic.Add(RoleAttributeType.MagicAtk, 1);
            }
            _attrDic.Add(RoleAttributeType.Normal_Def, 1);
            _attrDic.Add(RoleAttributeType.Speed, 1);
        }
Example #20
0
        public static DapperResult SaveResultForDiscountForBFP(IIdentity _identity, string xml, string sql, string Op)
        {
            string[]      sqls     = { };
            List <string> lists    = new List <string>();
            Hashtable     ht       = Utility.HtFromPage(_identity);
            string        jsonText = Newtonsoft.Json.Linq.JObject.Parse(Utility.HtFromPageForDiscount(_identity))["RecordIDList"].ToString();
            var           mJObj    = Newtonsoft.Json.Linq.JArray.Parse(jsonText);

            if (!string.IsNullOrEmpty(ht["OrderId"].ToString()))
            {
                Hashtable htd = new Hashtable();
                htd.Add("OrderId", CharacterUtil.SQLEncode(ht["OrderId"].ToString()));
                htd.Add("OrderProductId", CharacterUtil.SQLEncode(ht["OrderProductId"].ToString()));
                lists.Add(SQLLoaderComponent.GetSQLQuery(xml, sql + "_Delete", ht));
            }
            for (int i = 0; i < mJObj.Count; i++)
            {
                Newtonsoft.Json.Linq.JObject oData = Newtonsoft.Json.Linq.JObject.Parse(mJObj[i].ToString());
                ht.Remove("ApplyNo");
                ht.Add("ApplyNo", CharacterUtil.SQLEncode(oData["ApplyNo"].ToString()));
                ht.Remove("OrderProductId");
                ht.Add("OrderProductId", CharacterUtil.SQLEncode(oData["OrderProductId"].ToString()));
                ht.Remove("OrderId");
                ht.Add("OrderId", CharacterUtil.SQLEncode(oData["OrderId"].ToString()));
                ht.Remove("ProductCode");
                ht.Add("ProductCode", CharacterUtil.SQLEncode(oData["ProductCode"].ToString()));
                ht.Remove("SerSalesDiscountAttachId");
                ht.Add("SerSalesDiscountAttachId", CharacterUtil.SQLEncode(oData["SerSalesDiscountAttachId"].ToString()));
                ht.Remove("UseAmount");
                ht.Add("UseAmount", CharacterUtil.SQLEncode(oData["UseAmount"].ToString()));
                ht.Remove("ActualAmount");
                ht.Add("ActualAmount", CharacterUtil.SQLEncode(oData["ActualAmount"].ToString()));

                if (Op == "S")
                {
                    lists.Add(SQLLoaderComponent.GetSQLQuery(xml, sql + "_Insert", ht));
                }
            }
            var dar = DapperContext.ExecuteTrans(lists);

            return(dar);
        }
        // 在此添加你的代码...


        /// <summary>
        /// 根据ID删除客户分组属性信息。
        /// </summary>
        /// <param name="departmentId"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public bool DeleteGroupInfoById(string groupid, out string message)
        {
            message = "操作失败,请与管理员联系";
            bool result = false;
            Dictionary <string, CustomerAttributeGroupInfoModel> dict = GetCustomeGroupInfoList(true);

            CustomerAttributeGroupInfoModel oldInfo = dict[groupid];

            string TableName = "customer_info_" + CharacterUtil.ConvertToPinyin(oldInfo.GroupName);
            string deleteCustomerAttributesSQL = "DELETE FROM customer_ext_attributes WHERE group_id = $groupid$;";
            ParameterCollection pc             = new ParameterCollection();

            pc.Add("groupid", groupid);
            try
            {
                BeginTransaction();

                if (Delete(groupid) > 0)
                {
                    ExecuteNonQuery(deleteCustomerAttributesSQL, pc);
                    string dropTableSQL = DTableUtil.GetDropTableSQL(TableName);
                    ExecuteNonQuery(dropTableSQL);

                    CommitTransaction();
                    result  = true;
                    message = "成功删除客户属性信息";
                    GetCustomeGroupInfoList(true);
                }
                else
                {
                    RollbackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollbackTransaction();
                LogUtil.Error("删除删除客户属性信息异常", ex);
                throw ex;
            }

            return(result);
        }
Example #22
0
        public void ClickWeaponHandler()
        {
            if (!FunctionOpen.Model.FunctionOpenProxy.instance.IsFunctionOpen(FunctionOpenType.MainView_Equipment, true))
            {
                return;
            }
            RoleEquipmentsView roleEquipmentsView = UIMgr.instance.Open <RoleEquipmentsView>(RoleEquipmentsView.PREFAB_PATH);

            roleEquipmentsView.SetPlayerInfo(GameProxy.instance.PlayerInfo);
            RoleAttackAttributeType roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(GameProxy.instance.PlayerInfo.heroData.roleType);

            if (roleAttackAttributeType == RoleAttackAttributeType.PhysicalAttack)
            {
                roleEquipmentsView.SetCurrentSelectEquipmentType(EquipmentType.PhysicalWeapon);
            }
            else if (roleAttackAttributeType == RoleAttackAttributeType.MagicalAttack)
            {
                roleEquipmentsView.SetCurrentSelectEquipmentType(EquipmentType.MagicalWeapon);
            }
        }
Example #23
0
    public void setParts(HeroPartsData hpd, int rare)
    {
        string partsName = hpd.vehicleResource;

        foreach (SkinnedMeshRenderer smr in smrs)
        {
            if (smr.gameObject.name.Contains("parts"))
            {
                if (smr.name.Equals(partsName))
                {
                    smr.gameObject.SetActive(true);
                    CharacterUtil.setPartsTexture(smr, hpd);
                }
                else
                {
                    smr.gameObject.SetActive(false);
                }
            }
        }
    }
        private void RefreshPlayerLevelAndAttributes(PlayerInfo playerInfo)
        {
            int   playerLevel    = playerInfo.level;
            int   playerMaxLevel = GlobalData.GetGlobalData().playerLevelMax;
            float playerExpPercentToNextLevel = PlayerUtil.GetPlayerExpPercentToNextLevel(playerInfo);

            playerLevelText.text      = playerLevel.ToString();
            playerLevelMaxText.text   = playerMaxLevel.ToString();;
            playerExpSlider.value     = playerExpPercentToNextLevel;
            playerExpPercentText.text = string.Format(Localization.Get("common.percent"), ((int)(playerExpPercentToNextLevel * 100)));

            Dictionary <RoleAttributeType, RoleAttribute> playerAttributeDictionary = PlayerUtil.CalcPlayerAttributesDic(playerInfo);

            hpText.text = playerAttributeDictionary[RoleAttributeType.HP].ValueString;

            RoleAttackAttributeType roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(playerInfo.heroData.roleType);
            int offence = 0;

            if (roleAttackAttributeType == RoleAttackAttributeType.PhysicalAttack)
            {
                offence = (int)playerAttributeDictionary[RoleAttributeType.NormalAtk].value;
            }
            else if (roleAttackAttributeType == RoleAttackAttributeType.MagicalAttack)
            {
                offence = (int)playerAttributeDictionary[RoleAttributeType.MagicAtk].value;
            }
            attackText.text = offence.ToString();

            defenceText.text = playerAttributeDictionary[RoleAttributeType.Normal_Def].ValueString;
            speedText.text   = playerAttributeDictionary[RoleAttributeType.Speed].ValueString;

            float crit  = playerAttributeDictionary.ContainsKey(RoleAttributeType.Crit) ? playerAttributeDictionary[RoleAttributeType.Crit].value : 0;
            float dodge = playerAttributeDictionary.ContainsKey(RoleAttributeType.Dodge) ? playerAttributeDictionary[RoleAttributeType.Dodge].value : 0;
            float block = playerAttributeDictionary.ContainsKey(RoleAttributeType.Block) ? playerAttributeDictionary[RoleAttributeType.Block].value : 0;
            float hit   = playerAttributeDictionary.ContainsKey(RoleAttributeType.Hit) ? playerAttributeDictionary[RoleAttributeType.Hit].value : 0;

            critText.text  = string.Format(Localization.Get("common.percent"), crit);
            dodgeText.text = string.Format(Localization.Get("common.percent"), dodge);
            blockText.text = string.Format(Localization.Get("common.percent"), block);
            hitText.text   = string.Format(Localization.Get("common.percent"), hit);
        }
        /// <summary>
        /// 根据ID删除客户属性信息。
        /// </summary>
        /// <param name="departmentId"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public bool DeleteCustomerAttributeById(string extattributeid, out string message)
        {
            message = "操作失败,请与管理员联系";
            bool result = false;
            CustomerExtAttributesModel model = GetCustomerAttributeById(extattributeid, true);


            Dictionary <string, CustomerAttributeGroupInfoModel> dict = CustomerAttributeGroupInfoService.Instance.GetCustomeGroupInfoList(true);

            CustomerAttributeGroupInfoModel oldInfo = dict[model.GroupId];

            try
            {
                BeginTransaction();
                string TableName      = "customer_info_" + CharacterUtil.ConvertToPinyin(oldInfo.GroupName);
                string deleteFieldSQL = DTableUtil.GetDeleteFieldSQL(TableName, model.AttributeName);

                ExecuteNonQuery(deleteFieldSQL);
                if (Delete(extattributeid) > 0)
                {
                    CommitTransaction();
                    result  = true;
                    message = "成功删除客户属性信息";
                    GetCustomerAttributeList(extattributeid, true);
                }
                else
                {
                    RollbackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollbackTransaction();
                LogUtil.Error("删除删除客户属性信息异常", ex);
                throw ex;
            }

            return(result);
        }
Example #26
0
        /// <summary>
        ///获取属性(给定type列表)
        /// </summary>

        public static List <RoleAttribute> CalcPlayerAttributesList(PlayerInfo player, List <RoleAttributeType> needTypes)
        {
            List <RoleAttribute>    mainAttriList = new List <RoleAttribute>();
            List <RoleAttribute>    attriList     = CalcPlayerAttributesDic(player).GetValues();
            RoleAttribute           attribute;
            RoleAttackAttributeType roleAttackAttributeType = CharacterUtil.GetRoleAttackAttributeType(player.heroData.roleType);

            for (int i = 0, count = attriList.Count; i < count; i++)
            {
                attribute = attriList[i];
                if (needTypes.Contains(attribute.type))
                {
                    if (attribute.type == RoleAttributeType.MagicAtk)
                    {
                        if (roleAttackAttributeType == RoleAttackAttributeType.MagicalAttack)
                        {
                            mainAttriList.Add(attribute);
                        }
                    }
                    else if (attribute.type == RoleAttributeType.NormalAtk)
                    {
                        if (roleAttackAttributeType == RoleAttackAttributeType.PhysicalAttack)
                        {
                            mainAttriList.Add(attribute);
                        }
                    }
                    else if (attribute.type == RoleAttributeType.Normal_Def)
                    {
                        mainAttriList.Add(attribute);
                    }
                    else
                    {
                        mainAttriList.Add(attribute);
                    }
                }
            }
            return(mainAttriList);
        }
Example #27
0
        public static DapperResult DeleteResultForRole(IIdentity _identity, string xml, string sql)
        {
            string[]      sqls  = { };
            List <string> lists = new List <string>();
            var           list  = Utility.GetRecordIDList(_identity);
            Hashtable     ht    = Utility.HtFromPage(_identity);
            int           i     = 0;

            foreach (var id in list)
            {
                if (string.IsNullOrEmpty(id))
                {
                    continue;
                }
                ht.Remove("RecordID");
                ht.Add("RecordID", CharacterUtil.SQLEncode(id));
                lists.Add(SQLLoaderComponent.GetSQLQuery(xml, sql, ht));
                i++;
            }
            var dar = DapperContext.ExecuteTrans(lists);

            return(dar);
        }
        public string setItem(string content, string type)
        {
            DBCommonDictionary dic = dictionaryWithField(type);

            if (dic == null)
            {
                return("字典类型有误");
            }
            DBCommonDictionaryItem item = dic.get(content);

            if (item == null)
            {
                item          = new DBCommonDictionaryItem();
                item.id       = nextId();
                item.content  = content;
                item.dic_type = type;
                item.shortcut = CharacterUtil.getPinyinShort(content, 50);
                item.index    = nextIndex(type);
                dic.items.Add(item);
                return(save(item));
            }
            return("");
        }
Example #29
0
    void UpdateRankInfo()
    {
        //return;

        var cs = GameManager.instance.GetCharacters();

        CharacterUtil.InsertionSort <BaseCharacter>(cs, CharacterUtil.Compare); // .Sort((BaseCharacter cx, BaseCharacter cy) => cy.TotalLength - cx.TotalLength);
        for (int i = 0, length = _RankItems.Count; i < length; i++)
        {
            var item = _RankItems[i];
            if (cs.Count - 1 < i)
            {
                if (item.gameObject.activeSelf)
                {
                    item.gameObject.SetActive(false);
                }
                continue;
            }
            else
            {
                if (!item.gameObject.activeSelf)
                {
                    item.gameObject.SetActive(true);
                }
            }
            var character = cs[i];
            Assert.IsNotNull(character);
            if (PlayerController.instance != null)
            {
                item.SetData(character.Name, (int)character.Scores, character.CharacterUniqueID == PlayerController.instance.CharacterUniqueID);
            }
            else
            {
                item.SetData(character.Name, (int)character.Scores, false);
            }
        }
    }
Example #30
0
        public static DapperResult SaveResultForSigleProduct(IIdentity _identity, string xml, string sql)
        {
            string[]      sqls     = { };
            List <string> lists    = new List <string>();
            Hashtable     ht       = Utility.HtFromPage(_identity);
            string        jsonText = Newtonsoft.Json.Linq.JObject.Parse(Utility.HtFromPageForDiscount(_identity))["RecordIDList"].ToString();
            var           mJObj    = Newtonsoft.Json.Linq.JArray.Parse(jsonText);

            for (int i = 0; i < mJObj.Count; i++)
            {
                Newtonsoft.Json.Linq.JObject oData = Newtonsoft.Json.Linq.JObject.Parse(mJObj[i].ToString());
                ht.Remove("OrderProductId");
                ht.Add("OrderProductId", CharacterUtil.SQLEncode(oData["OrderProductId"].ToString()));
                ht.Remove("OrderId");
                ht.Add("OrderId", CharacterUtil.SQLEncode(oData["OrderId"].ToString()));
                if (i == 0)
                {
                    lists.Add(SQLLoaderComponent.GetSQLQuery(xml, sql + "_Update", ht));
                }
            }
            var dar = DapperContext.ExecuteTrans(lists);

            return(dar);
        }