Пример #1
0
 /// <summary>
 /// 通过NPC类型获取NPC
 /// </summary>
 /// <param name="types"></param>
 /// <returns></returns>
 public List <NpcInfoBean> GetNpcInfoByType(List <int> types)
 {
     return(mNpcInfoService.QueryDataByType(TypeConversionUtil.ListToArray(types)));
 }
Пример #2
0
    /// <summary>
    /// 链表插入数据
    /// </summary>
    /// <param name="itemData"></param>
    /// <param name="listLeftName"></param>
    public bool BaseInsertDataWithLeft <T>(T itemData, List <string> listLeftName)
    {
        //插入数据
        Dictionary <string, object> mapData = ReflexUtil.GetAllNameAndValue(itemData);
        List <string> listMainKeys          = new List <string>();
        List <string> listMainValues        = new List <string>();
        List <string> listLeftKeys          = new List <string>();
        List <string> listLeftValues        = new List <string>();

        foreach (var item in mapData)
        {
            string itemKey = item.Key;
            if (listLeftName.Contains(itemKey))
            {
                string valueStr = Convert.ToString(item.Value);
                listLeftKeys.Add(item.Key);
                if (item.Value == null)
                {
                    listLeftValues.Add("null");
                }
                else if (item.Value is string)
                {
                    if (CheckUtil.StringIsNull(valueStr))
                    {
                        listLeftValues.Add("null");
                    }
                    else
                    {
                        listLeftValues.Add("'" + valueStr + "'");
                    }
                }
                else if (item.Value == null)
                {
                    listLeftValues.Add("null");
                }
                else
                {
                    listLeftValues.Add(valueStr);
                }
            }
            else
            {
                string valueStr = Convert.ToString(item.Value);
                listMainKeys.Add(item.Key);
                if (item.Value == null)
                {
                    listMainValues.Add("null");
                }
                else if (item.Value is string)
                {
                    if (CheckUtil.StringIsNull(valueStr))
                    {
                        listMainValues.Add("null");
                    }
                    else
                    {
                        listMainValues.Add("'" + valueStr + "'");
                    }
                }
                else if (item.Value == null)
                {
                    listMainValues.Add("null");
                }
                else
                {
                    listMainValues.Add(valueStr);
                }
            }
        }
        bool isInsert = true;

        isInsert = SQLiteHandle.InsertValues(ProjectConfigInfo.DATA_BASE_INFO_NAME, tableNameForMain, TypeConversionUtil.ListToArray(listMainKeys), TypeConversionUtil.ListToArray(listMainValues));
        if (isInsert)
        {
            SQLiteHandle.InsertValues(ProjectConfigInfo.DATA_BASE_INFO_NAME, tableNameForLeft, TypeConversionUtil.ListToArray(listLeftKeys), TypeConversionUtil.ListToArray(listLeftValues));
        }
        return(isInsert);
    }
Пример #3
0
    public List <ItemsInfoBean> GetItemsInfoByIds(List <long> ids)
    {
        List <ItemsInfoBean> listData = GetItemsInfoByIds(TypeConversionUtil.ListToArray(ids));

        return(listData);
    }
Пример #4
0
    /// <summary>
    /// 插入数据
    /// </summary>
    /// <param name="tableName"></param>
    /// <param name="itemData"></param>
    public bool BaseInsertData <T>(string tableName, T itemData)
    {
        //插入数据
        Dictionary <string, object> mapData = ReflexUtil.GetAllNameAndValue(itemData);
        List <string> listKeys   = new List <string>();
        List <string> listValues = new List <string>();

        foreach (var item in mapData)
        {
            string itemKey  = item.Key;
            string valueStr = Convert.ToString(item.Value);
            listKeys.Add(item.Key);
            if (item.Value == null)
            {
                listValues.Add("null");
            }
            else if (item.Value is string)
            {
                if (CheckUtil.StringIsNull(valueStr))
                {
                    listValues.Add("null");
                }
                else
                {
                    listValues.Add("'" + valueStr + "'");
                }
            }
            else
            {
                listValues.Add(valueStr);
            }
        }
        return(SQLiteHandle.InsertValues(ProjectConfigInfo.DATA_BASE_INFO_NAME, tableName, TypeConversionUtil.ListToArray(listKeys), TypeConversionUtil.ListToArray(listValues)));
    }