Exemple #1
0
    void CompileTimeLine(NodeCode parent, int index, CodeBlock targetFunctionBlock)
    {
        CodeBlock TimeLineCodeBlock = new CodeBlock(new Variable()
        {
            Var = "void TimeLine_" + index + "()"
        }, new List <ICodeBase>());

        targetFunctionBlock.CommandLines.Add(TimeLineCodeBlock);

        ((CodeBlock)(targetFunctionBlock.CommandLines[1])).CommandLines.Add(new Variable(
                                                                                "TimelineEvents.Add(new TimeLineEvent(" + parent.logicParamCode.ToCodeText() + ", TimeLine_" + index + "));\n"
                                                                                ));

        List <NodePointData> flowPoint   = parent.GetPointData(ConnectionPointType.Out);
        NodePointData        currentFlow = flowPoint[0];

        if (currentFlow.connections.Count == 0)
        {
            return;
        }

        NodeCode nextCode = guidMap.GetCode(guidMap.GetData <NodePointData>(
                                                guidMap.GetData <NodeConnectionData>(currentFlow.connections[0]).inGUID).nodeGUID);

        CompileFunction(nextCode, TimeLineCodeBlock);
    }
    void CompileFunction(NodeCode parent, CodeBlock targetFunctionBlock)
    {
        List <NodePointData> flowPoint = parent.GetPointData(ConnectionPointType.Out);

        NodePointData currentFlow = flowPoint[0];

        if (parent.funcNodeData.nodeType == NodeType.Event)
        {
            if (currentFlow.connections.Count == 0)
            {
                return;
            }

            NodeCode nextCode = guidMap.GetCode(guidMap.GetData <NodePointData>(
                                                    guidMap.GetData <NodeConnectionData>(currentFlow.connections[0]).inGUID).nodeGUID);
            CompileFunction(nextCode, targetFunctionBlock);
        }
        else if (parent.funcNodeData.nodeType == NodeType.Condition)
        {
            if (currentFlow.connections.Count != 0)
            {
                NodeCode nextCode = guidMap.GetCode(guidMap.GetData <NodePointData>(
                                                        guidMap.GetData <NodeConnectionData>(currentFlow.connections[0]).inGUID).nodeGUID);
                CompileFunction(nextCode, ((ConditionCode)parent.code).isTrue);
            }

            currentFlow = flowPoint[1];

            if (currentFlow.connections.Count != 0)
            {
                NodeCode nextCode = guidMap.GetCode(guidMap.GetData <NodePointData>(
                                                        guidMap.GetData <NodeConnectionData>(currentFlow.connections[0]).inGUID).nodeGUID);
                CompileFunction(nextCode, ((ConditionCode)parent.code).isFalse);
            }

            targetFunctionBlock.CommandLines.Add(parent.code);
        }
        //add for
        else
        {
            targetFunctionBlock.CommandLines.Add(new CodeLine()
            {
                code = parent.code
            });

            if (currentFlow.connections.Count == 0)
            {
                return;
            }

            NodeCode nextCode = guidMap.GetCode(guidMap.GetData <NodePointData>(
                                                    guidMap.GetData <NodeConnectionData>(currentFlow.connections[0]).inGUID).nodeGUID);
            CompileFunction(nextCode, targetFunctionBlock);
        }
    }
Exemple #3
0
    public void CompileCode()
    {
        List <NodeCode> nodes = new List <NodeCode>();

        foreach (var node in data.nodeDatas)
        {
            nodes.Add(new NodeCode(guidMap, node));
        }

        foreach (var node in data.nodeFuncDatas)
        {
            nodes.Add(new NodeCode(guidMap, node));
        }

        foreach (var node in nodes)
        {
            node.AttachParameter();
        }

        List <NodeCode> parents = nodes.FindAll((node) => node.funcNodeData.methodName == "TimeLine");

        foreach (var node in parents)
        {
            CompileTimeLine(node, data.nodeDatas.FindIndex((n) => n == node.funcNodeData), classCode.ClassBlock);
        }

        NodeCode parent = nodes.Find((node) => node.funcNodeData.methodName == "Start");

        if (parent != null)
        {
            CompileFunction(parent, (CodeBlock)classCode.ClassBlock.CommandLines[1]);
        }

        parent = nodes.Find((node) => node.funcNodeData.methodName == "Update");
        if (parent != null)
        {
            CompileFunction(parent, (CodeBlock)classCode.ClassBlock.CommandLines[2]);
        }


        parent = nodes.Find((node) => node.funcNodeData.methodName == "Finish");
        if (parent != null)
        {
            CompileFunction(parent, (CodeBlock)classCode.ClassBlock.CommandLines[3]);
        }
    }
Exemple #4
0
    public void AttachParameter()
    {
        List <NodePointData> parameterPoint = GetPointData(ConnectionPointType.Parameter);

        foreach (var param in parameterPoint)
        {
            if (param.connections.Count == 0)
            {
                Variable var = new Variable();
                if (param.parameterType == typeof(string).FullName)
                {
                    var.Var = "\"" + param.cachedValue + "\"";
                }
                else if (param.parameterType == typeof(float).FullName)
                {
                    var.Var = param.cachedValue + "f";
                }
                else if (param.parameterType == typeof(bool).FullName)
                {
                    var.Var = param.cachedValue.ToLower();
                }
                else
                {
                    var.Var = param.cachedValue;
                }

                if (connectMapping.ContainsKey(param.GUID))
                {
                    connectMapping[param.GUID].connectiongAction.Invoke(var);
                }
            }
            else
            {
                NodeCode paramCode = guidMap.GetCode(guidMap.GetData <NodePointData>(guidMap.GetData <NodeConnectionData>(param.connections[0]).outGUID).nodeGUID);
                connectMapping[param.GUID].connectiongAction.Invoke(paramCode.code);
            }
        }
    }
Exemple #5
0
        protected void btnTemplateNodeEdit_Click(object sender, EventArgs e)
        {
            string returnMsg = "";

            KingTop.Model.SysManage.WebSiteTemplateNode mode = new KingTop.Model.SysManage.WebSiteTemplateNode();

            mode.ID         = Utils.ParseInt(ID, 0);
            mode.TemplateID = Utils.ParseInt(TemplateID, 0);
            mode.NodeName   = Utils.HtmlEncode(txtNodeName.Text.Trim());
            if (txtLink.Text.Length > 0)
            {
                mode.LinkURL = Utils.HtmlEncode(txtLink.Text.Trim());
            }
            if (ddlModeID.SelectedValue != "0")
            {
                mode.ModuleID = new Guid(ddlModeID.SelectedValue.Trim());
            }
            mode.NodeType            = chkNodeType.Checked ? "1" : "0";
            mode.IsValid             = Utils.ParseBool(RBL_IsValid.SelectedValue);
            mode.NodelOrder          = Utils.HtmlEncode(txtNodelOrder.Text.Trim());
            mode.NodelDesc           = Utils.HtmlEncode(txtNodelDesc.Text.Trim());
            mode.NodelEngDesc        = Utils.HtmlEncode(txtNodelEngDesc.Text.Trim());
            mode.IsSystem            = Utils.ParseBool(chkIsSystem.Checked);
            mode.IsContainWebContent = Utils.ParseBool(chkIsContainWebContent.Checked);
            mode.IsWeb = false;
            if (ddlReviewFlow.SelectedValue != "0")
            {
                mode.ReviewFlowID = this.ddlReviewFlow.SelectedValue;
            }


            if (this.Action == "EDIT")
            {
                #region 修改模块节点
                if (IsHaveRightByOperCode("Edit"))
                {
                    mode.NodeCode   = Utils.HtmlEncode(hidNodeCode.Value);
                    mode.ParentNode = NodeCode.Substring(0, NodeCode.Length - 3);
                    if (mode.ParentNode == "")
                    {
                        mode.ParentNode = "0";
                    }
                    //根据NodeCode得到子栏目下最大的NodeCode
                    DataTable dtNodeCode = bll.GetList("MAXCODE", Utils.getOneParams(hidNodeCode.Value));
                    if (dtNodeCode.Rows[0]["NodeCode"].ToString() != "")
                    {
                        //如果没有子栏目,用户可随意修改[父级栏目]属性,如果有子栏目,则不给它赋值

                        mode.NodeType = chkNodeType.Checked ? "1" : "0";
                    }
                    returnMsg = bll.Save("EDIT", mode);
                    string logTitle = Request.Form["hidLogTitle"];
                    if (logTitle != txtNodeName.Text)
                    {
                        logTitle = logTitle + " => " + txtNodeName.Text;
                    }
                    try
                    {
                        if (Convert.ToInt32(returnMsg) > 0)
                        {
                            WriteLog("修改" + txtNodeName.Text + "模板节点成功", "", 2);// 写入操作日志
                            Utils.RunJavaScript(this, "type=1;title='" + txtNodeName.Text.Replace("'", "\\'") + "';");
                        }
                    }
                    catch
                    {
                        WriteLog("修改" + txtNodeName.Text + "模板节点失败", returnMsg, 2);
                        Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "';");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有编辑模板节点的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }
            else
            {
                #region 新增模块节点
                if (IsHaveRightByOperCode("New"))
                {
                    //根据IsParent判断它是不是父节点,如果不是则不能添加子节点
                    if (NodeType == "1")
                    {
                        //如果是子栏目,则必须要选择栏目类型
                        if (!chkNodeType.Checked && ddlModeID.SelectedValue == "0")
                        {
                            Utils.RunJavaScript(this, "alert({msg:'请选择所属模块!',title:'提示信息'})");
                            return;
                        }
                        if (ddlNodeCode.SelectedValue != "0")
                        {
                            mode.NodeCode   = Utils.HtmlDecode(ddlNodeCode.SelectedValue);
                            mode.ParentNode = "0";//顶级节点ParentNode="0"
                        }
                        else
                        {
                            //根据NodeCode得到子栏目下最大的NodeCode
                            DataTable dtNodeCode = bll.GetList("MAXCODE", Utils.getOneParams(hidNodeCode.Value));
                            if (dtNodeCode.Rows[0]["NodeCode"].ToString() != "")
                            {
                                mode.NodeCode = Utils.HtmlDecode(dtNodeCode.Rows[0]["NodeCode"].ToString());
                            }
                            else
                            {
                                mode.NodeCode = this.NodeCode + "001";
                            }
                            mode.ParentNode = hidNodeCode.Value;
                        }
                        returnMsg = bll.Save("NEW", mode);
                        string logTitle = Request.Form["hidLogTitle"];
                        if (logTitle != txtNodeName.Text)
                        {
                            logTitle = logTitle + " => " + txtNodeName.Text;
                        }
                        try
                        {
                            if (Convert.ToInt32(returnMsg) > 0)
                            {
                                WriteLog(GetLogValue(logTitle, "Update", "TemplateNodeEdit", true), "", 2); //写日志
                                Utils.RunJavaScript(this, "type=0;title='" + txtNodeName.Text.Replace("'", "\\'") + "';");
                            }
                        }
                        catch
                        {
                            WriteLog(GetLogValue(logTitle, "Update", "TemplateNodeEdit", false), returnMsg, 3); //写日志
                            Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "';");
                        }
                    }
                    else//如果不是则不能添加子节点
                    {
                        Utils.RunJavaScript(this, "alert({msg:'上级栏目不是父栏目,不能添加子栏目!',title:'提示信息'})");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有新增模板节点的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }
        }
        /// <summary>
        /// 页面更新、删除
        /// </summary>
        private void LinkClick()
        {
            string actionType;
            string idStr;
            bool   isValidate;

            isValidate = false;

            if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["ID"]))    // 单记录更新
            {
                idStr = Request.QueryString["ID"];
            }
            else
            {
                idStr = Request.Form["_chkID"];                      // 批量更新
            }

            actionType = ctrManageList.GetLinkType();

            switch (actionType)
            {
            case "d":                           // 删除
                isValidate = IsHaveRightByOperCode("Delete");

                if (isValidate)
                {
                    ctrManageList.LinkDelete(idStr);
                }
                else
                {
                    jsMessage = "alert({msg:\"对不起,您没有 删除 操作权限,请与管理员联系!\",title:\"操作提示\"});";
                }

                break;

            case "e":                          // 更新
                isValidate = IsHaveRightByOperCode("Edit");

                if (isValidate)
                {
                    ctrManageList.LinkEdit(idStr);
                }
                else
                {
                    jsMessage = "alert({msg:\"对不起,您没有 编辑 操作权限,请与管理员联系!\",title:\"操作提示\"});";
                }
                break;

            case "HQB_PastFlowCheck":         // 通过审核
                //isValidate = IsHaveRightByOperCode("PastFlowCheck");
                isValidate = IsHaveRightByOperCode("Check");

                if (isValidate)
                {
                    ctrManageList.FlowCheck(true);
                }
                else
                {
                    jsMessage = "alert({msg:\"对不起,您没有 通过审核 操作权限,请与管理员联系!\",title:\"操作提示\"});";
                }
                break;

            case "HQB_CancelFlowCheck":       // 取消审核
                //isValidate = IsHaveRightByOperCode("CancelFlowCheck");
                isValidate = IsHaveRightByOperCode("CancelCheck");

                if (isValidate)
                {
                    ctrManageList.FlowCheck(false);
                }
                else
                {
                    jsMessage = "alert({msg:\"对不起,您没有 取消审核 操作权限,请与管理员联系!\",title:\"操作提示\"});";
                }
                break;

            case "h":                       // 生成HTML
                isValidate = IsHaveRightByOperCode("CreateHtml");

                if (isValidate)
                {
                    //模版方式生成静态页面
                    //ctrManageList.CreateHtml(idStr, this.SiteDir, GetUploadImgPath, GetUploadFileUrl(), GetUploadMediaUrl(), this.GetSiteDomain());

                    //if (string.IsNullOrEmpty(ctrManageList.LogException))
                    //{
                    //    jsMessage = "alert({msg:\"HTML页生成成功!\",title:\"操作提示\"});";
                    //}

                    //动态转静态
                    KingTop.WEB.SysAdmin.SysManage.AspxToHtml_Publish publish = new KingTop.WEB.SysAdmin.SysManage.AspxToHtml_Publish();
                    string        nodeList = "''";
                    List <string> lstMenu  = new List <string>();
                    for (int i = 6; i <= NodeCode.Length; i = i + 3)
                    {
                        nodeList += ",'" + NodeCode.Substring(0, i) + "'";
                        lstMenu.Add(NodeCode.Substring(0, i));
                    }
                    publish.IsBar        = false;
                    publish.IsContent    = true;
                    publish.IsIndex      = true;
                    publish.IsMenuList   = true;
                    publish.nodeCodeList = nodeList;
                    publish.PublishType  = 1;
                    publish.TypeParam    = new string[] { idStr };
                    publish.ListMenu     = lstMenu;
                    publish.siteDir      = SiteDir;
                    publish.siteID       = SiteID;
                    try
                    {
                        publish.Execute();
                    }
                    catch
                    {
                        jsMessage = "alert({msg:\"HTML页生成失败!\",title:\"操作提示\"});";
                    }
                }
                else
                {
                    jsMessage = "alert({msg:\"对不起,您没有 生成HTML 操作权限,请与管理员联系!\",title:\"操作提示\"});";
                }
                break;

            default:
                // 信息提示:参数传递不正确
                break;
            }

            if (!string.IsNullOrEmpty(ctrManageList.LogContent))
            {
                if (string.IsNullOrEmpty(ctrManageList.LogException)) // 失败
                {
                    WriteLog(ctrManageList.LogContent, ctrManageList.LogException, 3);
                }
                else // 成功
                {
                    WriteLog(ctrManageList.LogContent, string.Empty, 2);
                }
            }
        }
        private void PopulateTreeNode(QARETreeNode node)
        {
            NodeCode code = node.NodeCode;

            switch (code)
            {
            case NodeCode.NodeActor:
                ResourceClass.QAREFile.ActorStruct[] actors = areFile.actorList;
                for (int c = 0; c < actors.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(actors[c].fullName, code, c));
                }
                break;

            case NodeCode.NodeAmbient:
                ResourceClass.QAREFile.AmbientStruct[] ambients = areFile.ambientList;
                for (int c = 0; c < ambients.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(ambients[c].fullName, code, c));
                }
                break;

            case NodeCode.NodeAnim:
                ResourceClass.QAREFile.AnimStruct[] anims = areFile.animList;
                for (int c = 0; c < anims.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(anims[c].fullName, code, c));
                }
                break;

            case NodeCode.NodeContainer:
                ResourceClass.QAREFile.ContainerStruct[] containers = areFile.containerList;
                for (int c = 0; c < containers.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(containers[c].fullName, code, c));
                }
                break;

            case NodeCode.NodeDoor:
                ResourceClass.QAREFile.DoorStruct[] doors = areFile.doorList;
                for (int c = 0; c < doors.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(doors[c].fullName, code, c));
                }
                break;

            case NodeCode.NodeEntrance:
                ResourceClass.QAREFile.EntranceStruct[] entrances = areFile.entranceList;
                for (int c = 0; c < entrances.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(entrances[c].fullName, code, c));
                }
                break;

            case NodeCode.NodeInfoPt:
                ResourceClass.QAREFile.InfoptStruct[] infopts = areFile.infoptList;
                for (int c = 0; c < infopts.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(infopts[c].fullName, code, c));
                }
                break;

            case NodeCode.NodeMapnote:
                ResourceClass.QAREFile.MapNoteStruct[] mapNotes = areFile.mapNoteList;
                for (int c = 0; c < mapNotes.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode("Note", code, c));
                }
                break;

            case NodeCode.NodeProjectile:
                ResourceClass.QAREFile.ProjectileStruct[] projectiles = areFile.projectileList;
                for (int c = 0; c < projectiles.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(projectiles[c].resProjectile, code, c));
                }
                break;

            case NodeCode.NodeSpawn:
                ResourceClass.QAREFile.SpawnStruct[] spawns = areFile.spawnList;
                for (int c = 0; c < spawns.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(spawns[c].fullName, code, c));
                }
                break;

            case NodeCode.NodeVariable:
                ResourceClass.QAREFile.VariableStruct[] variables = areFile.varList;
                for (int c = 0; c < variables.Length; c++)
                {
                    node.Nodes.Add(new QARETreeNode(variables[c].varName, code, c));
                }
                break;

            default:
                MessageBox.Show("Error: Unknown Area Element");
                break;
            }
        }
 public override int GetHashCode()
 {
     return(NodeNumber * 31 + NodeCode.GetHashCode());
 }
Exemple #9
0
        /// <summary>
        /// this method had command before for drwing
        /// </summary>
        /// <param name="PostContainerEntity"></param>
        /// <param name="CellCount"></param>
        /// <param name="ProductCode"></param>
        public void DrawWeekJackPanel(Entity PostContainerEntity, int CellCount)
        {
            Editor ed    = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            bool   conti = true;


            double MyScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.WeekJackPanel).Scale;

            //ed.WriteMessage("DrawWeekJackPanel 01 \n");
            DrawWeekJackPanelJig MidJ = new DrawWeekJackPanelJig(PostContainerEntity, CellCount, MyScale);
            PromptResult         pr;

            while (conti)
            {
                pr = ed.Drag(MidJ);
                if (pr.Status == PromptStatus.OK)
                {
                    conti = false;
                    #region save data here
                    ObjectIdCollection OIC       = new ObjectIdCollection();
                    ObjectIdCollection HeadersOI = new ObjectIdCollection();

                    //ed.WriteMessage("DrawWeekJackPanel 02 \n");
                    List <Entity> Entities = new List <Entity>();
                    //ed.WriteMessage("DrawWeekJackPanel 03 \n");
                    Entities = MidJ.GetEntities();
                    //ed.WriteMessage("DrawWeekJackPanel 04 \n");
                    foreach (Entity ent in Entities)
                    {
                        Atend.Global.Acad.AcadJigs.MyPolyLine HeaderCablePoly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
                        //ed.WriteMessage("DrawWeekJackPanel 05 \n");
                        if (HeaderCablePoly != null)
                        {
                            ObjectId hoi = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.LOW_GROUND.ToString());
                            HeadersOI.Add(hoi);
                            OIC.Add(hoi);
                            //ed.WriteMessage("DrawWeekJackPanel 06 \n");
                        }
                        else
                        {
                            ObjectId NOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_GROUND.ToString());
                            if (NOI != ObjectId.Null)
                            {
                                OIC.Add(NOI);
                                Atend.Base.Acad.AT_INFO HeaderInfo = new Atend.Base.Acad.AT_INFO(NOI);
                                HeaderInfo.ParentCode  = _nodeCode.ToString();
                                HeaderInfo.NodeCode    = "";
                                HeaderInfo.NodeType    = (int)Atend.Control.Enum.ProductType.WeekJackPanel;
                                HeaderInfo.ProductCode = 0;
                                HeaderInfo.Insert();
                            }
                            //ed.WriteMessage("DrawWeekJackPanel 07 \n");
                        }
                    }



                    try
                    {
                        foreach (ObjectId HeaderOI in HeadersOI)
                        {
                            Atend.Base.Acad.AT_INFO HeaderInfo = new Atend.Base.Acad.AT_INFO(HeaderOI);
                            //ed.WriteMessage("Header Parent :{0}\n", p.CodeGuid);
                            HeaderInfo.ParentCode  = _nodeCode.ToString();
                            HeaderInfo.NodeCode    = "";
                            HeaderInfo.NodeType    = (int)Atend.Control.Enum.ProductType.HeaderCabel;
                            HeaderInfo.ProductCode = 0;
                            HeaderInfo.Insert();
                        }

                        ObjectId WeekGroup = Atend.Global.Acad.Global.MakeGroup(NodeCode.ToString(), OIC);

                        if (WeekGroup != ObjectId.Null)
                        {
                            Atend.Base.Acad.AT_INFO WeekInfo = new Atend.Base.Acad.AT_INFO(WeekGroup);
                            //ed.WriteMessage(">>>>>>Header Parent :{0} , WeekCode :{1} \n", p.ParentCode, p.CodeGuid);
                            WeekInfo.ParentCode  = _parentCode.ToString();
                            WeekInfo.NodeCode    = _nodeCode.ToString();
                            WeekInfo.NodeType    = (int)Atend.Control.Enum.ProductType.WeekJackPanel;
                            WeekInfo.ProductCode = _productCode;
                            WeekInfo.Insert();

                            //ed.WriteMessage("ADD TO POST WEEK\n");
                            Atend.Base.Acad.AT_SUB.AddToAT_SUB(WeekGroup, PostContainerEntity.ObjectId);
                            Atend.Base.Acad.AT_SUB.AddToAT_SUB(PostContainerEntity.ObjectId, WeekGroup);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        ed.WriteMessage("Error DrawWeekJackPanel : {0} \n", ex.Message);
                    }
                    #endregion
                }
                //else
                //{
                //    conti = false;
                //}
            }
        }
        protected void Edit(object sender, EventArgs e)
        {
            string msg;
            string listUrl;
            bool   isValidate;                                        // 权限验证

            ctrManageEdit.SiteID   = Utils.ParseInt(hdnSiteID.Value, 0);
            ctrManageEdit.NodeCode = hdnNodeID.Value;
            ctrManageEdit.FieldFromUrlParamValue = hdnFieldFromUrlParamValue.Value;
            listUrl = hdnTableName.Value.Replace("K_U_", "").Replace("K_F_", "") + "list.aspx?" + ctrManageEdit.KeepUrlParam;
            string msgTitle = string.IsNullOrEmpty(Request.Form["Title"]) ? "" : Request.Form["Title"].Replace("\"", "\\\"");

            if (!string.IsNullOrEmpty(this.ID))
            {
                isValidate = IsHaveRightByOperCode("Edit");  // 修改权限认证

                if (!isValidate)
                {
                    jsMessage         = "errmsg=\"对不起,您没有修改记录的操作权限,请与管理员联系!\";id=\"" + ID + "\"";
                    this.hsFieldValue = ctrManageEdit.HsEditField;
                    PageInit(); // 得新绑定数据

                    return;
                }
                else
                {
                    msg = ctrManageEdit.Edit(false, this.ID);

                    if (msg == "1")  // 更新成功
                    {
                        jsMessage = "type=1;title=\"" + msgTitle + " \";id=\"" + ctrManageEdit.RecordID + "\"";
                        WriteLog("更新记录 " + Request.Form["Title"] + "(ID:" + ctrManageEdit.RecordID + ") 成功!", null, 2);
                    }
                    else  // 失败
                    {
                        jsMessage = "errmsg=\"对不起,操作失败。\";type=2;id=\"" + ctrManageEdit.RecordID + "\";";
                        WriteLog("对不起,更新记录 " + Request.Form["Title"] + "(ID:" + ctrManageEdit.RecordID + ") 失败!", msg, 3);
                    }
                }
            }
            else
            {
                isValidate = IsHaveRightByOperCode("New");  // 添加权限认证
                SetModelCookies("search", null);
                SetModelCookies("searchlink", null);
                SetModelCookies("ModelPage", null);

                if (!isValidate)
                {
                    jsMessage         = "errmsg=\"对不起,您没有添加记录的操作权限,请与管理员联系!\";id=\"" + ID + "\"";
                    this.hsFieldValue = ctrManageEdit.HsEditField;
                    PageInit(); // 得新绑定数据

                    return;
                }
                else
                {
                    msg = ctrManageEdit.Edit(true, null);

                    if (msg == "1")  // 新增成功
                    {
                        jsMessage = "type=0;title=\"" + msgTitle + " \";id=\"" + ctrManageEdit.RecordID + "\"";
                        WriteLog("新增记录 " + Request.Form["Title"] + "(" + ctrManageEdit.RecordID + ") 成功!", null, 2);
                    }
                    else   // 失败
                    {
                        jsMessage = "errmsg=\"对不起,操作失败。\";type=2;id=\"" + ctrManageEdit.RecordID + "\";";
                        WriteLog("对不起,新增记录 " + Request.Form["Title"] + "(" + ctrManageEdit.RecordID + ") 失败!", msg, 3);
                    }
                }
            }

            if (ctrManageEdit.HsEditField.Contains("IsHtml") && Utils.ParseBool(ctrManageEdit.HsEditField.Contains("IsHtml")))   // 公用字段,是否生成HTML
            {
                isValidate = IsHaveRightByOperCode("CreateHtml");

                if (isValidate)
                {
                    //模版方式生成静态页面
                    //string[] arrLog;
                    //arrLog = ctrManageEdit.CreateHtml(ctrManageEdit.RecordID, this.SiteDir, GetUploadFileUrl(), GetUploadFileUrl(), GetUploadMediaUrl(), this.GetSiteDomain());
                    //if (!string.IsNullOrEmpty(arrLog[1]))
                    //{
                    //    jsMessage = "alert({msg:\"HTML页生成失败!\",title:\"操作提示\"});";
                    //    WriteLog(arrLog[0], arrLog[1], 3);
                    //}
                    //else
                    //{
                    //    WriteLog(arrLog[0], null, 2);
                    //}

                    //动态转静态
                    KingTop.WEB.SysAdmin.SysManage.AspxToHtml_Publish publish = new KingTop.WEB.SysAdmin.SysManage.AspxToHtml_Publish();
                    string        nodeList = "''";
                    List <string> lstMenu  = new List <string>();
                    for (int i = 6; i <= NodeCode.Length; i = i + 3)
                    {
                        nodeList += ",'" + NodeCode.Substring(0, i) + "'";
                        lstMenu.Add(NodeCode.Substring(0, i));
                    }
                    publish.IsBar        = false;
                    publish.IsContent    = true;
                    publish.IsIndex      = true;
                    publish.IsMenuList   = true;
                    publish.nodeCodeList = nodeList;
                    publish.PublishType  = 1;
                    publish.TypeParam    = new string[] { ctrManageEdit.RecordID };
                    publish.ListMenu     = lstMenu;
                    publish.siteDir      = SiteDir;
                    publish.siteID       = SiteID;
                    try
                    {
                        publish.Execute();
                    }
                    catch {
                        jsMessage = "alert({msg:\"HTML页生成失败!\",title:\"操作提示\"});";
                    }
                }
                else
                {
                    jsMessage = "alert({msg:\"对不起,您没有 生成HTML 操作权限,请与管理员联系!\",title:\"操作提示\"});";
                }
            }

            this.hsFieldValue = ctrManageEdit.HsEditField;
            PageInit(); // 得新绑定数据
        }
Exemple #11
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        public void DrawTransformer(Entity PostContainerEntity)
        {
            Editor ed    = Application.DocumentManager.MdiActiveDocument.Editor;
            bool   conti = true;

            double MyScale        = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.Transformer).Scale;
            double MyCommentScale = Atend.Base.Design.DProductProperties.AccessSelectBySoftwareCode((int)Atend.Control.Enum.ProductType.Transformer).CommentScale;


            DrawTransformerJig transformerJig = new DrawTransformerJig(PostContainerEntity, MyScale);
            PromptResult       pr;

            while (conti)
            {
                pr = ed.Drag(transformerJig);
                if (pr.Status == PromptStatus.OK)
                {
                    conti = false;

                    #region Save data here

                    List <Entity> Entities = transformerJig.GetEntities();
                    if (NodeCode != null && ParentCode != null)
                    {
                        ObjectIdCollection OIC = new ObjectIdCollection();

                        foreach (Entity ent in Entities)
                        {
                            ObjectId NewEntOI = Atend.Global.Acad.UAcad.DrawEntityOnScreen(ent, Atend.Control.Enum.AutoCadLayerName.MED_GROUND.ToString());

                            Atend.Base.Acad.AT_INFO EntInfo = new Atend.Base.Acad.AT_INFO(NewEntOI);
                            EntInfo.ParentCode = ParentCode.ToString(); // TransformerParent.ToString();
                            EntInfo.NodeCode   = "";


                            Atend.Global.Acad.AcadJigs.MyPolyLine poly = ent as Atend.Global.Acad.AcadJigs.MyPolyLine;
                            object ProductType = null;
                            if (poly != null)
                            {
                                if (poly.AdditionalDictionary.ContainsKey("ProductType"))
                                {
                                    poly.AdditionalDictionary.TryGetValue("ProductType", out ProductType);
                                }
                            }
                            else
                            {
                                Atend.Global.Acad.AcadJigs.MyLine lin = ent as Atend.Global.Acad.AcadJigs.MyLine;
                                if (lin != null)
                                {
                                    if (lin.AdditionalDictionary.ContainsKey("ProductType"))
                                    {
                                        lin.AdditionalDictionary.TryGetValue("ProductType", out ProductType);
                                    }
                                }
                                else
                                {
                                    Atend.Global.Acad.AcadJigs.MyCircle cir = ent as Atend.Global.Acad.AcadJigs.MyCircle;
                                    if (cir != null)
                                    {
                                        if (cir.AdditionalDictionary.ContainsKey("ProductType"))
                                        {
                                            cir.AdditionalDictionary.TryGetValue("ProductType", out ProductType);
                                        }
                                    }
                                }
                            }



                            if (ProductType != null)
                            {
                                EntInfo.NodeType = Convert.ToInt32(ProductType);
                            }
                            else
                            {
                                EntInfo.NodeType = 0;
                            }
                            EntInfo.ProductCode = 0;
                            EntInfo.Insert();

                            OIC.Add(NewEntOI);
                        }

                        ObjectId TransformerGroupOI = Atend.Global.Acad.Global.MakeGroup(NodeCode.ToString(), OIC);

                        Atend.Base.Acad.AT_INFO GroupInfo = new Atend.Base.Acad.AT_INFO(TransformerGroupOI);
                        GroupInfo.ParentCode  = ParentCode.ToString();
                        GroupInfo.NodeCode    = NodeCode.ToString();
                        GroupInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Transformer;
                        GroupInfo.ProductCode = ProductCode;
                        GroupInfo.Insert();

                        string   comment = string.Format("Tr: {0} KVR", Atend.Base.Equipment.ETransformer.AccessSelectByCode(ProductCode).Capaciy);
                        ObjectId TextOi  = Atend.Global.Acad.UAcad.DrawEntityOnScreen(Atend.Global.Acad.UAcad.WriteNote(comment,
                                                                                                                        new Point3d(transformerJig.MyCenterPoint.X,
                                                                                                                                    transformerJig.MyCenterPoint.Y,
                                                                                                                                    transformerJig.MyCenterPoint.Z)
                                                                                                                        , MyCommentScale), Atend.Control.Enum.AutoCadLayerName.GENERAL.ToString());

                        Atend.Base.Acad.AT_INFO TextInfo = new Atend.Base.Acad.AT_INFO(TextOi);
                        TextInfo.ParentCode  = NodeCode.ToString();
                        TextInfo.NodeCode    = "";
                        TextInfo.NodeType    = (int)Atend.Control.Enum.ProductType.Comment;
                        TextInfo.ProductCode = 0;
                        TextInfo.Insert();

                        //ed.WriteMessage("ADD TO POST TRANSFORMER\n");
                        Atend.Base.Acad.AT_SUB.AddToAT_SUB(TransformerGroupOI, PostContainerEntity.ObjectId);
                        Atend.Base.Acad.AT_SUB.AddToAT_SUB(PostContainerEntity.ObjectId, TransformerGroupOI);
                        Atend.Base.Acad.AT_SUB.AddToAT_SUB(TextOi, TransformerGroupOI);
                    }


                    #endregion
                }
                else
                {
                    conti = false;
                }
            }
        }//
Exemple #12
0
 public void RegisterCode(NodeCode code)
 {
     guidCodeMap.Add(code.funcNodeData.GUID, code);
 }
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            string    returnMsg       = "";
            string    editSelfMenuUrl = "";
            DataTable dtNodeCode      = null;

            #region 实体类赋值

            mode.NodeID       = new Guid(txtNodeID.Text);
            mode.NodeName     = txtNodeName.Text.Trim();
            mode.NodeDir      = txtNodeDir.Text;
            mode.NodelIcon    = txtNodelIcon.Text.Trim();
            mode.CurrentImg   = Utils.HtmlEncode(txtCurrentImg.Text.Trim());
            mode.MouseOverImg = Utils.HtmlEncode(txtMouseOverImg.Text.Trim());
            if (txtLinkURL.Text.Length > 0)
            {
                mode.LinkURL = txtLinkURL.Text.Trim();
            }
            //if (ddlModel.SelectedValue != "0")
            //{
            //    mode.ModuleID = new Guid(ddlModel.SelectedValue.Trim());
            //}
            mode.ModuleID         = new Guid(Request.Form["ddlModel"]);
            mode.IsValid          = Utils.ParseBool(RBL_IsValid.SelectedValue);
            mode.IsWeb            = true;
            mode.NodelOrder       = Utils.HtmlEncode(txtNodelOrder.Text.Trim());
            mode.IsLeftDisplay    = Utils.ParseBool(chkIsLeftDisplay.Checked);
            mode.IsTopMenuShow    = Utils.ParseBool(chkIsTopMenuShow.Checked);
            mode.IsLeftMenuShow   = Utils.ParseBool(chkIsLeftMenuShow.Checked);
            mode.NodelDesc        = Editor1.Content;
            mode.NodelEngDesc     = txtNodelEngDesc.Text.Trim();
            mode.WebSiteID        = Convert.ToInt32(this.SiteID);
            mode.Creater          = base.GetLoginAccountId();
            mode.Settings         = "";
            mode.Tips             = Utils.HtmlEncode(txtTips.Text);
            mode.PageTitle        = Utils.HtmlEncode(txtPageTitle.Text);
            mode.Meta_Keywords    = Utils.HtmlEncode(txtKeyWords.Text);
            mode.Meta_Description = Utils.HtmlEncode(txtMetaDesc.Text);
            mode.SubDomain        = txtSubDomain.Text;
            mode.CreateDate       = DateTime.Now;
            mode.OpenType         = radSelf.Checked ? 1 : 2;
            mode.ColumnType       = 2;
            mode.DefaultTemplate  = txtDefaultTemplate.Text;

            if (ddlListPagePostFix.SelectedValue != "")
            {
                mode.ListPagePostFix = this.ddlListPagePostFix.SelectedValue;
            }
            mode.IsCreateContentPage = radCreateContentPageTrue.Checked ? false : true;

            //自定义内容赋值

            //取自定义数量
            int CustomContentCount = Utils.ParseInt(ddlCustomContentCount.SelectedValue, 1);
            //自定义内容,初始化为第一个TextBox.Text
            string strCustomContent = txtCustomContent1.Text + "<hqb>" + Utils.ParseInt(Request.Form["chkIsHtmlEditor1"], 0);
            for (int i = 2; i <= CustomContentCount; i++)
            {
                string strTemp = Request.Form["txtCustomContent" + i.ToString()];
                strCustomContent += "###" + strTemp + "<hqb>" + Utils.ParseInt(Request.Form["chkIsHtmlEditor" + i.ToString()], 0);
            }
            mode.Custom_Content = strCustomContent;
            mode.Banner         = txtBanner.Text;
            #endregion

            if (Action == "EDIT")
            {
                #region 修改节点
                // 权限验证,是否具有修改权限

                if (IsHaveRightByOperCode("Edit"))
                {
                    mode.NodeCode   = Utils.HtmlEncode(txtNodeCode.Text.Trim());
                    mode.ParentNode = NCode.Substring(0, NCode.Length - 3);
                    //根据NodeCode判断它下面是否有子栏目

                    dtNodeCode = bllModuleNode.GetList("ALLBY", Utils.getTwoParams(SiteID.ToString(), NCode));
                    if (dtNodeCode.Rows.Count == 0)
                    {
                        //如果没有子栏目,用户可随意修改[父级栏目]属性,如果有子栏目,则不给它赋值

                        mode.NodeType = (Utils.ParseBoolToInt(chkIsFolder.Checked)).ToString();
                    }
                    else
                    {
                        mode.NodeType = "1";
                    }
                    if (mode.ParentNode == "")
                    {
                        mode.ParentNode = "0";
                    }

                    returnMsg = bllModuleNode.Save("EDIT", mode);
                    string logTitle = Request.Form["hidLogTitle"];
                    if (logTitle != txtNodeName.Text)
                    {
                        logTitle = logTitle + " => " + txtNodeName.Text;
                    }
                    returnMsg = bllModuleNode.Save("EDIT", mode);
                    if (Utils.ParseInt(returnMsg, 0) > 0)
                    {
                        DataTable parentDt = bllModuleNode.GetModeNodeFromCache();
                        string    parentNodeCode;
                        if (NCode.Length > 3)
                        {
                            parentNodeCode = NCode.Substring(0, NCode.Length - 3);
                        }
                        else
                        {
                            parentNodeCode = NCode;
                        }

                        DataRow[] parentdr = parentDt.Select("NodeCode='" + parentNodeCode + "'");
                        if (parentdr.Length > 0)
                        {
                            editSelfMenuUrl = "SingleColumn.aspx?Action=New&NodeID=" + parentdr[0]["NodeId"].ToString() + "&ID=" + parentdr[0]["NodeId"].ToString() + "&NCode=" + parentNodeCode + "&NodeCode=" + NodeCode + "&IsParent=1";
                        }
                        //Utils.RunJavaScript(this, "alertClose({msg:'修改栏目成功!',title:'提示信息'},function(){location.href='ColumnManage.aspx?nodeid=" + NodeID + "'})");
                        WriteLog(GetLogValue(logTitle, "Update", "ModelNodeEdit", true), "", 2); //写日志
                        Utils.RunJavaScript(this, "type=1;title='" + txtNodeName.Text.Trim().Replace("'", "\\'") + "';editSelfMenuUrl='" + editSelfMenuUrl + "'");
                    }

                    else
                    {
                        WriteLog(GetLogValue(logTitle, "Update", "ModelNodeEdit", false), returnMsg, 3); //写日志
                        Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "'");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有修改栏目的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }
            else
            {
                #region 新增节点
                //判断是否有新增权限

                if (IsHaveRightByOperCode("New"))
                {
                    //根据IsParent判断它是不是父节点,如果不是则不能添加子节点
                    if (IsParent == "1")
                    {
                        //如果是子栏目,则必须要选择栏目类型
                        //if (!chkIsFolder.Checked)
                        //{
                        //    Utils.RunJavaScript(this, "alert({msg:'请选择栏目类型!',title:'提示信息'})");
                        //    return;
                        //}
                        //根据NodeCode得到子栏目下最大的NodeCode
                        dtNodeCode = bllModuleNode.GetList("MAXCODE", Utils.getOneParams(this.NCode));
                        if (dtNodeCode != null && dtNodeCode.Rows.Count == 1)
                        {
                            if (dtNodeCode.Rows[0]["NodeCode"].ToString() != "")
                            {
                                mode.NodeCode = dtNodeCode.Rows[0]["NodeCode"].ToString();
                            }
                            else  //如果没有NodeCode后面三位从001开始

                            {
                                mode.NodeCode = this.NCode + "001";
                            }
                        }

                        mode.NodeType   = (Utils.ParseBoolToInt(chkIsFolder.Checked)).ToString();
                        mode.ParentNode = NCode;

                        //如果是添加一级栏目,得到一级栏目最大的NodeCode+1
                        if (NCode == "0")
                        {
                            DataTable dt = bllModuleNode.GetList("MAXPCODE", Utils.getOneParams(""));
                            if (dt.Rows.Count < 1)
                            {
                                mode.NodeCode   = this.NCode;
                                mode.ParentNode = "0";
                            }
                        }

                        returnMsg       = bllModuleNode.Save("NEW", mode);
                        editSelfMenuUrl = "SingleColumn.aspx?Action=Edit&NodeID=" + mode.NodeID + "&ID=" + mode.NodeID + "&NCode=" + mode.NodeCode + "&NodeCode=" + NodeCode + "&ColumnType=1";
                        if (Utils.ParseInt(returnMsg, 0) > 0)
                        {
                            WriteLog("新增栏目" + txtNodeName.Text + "成功!", "", 2);//写入操作日志
                            Utils.RunJavaScript(this, "type=0;title='" + txtNodeName.Text.Trim().Replace("'", "\\'") + "';editSelfMenuUrl='" + editSelfMenuUrl + "'");
                        }
                        else
                        {
                            WriteLog("新增栏目" + txtNodeName.Text + "成功!", returnMsg, 2);//写入操作日志
                            Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "'");
                        }
                    }
                    else//如果不是则不能添加子节点
                    {
                        Utils.RunJavaScript(this, "alert({msg:'上级栏目不是父栏目,不能添加子栏目!',title:'提示信息'})");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有新增栏目的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }

            //判断是否生成静态页面
            if (Utils.XmlRead(System.Web.HttpContext.Current.Server.MapPath("/config/SiteParam.config"), "SiteParamConfig/PublishType", "") == "2")
            {
                //动态转静态
                KingTop.WEB.SysAdmin.SysManage.AspxToHtml_Publish publish = new KingTop.WEB.SysAdmin.SysManage.AspxToHtml_Publish();
                string        nodeList = "''";
                List <string> lstMenu  = new List <string>();
                for (int i = 6; i <= NodeCode.Length; i = i + 3)
                {
                    nodeList += ",'" + NodeCode.Substring(0, i) + "'";
                    lstMenu.Add(NodeCode.Substring(0, i));
                }
                publish.IsBar        = false;
                publish.IsContent    = false;
                publish.IsIndex      = true;
                publish.IsMenuList   = true;
                publish.nodeCodeList = nodeList;
                publish.PublishType  = 0;
                publish.ListMenu     = lstMenu;
                publish.siteDir      = SiteDir;
                publish.siteID       = SiteID;

                try
                {
                    publish.Execute();
                }
                catch
                {
                    Utils.RunJavaScript(this, "alert({msg:'HTML页生成失败!你可以到“内容发布”栏目中重新发布本栏目',title:'提示信息'})");
                }
            }
        }