Exemple #1
0
        public string GetScriptOnLoad(int currentAreaId)
        {
            if (currentAreaId == 0)
            {
                return(string.Empty);
            }

            var areaInfo = AreaManager.GetAreaInfo(currentAreaId);

            if (areaInfo == null)
            {
                return(string.Empty);
            }

            string path;

            if (areaInfo.ParentsCount <= 1)
            {
                path = currentAreaId.ToString();
            }
            else
            {
                path = areaInfo.ParentsPath.Substring(areaInfo.ParentsPath.IndexOf(",", StringComparison.Ordinal) + 1) + "," + currentAreaId;
            }
            return(AreaTreeItem.GetScriptOnLoad(path));
        }
Exemple #2
0
 /// <summary>
 /// 加载根节点、子节点数据到树中
 /// </summary>
 public void LoadItems()
 {
     datetime = DateTime.Now.AddDays(-1);
     AreaTreeItem.Clear();
     //添加根节点到树中
     foreach (var f in Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo)
     {
         this.AreaTreeItem.Add(new AreaTreeItemModel(null, f.Value, true));
     }
     foreach (var t in AreaTreeItem)
     {
         if (t.NodeType != TreeNodeType.IsPartition)
         {
             continue;
         }
         t.AddChild();
     }
     LoadTmlsData();
     ReLoadTmlsAreasBelong();
     foreach (var f in AreaTreeItem)
     {
         if (f.NodeId >= AddIdMax)
         {
             AddIdMax = f.NodeId + 1;
         }
     }
 }
Exemple #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("Delete") && Body.IsQueryExists("AreaIDCollection"))
            {
                var areaIdArrayList = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("AreaIDCollection"));
                foreach (var areaId in areaIdArrayList)
                {
                    DataProvider.AreaDao.Delete(areaId);
                }
                SuccessMessage("成功删除所选区域");
            }
            else if (Body.IsQueryExists("AreaID") && (Body.IsQueryExists("Subtract") || Body.IsQueryExists("Add")))
            {
                var areaId     = int.Parse(Body.GetQueryString("AreaID"));
                var isSubtract = Body.IsQueryExists("Subtract");
                DataProvider.AreaDao.UpdateTaxis(areaId, isSubtract);

                PageUtils.Redirect(GetRedirectUrl(areaId));
                return;
            }

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.Permissions.Settings.Admin);

            ClientScriptRegisterClientScriptBlock("NodeTreeScript", AreaTreeItem.GetScript(EAreaLoadingType.Management, null));

            if (Body.IsQueryExists("CurrentAreaID"))
            {
                _currentAreaId = Body.GetQueryInt("CurrentAreaID");
                var onLoadScript = GetScriptOnLoad(_currentAreaId);
                if (!string.IsNullOrEmpty(onLoadScript))
                {
                    ClientScriptRegisterClientScriptBlock("NodeTreeScriptOnLoad", onLoadScript);
                }
            }

            BtnAdd.Attributes.Add("onclick", ModalAreaAdd.GetOpenWindowStringToAdd(GetRedirectUrl(0)));

            var urlDelete = PageUtils.GetSettingsUrl(nameof(PageAdminArea), new NameValueCollection
            {
                { "Delete", "True" }
            });

            BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlDelete, "AreaIDCollection", "AreaIDCollection", "请选择需要删除的区域!", "此操作将删除对应区域以及所有下级区域,确认删除吗?"));

            BindGrid();
        }
Exemple #4
0
        public static string GetAreaRowHtml(AreaInfo areaInfo, EAreaLoadingType loadingType, NameValueCollection additional)
        {
            var treeItem = AreaTreeItem.CreateInstance(areaInfo);
            var title    = treeItem.GetItemHtml(loadingType, additional, false);

            var rowHtml = string.Empty;

            if (loadingType == EAreaLoadingType.Management)
            {
                string editUrl = $@"<a href=""javascript:;"" onclick=""{ModalAreaAdd.GetOpenWindowStringToEdit(areaInfo.Id,
                    GetRedirectUrl(areaInfo.Id))}"">编辑</a>";

                var urlUp = PageUtils.GetSettingsUrl(nameof(PageAdminArea), new NameValueCollection
                {
                    { "Subtract", "True" },
                    { "AreaID", areaInfo.Id.ToString() }
                });
                string upLink = $@"<a href=""{urlUp}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";

                var urlDown = PageUtils.GetSettingsUrl(nameof(PageAdminArea), new NameValueCollection
                {
                    { "Add", "True" },
                    { "AreaID", areaInfo.Id.ToString() }
                });
                string downLink = $@"<a href=""{urlDown}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";

                string checkBoxHtml = $"<input type='checkbox' name='AreaIDCollection' value='{areaInfo.Id}' />";

                rowHtml = $@"
<tr treeItemLevel=""{areaInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td class=""text-center"">{areaInfo.CountOfAdmin}</td>
    <td class=""text-center"">{upLink}</td>
    <td class=""text-center"">{downLink}</td>
    <td class=""text-center"">{editUrl}</td>
    <td class=""text-center"">{checkBoxHtml}</td>
</tr>
";
            }
            return(rowHtml);
        }
Exemple #5
0
        public void AddArea(AreaInfo.AreaItem gi)
        {
            var t = new AreaTreeItemModel(null, gi, true);

            AreaTreeItem.Add(t);
        }