Beispiel #1
0
        public string GetSellerTreeData()
        {
            try
            {
                StringBuilder strTree = new StringBuilder();

                if (GetLoginUserVillages.Count == 0)
                {
                    return(strTree.ToString());
                }

                List <ParkSeller> sellers     = ParkSellerServices.QueryByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                BaseCompany       currCompany = GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == GetCurrentUserCompanyId);
                if (currCompany == null)
                {
                    return(string.Empty);
                }
                strTree.Append("[{\"id\":\"" + currCompany.CPID + "\",");
                strTree.Append("\"iconCls\":\"my-company-icon\",");
                strTree.Append("\"attributes\":{\"type\":0},");
                strTree.Append("\"text\":\"" + currCompany.CPName + "\"");
                GetVillageTree(sellers, currCompany.CPID, strTree);
                strTree.Append("}]");
                return(strTree.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建商家树结构失败");
                return(string.Empty);
            }
        }
Beispiel #2
0
        private void UpdateCompanyCacheData(BaseCompany model)
        {
            if (model.CPID == GetCurrentUserCompanyId)
            {
                Session["SmartCity_CurrLoginUser_Role_Company"] = model;
            }

            if (GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == model.CPID) != null)
            {
                GetLoginUserRoleCompany.Remove(GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == model.CPID));
                GetLoginUserRoleCompany.Add(model);
            }
        }
Beispiel #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("]");
        }
Beispiel #4
0
        public string CreateSelectVillageTreeData(bool needShowDefault = false, string defaultText = "不限")
        {
            StringBuilder str = new StringBuilder();

            try
            {
                str.Append("[");
                if (needShowDefault)
                {
                    str.Append("{\"id\":\"\",");
                    str.Append("\"attributes\":{\"type\":1},");
                    str.Append("\"text\":\"" + defaultText + "\"");
                    str.Append("}");
                    if (GetLoginUserVillages.Count > 0)
                    {
                        str.Append(",");
                    }
                }
                int index = 1;
                foreach (var item in GetLoginUserVillages)
                {
                    BaseCompany company = GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == item.CPID);
                    if (company == null)
                    {
                        index++;
                        continue;
                    }
                    str.Append("{\"id\":\"" + item.VID + "\",");
                    str.Append("\"attributes\":{\"type\":1},");
                    str.Append("\"iconCls\":\"my-village-icon\",");
                    str.AppendFormat("\"text\":\"{0}\"", string.Format("{0}【{1}】", item.VName, company.CPName));
                    str.Append("}");
                    if (index != GetLoginUserVillages.Count())
                    {
                        str.Append(",");
                    }
                    index++;
                }
                str.Append("]");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建小区下拉结构树失败");
            }
            return(str.ToString());
        }
Beispiel #5
0
        public string GetPrakAreaTreeData()
        {
            try
            {
                StringBuilder       strAreaTree = new StringBuilder();
                List <BaseParkinfo> parkings    = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList());
                if (parkings.Count == 0)
                {
                    return(string.Empty);
                }

                List <ParkArea> parkAreas = ParkAreaServices.GetParkAreaByParkingIds(parkings.Select(p => p.PKID).ToList());

                strAreaTree.Append("[");
                int index = 1;
                foreach (var item in GetLoginUserVillages)
                {
                    BaseCompany company = GetLoginUserRoleCompany.FirstOrDefault(p => p.CPID == item.CPID);
                    if (company == null)
                    {
                        continue;
                    }

                    string text = string.Format("{0}【{1}】", item.VName, company.CPName);
                    strAreaTree.Append("{\"id\":\"" + item.VID + "\",");
                    strAreaTree.Append("\"iconCls\":\"my-village-icon\",");
                    strAreaTree.Append("\"attributes\":{\"type\":0},");
                    strAreaTree.Append("\"text\":\"" + text + "\"");
                    GetParkingTreeData(parkings, parkAreas, item.VID, strAreaTree);
                    strAreaTree.Append("}");
                    if (index != GetLoginUserVillages.Count)
                    {
                        strAreaTree.Append(",");
                    }
                    index++;
                }

                strAreaTree.Append("]");
                return(strAreaTree.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建车场区域树失败");
                return(string.Empty);
            }
        }