public static JavaScriptObject CardUserToJson(CardUser cardUser)
        {
            JavaScriptObject obj2 = new JavaScriptObject();

            obj2.Add("ID", cardUser.Id);
            obj2.Add("WaterUserId", cardUser.WaterUserId);
            obj2.Add("SerialNumber", cardUser.SerialNumber);
            obj2.Add("UserNo", cardUser.UserNo.Trim().TrimStart('0'));
            obj2.Add("ResidualWater", cardUser.ResidualWater);
            obj2.Add("ResidualElectric", cardUser.ResidualElectric);
            obj2.Add("TotalWater", cardUser.TotalWater);
            obj2.Add("TotalElectric", cardUser.TotalElectric);
            obj2.Add("TotallMoney", cardUser.TotallMoney);
            obj2.Add("DeviceList", cardUser.DeviceList);
            obj2.Add("IsCountermand", cardUser.IsCountermand == 0 ? "否" : "是");
            obj2.Add("OpenTime", cardUser.OpenTime.ToString("yyyy-MM-dd HH:mm:ss"));
            obj2.Add("LastChargeTime", cardUser.LastChargeTime > DateTime.Parse("2010-1-1") ? cardUser.LastChargeTime.ToString("yyyy-MM-dd HH:mm:ss") : "");

            WaterUser waterUser = WaterUserModule.GetWaterUserById(cardUser.WaterUserId);

            if (waterUser != null)
            {
                obj2.Add("UserName", waterUser.UserName);
                obj2.Add("IdentityNumber", waterUser.IdentityNumber);
                obj2.Add("Telephone", waterUser.Telephone);
                District node  = DistrictModule.ReturnDistrictInfo(waterUser.DistrictId);
                District node2 = DistrictModule.ReturnDistrictInfo(node.ParentId);
                District node3 = DistrictModule.ReturnDistrictInfo(node2.ParentId);
                District node4 = DistrictModule.ReturnDistrictInfo(node3.ParentId);
                District node5 = DistrictModule.ReturnDistrictInfo(node4.ParentId);
                obj2.Add("省ID", node5.Id);
                obj2.Add("市ID", node4.Id);
                obj2.Add("区县ID", node3.Id);
                obj2.Add("乡镇ID", node2.Id);
                obj2.Add("村庄ID", node.Id);
            }
            else
            {
                obj2.Add("UserName", "未知");
                obj2.Add("IdentityNumber", "未知");
                obj2.Add("Telephone", "未知");
                obj2.Add("省ID", "未知");
                obj2.Add("市ID", "未知");
                obj2.Add("区县ID", "未知");
                obj2.Add("乡镇ID", "未知");
                obj2.Add("村庄ID", "未知");
            }

            return(obj2);
        }
        public static List <CardUser> GetCardUsersByDistrictId(long DistrictId, bool IsCountermand)
        {
            List <CardUser> list = new List <CardUser>();

            lock (dicCardUsersById)
            {
                foreach (KeyValuePair <long, CardUser> pair in dicCardUsersById)
                {
                    WaterUser wu = WaterUserModule.GetWaterUserById(pair.Value.WaterUserId);
                    if (wu.DistrictId == DistrictId)
                    {
                        if (!IsCountermand && pair.Value.IsCountermand == 0 || IsCountermand)
                        {
                            list.Add(Tools.Copy <CardUser>(pair.Value));
                        }
                    }
                }
            }
            return(list);
        }