示例#1
0
        private void GetVillageTreeData(string companyId, List <BaseParkinfo> parkings, StringBuilder strParkingTree)
        {
            List <BaseVillage> villages = GetLoginUserVillages.Where(p => p.CPID == companyId).ToList();

            if (villages.Count == 0)
            {
                return;
            }

            strParkingTree.Append(",\"children\":[");
            int i = 1;

            foreach (var item in villages)
            {
                strParkingTree.Append("{");
                strParkingTree.AppendFormat("\"id\":\"{0}\"", item.VID);
                strParkingTree.AppendFormat(",\"text\":\"{0}\"", item.VName);
                strParkingTree.Append(",\"iconCls\":\"my-village-icon\"");
                strParkingTree.Append(",\"attributes\":{\"type\":1}");
                GetParkingTreeData(companyId, item.VID, parkings, strParkingTree);
                strParkingTree.Append("}");
                if (i != villages.Count())
                {
                    strParkingTree.Append(",");
                }
                i++;
            }
            strParkingTree.Append("]");
        }
示例#2
0
        private void CreateSubordinateVillageTreeDataOnlineStatus(List <BaseCompany> companys, string masterId, StringBuilder str)
        {
            List <BaseVillage> villages    = GetLoginUserVillages.Where(p => p.CPID == masterId).ToList();
            List <BaseCompany> subCompanys = companys.Where(p => p.MasterID == masterId).ToList();

            str.Append(",\"children\":[");
            int i = 1;

            foreach (var item in subCompanys)
            {
                str.Append("{");
                str.AppendFormat("\"id\":\"{0}\"", item.CPID);

                str.Append(",\"iconCls\":\"my-company-icon\"");
                str.AppendFormat(",\"text\":\"{0}\"", item.CPName);
                str.Append(",\"attributes\":{\"type\":0}");
                CreateSubordinateVillageTreeDataOnlineStatus(companys, item.CPID, str);
                str.Append("}");
                if (i != subCompanys.Count())
                {
                    str.Append(",");
                }
                i++;
            }
            if (subCompanys.Count > 0 && villages.Count > 0)
            {
                str.Append(",");
            }
            int index = 1;

            foreach (var item in villages)
            {
                str.Append("{");
                str.AppendFormat("\"id\":\"{0}\"", item.VID);
                if (item.IsOnLine == 1)
                {
                    str.Append(",\"iconCls\":\"icon-status-yes\"");
                }
                else
                {
                    str.Append(",\"iconCls\":\"icon-status-no\"");
                }
                str.AppendFormat(",\"text\":\"{0}\"", item.VName);
                str.Append(",\"attributes\":{\"type\":1,\"CompanyID\":\"" + item.CPID + "\"}");
                str.Append("}");
                if (index != villages.Count())
                {
                    str.Append(",");
                }
                index++;
            }
            str.Append("]");
        }
示例#3
0
        private void GetVillageTree(List <ParkSeller> sellers, string companyId, StringBuilder strTree)
        {
            List <BaseVillage> villages = GetLoginUserVillages.Where(p => p.CPID == companyId).ToList();
            List <BaseCompany> companys = GetLoginUserRoleCompany.Where(p => p.MasterID == companyId).ToList();

            if (villages.Count == 0 && companys.Count == 0)
            {
                return;
            }

            strTree.Append(",\"children\":[");
            int i = 1;

            foreach (var item in companys)
            {
                strTree.Append("{");
                strTree.AppendFormat("\"id\":\"{0}\"", item.CPID);
                strTree.Append(",\"iconCls\":\"my-company-icon\"");
                strTree.AppendFormat(",\"text\":\"{0}\"", item.CPName);
                strTree.Append(",\"attributes\":{\"type\":0}");
                GetVillageTree(sellers, item.CPID, strTree);
                strTree.Append("}");
                if (i != companys.Count())
                {
                    strTree.Append(",");
                }
                i++;
            }
            if (companys.Count > 0 && villages.Count > 0)
            {
                strTree.Append(",");
            }
            int index = 1;

            foreach (var item in villages)
            {
                strTree.Append("{");
                strTree.AppendFormat("\"id\":\"{0}\"", item.VID);
                strTree.Append(",\"iconCls\":\"my-village-icon\"");
                strTree.AppendFormat(",\"text\":\"{0}\"", item.VName);
                strTree.Append(",\"attributes\":{\"type\":0,\"CompanyID\":\"" + item.CPID + "\"}");
                GetParkSellerTree(item.VID, sellers, strTree);
                strTree.Append("}");
                if (index != villages.Count())
                {
                    strTree.Append(",");
                }
                index++;
            }
            strTree.Append("]");
        }