예제 #1
0
        public void Addt4Tel()
        {
            int id = 0;

            for (int i = 1; i <= 40000; i++)
            {
                for (int j = 1; j <= 4; j++)
                {
                    id++;
                    t4_tel model = new t4_tel();
                    foreach (var p in model.GetType().GetProperties().ToList())
                    {
                        if (p.Name == "column201")
                        {
                            p.SetValue(model, id);
                        }
                        else if (p.Name == "column202")
                        {
                            p.SetValue(model, i);
                        }
                        else
                        {
                            p.SetValue(model, p.Name.ToString() + "-" + i.ToString() + "-" + j.ToString());
                        }
                    }
                    model.Insert();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 获取详情信息
        /// </summary>
        /// <param name="houseId">房屋ID</param>
        /// <returns></returns>
        public async Task <T4_House_Show> QueryInformation(string houseId)
        {
            // 获取房屋信息
            string   sql        = $"select * from T4_House where column1='{houseId}'";
            T4_House houseModel = await dataService.GetSingleAsync <T4_House>(sql);

            // 获取房屋实体类属性
            Type typeInfo   = typeof(T4_House);
            var  properties = typeInfo.GetProperties().ToList();
            // 获取可修改的列
            List <t4_code> modifyColumns = new t4_code().Select <t4_code>();

            Parallel.ForEach(modifyColumns, p =>
            {
                sql = $"select * from t4_json where houseid='{houseId}' and codeid='{p.id}'";
                // 获取列修改的信息
                List <t4_json> jsonModel             = new t4_json(true).Select <t4_json>(sql);
                List <T4_ModifyJsonModel> jsonModify = JsonConvert.DeserializeObject <List <T4_ModifyJsonModel> >(jsonModel[0].jsonstr);
                T4_ModifyJsonModel mdify             = jsonModify.OrderByDescending(a => a.Column207).FirstOrDefault();
                PropertyInfo proInfo = properties.Where(o => o.Name == p.name).FirstOrDefault();

                if (proInfo != null)
                {
                    // 给房屋信息赋值
                    proInfo.SetValue(houseModel, mdify.Column205);
                }
            });
            // 获取电话信息
            List <t4_tel> telList        = new t4_tel().Select <t4_tel>(houseModel.column10, "column202");
            T4_House_Show houseShowModel = new T4_House_Show();

            BaseModel.Mapper(houseShowModel, houseModel);
            houseShowModel.column10 = telList;
            return(houseShowModel);
        }