Esempio n. 1
0
        /// <summary>
        /// 实体初始化
        /// </summary>
        /// <returns></returns>
        public string Entity_Init()
        {
            try
            {
                //是否是空白记录.
                bool isBlank = DataType.IsNullOrEmpty(this.PKVal);
                //if (DataType.IsNullOrEmpty(this.PKVal) == true)
                //    return "err@主键数据丢失,不能初始化En.htm";

                //初始化entity.
                string enName = this.EnName;
                Entity en     = null;
                if (DataType.IsNullOrEmpty(enName) == true)
                {
                    if (DataType.IsNullOrEmpty(this.EnsName) == true)
                    {
                        return("err@类名没有传递过来");
                    }
                    Entities ens = ClassFactory.GetEns(this.EnsName);
                    en = ens.GetNewEntity;
                }
                else
                {
                    en = ClassFactory.GetEn(this.EnName);
                }

                if (en == null)
                {
                    return("err@参数类名不正确.");
                }

                //获得描述.
                Map map = en.EnMap;

                string pkVal = this.PKVal;

                if (isBlank == false)
                {
                    en.PKVal = pkVal;
                    en.RetrieveFromDBSources();
                }

                //定义容器.
                DataSet ds = new DataSet();

                //把主数据放入里面去.
                DataTable dtMain = en.ToDataTableField("MainTable");
                ds.Tables.Add(dtMain);

                #region 增加 上方法.
                DataTable dtM = new DataTable("dtM");
                dtM.Columns.Add("No");
                dtM.Columns.Add("Title");
                dtM.Columns.Add("Tip");
                dtM.Columns.Add("Visable");

                dtM.Columns.Add("Url");
                dtM.Columns.Add("Target");
                dtM.Columns.Add("Warning");
                dtM.Columns.Add("RefMethodType");
                dtM.Columns.Add("GroupName");
                dtM.Columns.Add("W");
                dtM.Columns.Add("H");
                dtM.Columns.Add("Icon");
                dtM.Columns.Add("IsCanBatch");
                dtM.Columns.Add("RefAttrKey");
                //判断Func是否有参数
                dtM.Columns.Add("FunPara");


                RefMethods rms = map.HisRefMethods;
                foreach (RefMethod item in rms)
                {
                    string myurl = "";
                    if (item.RefMethodType == RefMethodType.LinkeWinOpen ||
                        item.RefMethodType == RefMethodType.RightFrameOpen ||
                        item.RefMethodType == RefMethodType.LinkModel)
                    {
                        try
                        {
                            myurl = item.Do(null) as string;
                            if (myurl == null)
                            {
                                continue;
                            }
                        }
                        catch (Exception ex)
                        {
                            throw new Exception("err@系统错误:根据方法名生成url出现错误:@" + ex.Message + "@" + ex.InnerException + " @方法名:" + item.ClassMethodName);
                        }
                    }
                    else
                    {
                        myurl = "../RefMethod.htm?Index=" + item.Index + "&EnName=" + en.ToString() + "&EnsName=" + en.GetNewEntities.ToString() + "&PKVal=" + this.PKVal;
                    }

                    DataRow dr = dtM.NewRow();

                    dr["No"]      = item.Index;
                    dr["Title"]   = item.Title;
                    dr["Tip"]     = item.ToolTip;
                    dr["Visable"] = item.Visable;
                    dr["Warning"] = item.Warning;


                    dr["RefMethodType"] = (int)item.RefMethodType;
                    dr["RefAttrKey"]    = item.RefAttrKey;
                    dr["Url"]           = myurl;
                    dr["W"]             = item.Width;
                    dr["H"]             = item.Height;
                    dr["Icon"]          = item.Icon;
                    dr["IsCanBatch"]    = item.IsCanBatch;
                    dr["GroupName"]     = item.GroupName;
                    Attrs attrs = item.HisAttrs;
                    if (attrs.Count == 0)
                    {
                        dr["FunPara"] = "false";
                    }
                    else
                    {
                        dr["FunPara"] = "true";
                    }

                    dtM.Rows.Add(dr); //增加到rows.
                }
                #endregion 增加 上方法.

                #region 加入一对多的实体编辑
                AttrsOfOneVSM oneVsM = en.EnMap.AttrsOfOneVSM;
                string        sql    = "";
                int           i      = 0;
                if (oneVsM.Count > 0)
                {
                    foreach (AttrOfOneVSM vsM in oneVsM)
                    {
                        //判断该dot2dot是否显示?
                        Entity enMM = vsM.EnsOfMM.GetNewEntity;
                        enMM.SetValByKey(vsM.AttrOfOneInMM, this.PKVal);
                        if (enMM.HisUAC.IsView == false)
                        {
                            continue;
                        }
                        DataRow dr = dtM.NewRow();
                        dr["No"] = enMM.ToString();
                        // dr["GroupName"] = vsM.GroupName;
                        if (en.PKVal != null)
                        {
                            //判断模式.
                            string url = "";
                            if (vsM.Dot2DotModel == Dot2DotModel.TreeDept)
                            {
                                //url = "Dot2DotTreeDeptModel.htm?EnsName=" + en.GetNewEntities.ToString() + "&EnName=" + this.EnName + "&AttrKey=" + vsM.EnsOfMM.ToString();
                                //  url = "Branches.htm?EnName=" + en.ToString() + "&AttrKey=" + vsM.EnsOfMM.ToString();

                                url = "Branches.htm?EnName=" + this.EnName + "&Dot2DotEnsName=" + vsM.EnsOfMM.ToString();
                                // url += "&PKVal=" + en.PKVal;
                                url += "&Dot2DotEnName=" + vsM.EnsOfMM.GetNewEntity.ToString(); //存储实体类.
                                url += "&AttrOfOneInMM=" + vsM.AttrOfOneInMM;                   //存储表那个与主表关联. 比如: FK_Node
                                url += "&AttrOfMInMM=" + vsM.AttrOfMInMM;                       //dot2dot存储表那个与实体表.  比如:FK_Station.
                                url += "&EnsOfM=" + vsM.EnsOfM.ToString();                      //默认的B实体分组依据.  比如:FK_Station.
                                url += "&DefaultGroupAttrKey=" + vsM.DefaultGroupAttrKey;       //默认的B实体分组依据.
                            }
                            else if (vsM.Dot2DotModel == Dot2DotModel.TreeDeptEmp)
                            {
                                //   url = "Dot2DotTreeDeptEmpModel.htm?EnsName=" + en.GetNewEntities.ToString() + "&EnName=" + this.EnName + "&AttrKey=" + vsM.EnsOfMM.ToString();
                                // url = "Dot2Dot.aspx?EnsName=" + en.GetNewEntities.ToString() + "&EnName=" + this.EnName + "&AttrKey=" + vsM.EnsOfMM.ToString();
                                url = "BranchesAndLeaf.htm?EnName=" + this.EnName + "&Dot2DotEnsName=" + vsM.EnsOfMM.ToString();
                                //   url += "&PKVal=" + en.PKVal;
                                url += "&Dot2DotEnName=" + vsM.EnsOfMM.GetNewEntity.ToString(); //存储实体类.
                                url += "&AttrOfOneInMM=" + vsM.AttrOfOneInMM;                   //存储表那个与主表关联. 比如: FK_Node
                                url += "&AttrOfMInMM=" + vsM.AttrOfMInMM;                       //dot2dot存储表那个与实体表.  比如:FK_Station.
                                url += "&EnsOfM=" + vsM.EnsOfM.ToString();                      //默认的B实体分组依据.  比如:FK_Station.
                                url += "&DefaultGroupAttrKey=" + vsM.DefaultGroupAttrKey;       //默认的B实体分组依据.  比如:FK_Station.
                                //url += "&RootNo=" + vsM.RootNo; //默认的B实体分组依据.  比如:FK_Station.
                            }
                            else
                            {
                                // url = "Dot2Dot.aspx?EnsName=" + en.GetNewEntities.ToString() + "&EnName=" + this.EnName + "&AttrKey=" + vsM.EnsOfMM.ToString();
                                url  = "Dot2Dot.htm?EnName=" + this.EnName + "&Dot2DotEnsName=" + vsM.EnsOfMM.ToString(); //比如:BP.WF.Template.NodeStations
                                url += "&AttrOfOneInMM=" + vsM.AttrOfOneInMM;                                             //存储表那个与主表关联. 比如: FK_Node
                                url += "&AttrOfMInMM=" + vsM.AttrOfMInMM;                                                 //dot2dot存储表那个与实体表.  比如:FK_Station.
                                url += "&EnsOfM=" + vsM.EnsOfM.ToString();                                                //默认的B实体.   //比如:BP.Port.Stations
                                url += "&DefaultGroupAttrKey=" + vsM.DefaultGroupAttrKey;                                 //默认的B实体分组依据.  比如:FK_Station.

                                //+"&RefAttrEnsName=" + vsM.EnsOfM.ToString();
                                //url += "&RefAttrKey=" + vsM.AttrOfOneInMM + "&RefAttrEnsName=" + vsM.EnsOfM.ToString();
                            }

                            dr["Url"]  = url + "&" + en.PK + "=" + en.PKVal + "&PKVal=" + en.PKVal;
                            dr["Icon"] = "../Img/M2M.png";
                        }

                        dr["W"]             = "900";
                        dr["H"]             = "500";
                        dr["RefMethodType"] = (int)RefMethodType.RightFrameOpen;


                        // 获得选择的数量.
                        try
                        {
                            sql = "SELECT COUNT(*) as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "='" + en.PKVal + "'";
                            i   = DBAccess.RunSQLReturnValInt(sql);
                        }
                        catch
                        {
                            sql = "SELECT COUNT(*) as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "=" + en.PKVal;
                            try
                            {
                                i = DBAccess.RunSQLReturnValInt(sql);
                            }
                            catch
                            {
                                vsM.EnsOfMM.GetNewEntity.CheckPhysicsTable();
                            }
                        }
                        dr["Title"] = vsM.Desc + "(" + i + ")";
                        dtM.Rows.Add(dr);
                    }
                }
                #endregion 增加 一对多.

                #region 从表
                EnDtls enDtls = en.EnMap.Dtls;
                foreach (EnDtl enDtl in enDtls)
                {
                    //判断该dtl是否要显示?
                    Entity myEnDtl = enDtl.Ens.GetNewEntity;       //获取他的en
                    myEnDtl.SetValByKey(enDtl.RefKey, this.PKVal); //给refpk赋值.
                    if (myEnDtl.HisUAC.IsView == false)
                    {
                        continue;
                    }

                    DataRow dr = dtM.NewRow();
                    //string url = "Dtl.aspx?EnName=" + this.EnName + "&PK=" + this.PKVal + "&EnsName=" + enDtl.EnsName + "&RefKey=" + enDtl.RefKey + "&RefVal=" + en.PKVal.ToString() + "&MainEnsName=" + en.ToString() ;
                    string url = "Dtl.htm?EnName=" + this.EnName + "&PK=" + this.PKVal + "&EnsName=" + enDtl.EnsName + "&RefKey=" + enDtl.RefKey + "&RefVal=" + en.PKVal.ToString() + "&MainEnsName=" + en.ToString();
                    try
                    {
                        i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "='" + en.PKVal + "'");
                    }
                    catch
                    {
                        try
                        {
                            i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "=" + en.PKVal);
                        }
                        catch
                        {
                            enDtl.Ens.GetNewEntity.CheckPhysicsTable();
                        }
                    }

                    dr["No"]        = enDtl.EnsName;
                    dr["Title"]     = enDtl.Desc + "(" + i + ")";
                    dr["Url"]       = url;
                    dr["GroupName"] = enDtl.GroupName;

                    dr["RefMethodType"] = (int)RefMethodType.RightFrameOpen;

                    dtM.Rows.Add(dr);
                }
                #endregion 增加 从表.

                ds.Tables.Add(dtM);



                return(BP.Tools.Json.ToJson(ds));
            }
            catch (Exception ex)
            {
                return("err@Entity_Init错误:" + ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns></returns>
        public string BranchesAndLeaf_Init()
        {
            string dot2DotEnsName      = this.GetRequestVal("Dot2DotEnsName");
            string defaultGroupAttrKey = this.GetRequestVal("DefaultGroupAttrKey");

            //string enName = this.GetRequestVal("EnName");
            Entity en = ClassFactory.GetEn(this.EnName);

            en.PKVal = this.PKVal;
            en.Retrieve();

            //找到映射.
            AttrsOfOneVSM oneVsM = en.EnMap.AttrsOfOneVSM;
            AttrOfOneVSM  vsM    = null;

            foreach (AttrOfOneVSM item in oneVsM)
            {
                if (item.Dot2DotModel == Dot2DotModel.TreeDeptEmp &&
                    item.EnsOfMM.ToString().Equals(dot2DotEnsName) &&
                    item.DefaultGroupAttrKey.Equals(defaultGroupAttrKey))
                {
                    vsM = item;
                    break;
                }
            }
            if (vsM == null)
            {
                return("err@参数错误,没有找到VSM");
            }

            //组织数据.
            DataSet ds     = new DataSet();
            string  rootNo = vsM.RootNo;

            if (rootNo.Equals("@WebUser.FK_Dept") || rootNo.Equals("WebUser.FK_Dept"))
            {
                rootNo = WebUser.FK_Dept;
            }

            #region 生成树目录.
            string   ensOfM = this.GetRequestVal("EnsOfM"); //多的实体.
            Entities ensMen = ClassFactory.GetEns(ensOfM);
            Entity   enMen  = ensMen.GetNewEntity;

            Attr attr = enMen.EnMap.GetAttrByKey(defaultGroupAttrKey);
            if (attr == null)
            {
                return("err@在实体[" + ensOfM + "]指定的分树的属性[" + defaultGroupAttrKey + "]不存在,请确认是否删除了该属性?");
            }

            if (attr.MyFieldType == FieldType.Normal)
            {
                return("err@在实体[" + ensOfM + "]指定的分树的属性[" + defaultGroupAttrKey + "]不能是普通字段,必须是外键或者枚举.");
            }

            Entities trees = attr.HisFKEns;
            trees.RetrieveAll();

            DataTable dt = trees.ToDataTableField("DBTrees");
            //如果没有parnetNo 列,就增加上, 有可能是分组显示使用这个模式.
            if (dt.Columns.Contains("ParentNo") == false)
            {
                dt.Columns.Add("ParentNo");
                foreach (DataRow dr in dt.Rows)
                {
                    dr["ParentNo"] = rootNo;
                }
            }
            ds.Tables.Add(dt);
            #endregion 生成树目录.

            #region 生成选择的数据.
            Entities dot2Dots = ClassFactory.GetEns(dot2DotEnsName);
            dot2Dots.Retrieve(vsM.AttrOfOneInMM, this.PKVal);

            DataTable dtSelected = dot2Dots.ToDataTableField("DBMMs");

            string attrOfMInMM   = this.GetRequestVal("AttrOfMInMM");
            string AttrOfOneInMM = this.GetRequestVal("AttrOfOneInMM");

            dtSelected.Columns[attrOfMInMM].ColumnName = "No";

            if (dtSelected.Columns.Contains(attrOfMInMM + "Text") == false)
            {
                return("err@MM实体类字段属性需要按照外键属性编写:" + dot2DotEnsName + " - " + attrOfMInMM);
            }

            dtSelected.Columns[attrOfMInMM + "Text"].ColumnName = "Name";

            dtSelected.Columns.Remove(AttrOfOneInMM);
            ds.Tables.Add(dtSelected); //已经选择的数据.
            #endregion 生成选择的数据.

            return(BP.Tools.Json.ToJson(ds));
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一个工作
        /// </summary>
        /// <param name="en"></param>
        /// <param name="rws"></param>
        /// <param name="fws"></param>
        /// <param name="nodeId"></param>
        public void ADDWork(Work en, ReturnWorks rws, ForwardWorks fws, int nodeId)
        {
            this.BindViewEn(en, "width=90%");
            foreach (ReturnWork rw in rws)
            {
                if (rw.ReturnToNode != nodeId)
                {
                    continue;
                }

                this.AddBR();
                this.AddMsgOfInfo("退回信息:", rw.NoteHtml);
            }

            foreach (ForwardWork fw in fws)
            {
                if (fw.FK_Node != nodeId)
                {
                    continue;
                }

                this.AddBR();
                this.AddMsgOfInfo("转发信息:", fw.NoteHtml);
            }


            string refstrs = "";

            if (en.IsEmpty)
            {
                refstrs += "";
                return;
            }

            string keys = "&PK=" + en.PKVal.ToString();

            foreach (Attr attr in en.EnMap.Attrs)
            {
                if (attr.MyFieldType == FieldType.Enum ||
                    attr.MyFieldType == FieldType.FK ||
                    attr.MyFieldType == FieldType.PK ||
                    attr.MyFieldType == FieldType.PKEnum ||
                    attr.MyFieldType == FieldType.PKFK)
                {
                    keys += "&" + attr.Key + "=" + en.GetValStrByKey(attr.Key);
                }
            }
            Entities hisens = en.GetNewEntities;

            #region 加入他的明细
            EnDtls enDtls = en.EnMap.Dtls;
            if (enDtls.Count > 0)
            {
                foreach (EnDtl enDtl in enDtls)
                {
                    string url = "WFRptDtl.aspx?RefPK=" + en.PKVal.ToString() + "&EnName=" + enDtl.Ens.GetNewEntity.ToString();
                    int    i   = 0;
                    try
                    {
                        i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "='" + en.PKVal + "'");
                    }
                    catch
                    {
                        i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "=" + en.PKVal);
                    }

                    if (i == 0)
                    {
                        refstrs += "[<a href=\"javascript:WinOpen('" + url + "','u8');\" >" + enDtl.Desc + "</a>]";
                    }
                    else
                    {
                        refstrs += "[<a  href=\"javascript:WinOpen('" + url + "','u8');\" >" + enDtl.Desc + "-" + i + "</a>]";
                    }
                }
            }
            #endregion

            #region 加入一对多的实体编辑
            AttrsOfOneVSM oneVsM = en.EnMap.AttrsOfOneVSM;
            if (oneVsM.Count > 0)
            {
                foreach (AttrOfOneVSM vsM in oneVsM)
                {
                    string url = "UIEn1ToM.aspx?EnsName=" + en.ToString() + "&AttrKey=" + vsM.EnsOfMM.ToString() + keys;
                    string sql = "SELECT COUNT(*)  as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "='" + en.PKVal + "'";
                    int    i   = DBAccess.RunSQLReturnValInt(sql);

                    if (i == 0)
                    {
                        refstrs += "[<a href='" + url + "' target='_blank' >" + vsM.Desc + "</a>]";
                    }
                    else
                    {
                        refstrs += "[<a href='" + url + "' target='_blank' >" + vsM.Desc + "-" + i + "</a>]";
                    }
                }
            }
            #endregion

            #region 加入他门的相关功能
            //			SysUIEnsRefFuncs reffuncs = en.GetNewEntities.HisSysUIEnsRefFuncs ;
            //			if ( reffuncs.Count > 0  )
            //			{
            //				foreach(SysUIEnsRefFunc en1 in reffuncs)
            //				{
            //					string url="RefFuncLink.aspx?RefFuncOID="+en1.OID.ToString()+"&MainEnsName="+hisens.ToString()+keys;
            //					//int i=DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM "+vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable+" WHERE "+vsM.AttrOfMInMM+"='"+en.PKVal+"'");
            //					refstrs+="[<a href='"+url+"' target='_blank' >"+en1.Name+"</a>]";
            //					//refstrs+="编辑: <a href=\"javascript:window.open(RefFuncLink.aspx?RefFuncOID="+en1.OID.ToString()+"&MainEnsName="+ens.ToString()+"'> )\" > "+en1.Name+"</a>";
            //					//var newWindow= window.open( this.Request.ApplicationPath+'/Comm/'+'RefFuncLink.aspx?RefFuncOID='+OID+'&MainEnsName='+ CurrEnsName +CurrKeys,'chosecol', 'width=100,top=400,left=400,height=50,scrollbars=yes,resizable=yes,toolbar=false,location=false' );
            //					//refstrs+="编辑: <a href=\"javascript:EnsRefFunc('"+en1.OID.ToString()+"')\" > "+en1.Name+"</a>";
            //					//refstrs+="编辑:"+en1.Name+"javascript: EnsRefFunc('"+en1.OID.ToString()+"',)";
            //					//this.AddItem(en1.Name,"EnsRefFunc('"+en1.OID.ToString()+"')",en1.Icon);
            //				}
            //			}
            #endregion

            // 不知道为什么去掉。
            this.Add(refstrs);
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Entity en = BP.DA.ClassFactory.GetEn(this.EnName);

            if (this.PK == null)
            {
                return;
            }

            if (en == null)
            {
                throw new Exception(this.EnsName + " " + this.EnName);
            }

            if (en.EnMap.AttrsOfOneVSM.Count + en.EnMap.Dtls.Count + en.EnMap.HisRefMethods.Count == 0)
            {
                return;
            }

            en.PKVal = this.PK;
            string keys = "&" + en.PK + "=" + this.PK + "&r=" + DateTime.Now.ToString("MMddhhmmss");

            string titleKey = "";

            if (en.EnMap.Attrs.Contains("Name"))
            {
                titleKey = "Name";
            }
            else if (en.EnMap.Attrs.Contains("Title"))
            {
                titleKey = "Title";
            }
            string desc = en.EnDesc;

            if (titleKey != "")
            {
                en.RetrieveFromDBSources();
                desc = en.GetValStrByKey(titleKey);
                if (desc.Length > 30)
                {
                    desc = en.EnDesc;
                }
            }

            this.AddFieldSet("<a href='UIEn.aspx?EnName=" + this.EnName + "&PK=" + this.PK + "' >" + desc + "-主页</a>");
            this.AddUL();

            #region 加入一对多的实体编辑
            AttrsOfOneVSM oneVsM = en.EnMap.AttrsOfOneVSM;
            string        sql    = "";
            int           i      = 0;
            if (oneVsM.Count > 0)
            {
                foreach (AttrOfOneVSM vsM in oneVsM)
                {
                    string url = "Dot2Dot.aspx?EnsName=" + en.GetNewEntities.ToString() + "&EnName=" + this.EnName + "&AttrKey=" + vsM.EnsOfMM.ToString() + keys;
                    try
                    {
                        sql = "SELECT COUNT(*) as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "='" + en.PKVal + "'";
                        i   = DBAccess.RunSQLReturnValInt(sql);
                    }
                    catch
                    {
                        sql = "SELECT COUNT(*) as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "=" + en.PKVal;
                        try
                        {
                            i = DBAccess.RunSQLReturnValInt(sql);
                        }
                        catch
                        {
                            vsM.EnsOfMM.GetNewEntity.CheckPhysicsTable();
                        }
                    }
                    if (i == 0)
                    {
                        if (this.AttrKey == vsM.EnsOfMM.ToString())
                        {
                            this.AddLi("<b><a href='" + url + "'  >" + vsM.Desc + "</a></b>");
                        }
                        else
                        {
                            this.AddLi("<a href='" + url + "'  >" + vsM.Desc + "</a>");
                        }
                    }
                    else
                    {
                        if (this.AttrKey == vsM.EnsOfMM.ToString())
                        {
                            this.AddLi("<b><a href='" + url + "'  >" + vsM.Desc + "-" + i + "</a></b>");
                        }
                        else
                        {
                            this.AddLi("<a href='" + url + "'  >" + vsM.Desc + "-" + i + "</a>");
                        }
                    }
                }
            }
            #endregion

            #region 加入他门的 方法
            RefMethods myreffuncs = en.EnMap.HisRefMethods;
            string     path       = this.Request.ApplicationPath;
            foreach (RefMethod func in myreffuncs)
            {
                if (func.Visable == false)
                {
                    continue;
                }
                // string url = path + "/Comm/RefMethod.aspx?Index=" + func.Index + "&EnsName=" + hisens.ToString() + keys;
                string url = "/WF/Comm/RefMethod.aspx?Index=" + func.Index + "&EnsName=" + en.GetNewEntities.ToString() + keys;
                //  string urlRefFunc = "RefMethod.aspx?Index=" + func.Index + "&EnsName=" + en.GetNewEntities.ToString() + keys;
                if (func.Warning == null)
                {
                    if (func.Target == null)
                    {
                        this.AddLi(func.GetIcon(path) + "<a href='" + url + "' ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                    }
                    else
                    {
                        this.AddLi(func.GetIcon(path) + "<a href=\"javascript:WinOpen('" + url + "','" + func.Target + "')\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                    }
                }
                else
                {
                    if (func.Target == null)
                    {
                        this.AddLi(func.GetIcon(path) + "<a href=\"javascript: if ( confirm('" + func.Warning + "') ) { window.location.href='" + url + "' }\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                    }
                    else
                    {
                        this.AddLi(func.GetIcon(path) + "<a href=\"javascript: if ( confirm('" + func.Warning + "') ) { WinOpen('" + url + "','" + func.Target + "') }\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                    }
                }
            }
            #endregion

            #region 加入他的明细
            EnDtls enDtls = en.EnMap.Dtls;
            foreach (EnDtl enDtl in enDtls)
            {
                string url = "Dtl.aspx?EnName=" + this.EnName + "&PK=" + this.PK + "&EnsName=" + enDtl.EnsName + "&RefKey=" + enDtl.RefKey + "&RefVal=" + en.PKVal.ToString() + "&MainEnsName=" + en.ToString() + keys;
                try
                {
                    i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "='" + en.PKVal + "'");
                }
                catch
                {
                    i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "=" + en.PKVal);
                }
                if (i == 0)
                {
                    this.AddLi("<a href=\"" + url + "\"  >" + enDtl.Desc + "</a>");
                }
                else
                {
                    this.AddLi("<a href=\"" + url + "\"   >" + enDtl.Desc + "-" + i + "</a>");
                }
            }
            #endregion

            this.AddULEnd();
            this.AddFieldSetEnd();
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Entity en = BP.En.ClassFactory.GetEn(this.EnName);

            if (this.PK == null)
            {
                return;
            }

            if (en == null)
            {
                throw new Exception(this.EnsName + " " + this.EnName);
            }

            if (en.EnMap.AttrsOfOneVSM.Count + en.EnMap.Dtls.Count + en.EnMap.HisRefMethods.Count == 0)
            {
                return;
            }

            en.PKVal = this.PK;
            string keys = "&" + en.PK + "=" + this.PK + "&r=" + DateTime.Now.ToString("MMddhhmmss");

            string titleKey = "";

            if (en.EnMap.Attrs.Contains("Name"))
            {
                titleKey = "Name";
            }
            else if (en.EnMap.Attrs.Contains("Title"))
            {
                titleKey = "Title";
            }
            string desc = en.EnDesc;

            if (titleKey != "")
            {
                en.RetrieveFromDBSources();
                desc = en.GetValStrByKey(titleKey);
                if (desc.Length > 30)
                {
                    desc = en.EnDesc;
                }
            }

            AddUL("class='navlist'");
            AddLi(
                string.Format("<div><a href='UIEn.aspx?EnName={0}&PK={1}'><span class='nav'>{2}</span></a></div>{3}", EnName, PK, titleKey == "Title" ? "主页" : desc + " - 主页", Environment.NewLine));

            #region 加入一对多的实体编辑
            AttrsOfOneVSM oneVsM = en.EnMap.AttrsOfOneVSM;
            string        sql    = "";
            int           i      = 0;
            if (oneVsM.Count > 0)
            {
                foreach (AttrOfOneVSM vsM in oneVsM)
                {
                    string url = "Dot2Dot.aspx?EnsName=" + en.GetNewEntities.ToString() + "&EnName=" + this.EnName + "&AttrKey=" + vsM.EnsOfMM.ToString() + keys;
                    try
                    {
                        sql = "SELECT COUNT(" + vsM.AttrOfOneInMM + ") as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "='" + en.PKVal + "'";
                        i   = DBAccess.RunSQLReturnValInt(sql);
                    }
                    catch
                    {
                        sql = "SELECT COUNT(" + vsM.AttrOfOneInMM + ") as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "=" + en.PKVal;
                        try
                        {
                            i = DBAccess.RunSQLReturnValInt(sql);
                        }
                        catch
                        {
                            vsM.EnsOfMM.GetNewEntity.CheckPhysicsTable();
                        }
                    }
                    if (i == 0)
                    {
                        if (this.AttrKey == vsM.EnsOfMM.ToString())
                        {
                            AddLi(string.Format(
                                      "<div style='font-weight:bold'><a href='{0}'><span class='nav'>{1}</span></a></div>{2}",
                                      url, vsM.Desc, Environment.NewLine));
                        }
                        else
                        {
                            AddLi(string.Format("<div><a href='{0}'><span class='nav'>{1}</span></a></div>{2}", url, vsM.Desc, Environment.NewLine));
                        }
                    }
                    else
                    {
                        if (this.AttrKey == vsM.EnsOfMM.ToString())
                        {
                            AddLi(string.Format(
                                      "<div style='font-weight:bold'><a href='{0}'><span class='nav'>{1} [{2}]</span></a></div>{3}",
                                      url, vsM.Desc, i, Environment.NewLine));
                        }
                        else
                        {
                            AddLi(string.Format("<div><a href='{0}'><span class='nav'>{1} [{2}]</span></a></div>{3}", url, vsM.Desc, i, Environment.NewLine));
                        }
                    }
                }
            }
            #endregion

            #region 加入方法
            RefMethods myreffuncs = en.EnMap.HisRefMethods;
            string     path       = this.Request.ApplicationPath;
            foreach (RefMethod func in myreffuncs)
            {
                if (func.Visable == false || func.RefAttrKey != null)
                {
                    continue;
                }

                if (func.RefMethodType != RefMethodType.Func)
                {
                    string myurl = func.Do(null) as string;
                    int    h     = func.Height;

                    if (func.Target == null)
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href='" + myurl + "' ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        AddLi(string.Format("<div><a href='{0}' title='{1}'><span class='nav'>{2}</span></a></div>{3}", myurl, func.ToolTip, func.Title, Environment.NewLine));
                    }
                    else
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href=\"javascript:WinOpen('" + myurl + "','" + func.Target + "')\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        AddLi(string.Format("<div><a href=\"javascript:WinOpen('{0}','{1}')\" title='{2}'><span class='nav'>{3}</span></a></div>{4}", myurl, func.Target, func.ToolTip, func.Title, Environment.NewLine));
                    }
                    continue;
                }

                string url = "../RefMethod.aspx?Index=" + func.Index + "&EnsName=" + en.GetNewEntities.ToString() + keys;
                if (func.Warning == null)
                {
                    if (func.Target == null)
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href='" + url + "' ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        AddLi(string.Format("<div><a href='{0}' title='{1}'><span class='nav'>{2}</span></a></div>{3}", url, func.ToolTip, func.Title, Environment.NewLine));
                    }
                    else
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href=\"javascript:WinOpen('" + url + "','" + func.Target + "')\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        AddLi(string.Format("<div><a href=\"javascript:WinOpen('{0}','{1}')\" title='{2}'><span class='nav'>{3}</span></a></div>{4}", url, func.Target, func.ToolTip, func.Title, Environment.NewLine));
                    }
                }
                else
                {
                    if (func.Target == null)
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href=\"javascript: if ( confirm('" + func.Warning + "') ) { window.location.href='" + url + "' }\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        AddLi(string.Format(
                                  "<div><a href=\"javascript: if ( confirm('{0}')){{ window.location.href='{1}' }}\" title='{2}'><span class='nav'>{3}</span></a></div>{4}",
                                  func.Warning, url, func.ToolTip, func.Title, Environment.NewLine));
                    }
                    else
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href=\"javascript: if ( confirm('" + func.Warning + "') ) { WinOpen('" + url + "','" + func.Target + "') }\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        AddLi(string.Format(
                                  "<div><a href=\"javascript: if ( confirm('{0}')){{ WinOpen('{1}','{2}') }}\" title='{3}'><span class='nav'>{4}</span></a></div>{5}",
                                  func.Warning, url, func.Target, func.ToolTip, func.Title, Environment.NewLine));
                    }
                }
            }
            #endregion

            #region 加入他的明细
            EnDtls enDtls = en.EnMap.Dtls;
            foreach (EnDtl enDtl in enDtls)
            {
                string url = "Dtl.aspx?EnName=" + this.EnName + "&PK=" + this.PK + "&EnsName=" + enDtl.EnsName + "&RefKey=" + enDtl.RefKey + "&RefVal=" + en.PKVal.ToString() + "&MainEnsName=" + en.ToString() + keys;
                try
                {
                    i = DBAccess.RunSQLReturnValInt("SELECT COUNT(" + enDtl.RefKey + ") FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "='" + en.PKVal + "'");
                }
                catch
                {
                    try
                    {
                        i = DBAccess.RunSQLReturnValInt("SELECT COUNT(" + enDtl.RefKey + ") FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "=" + en.PKVal);
                    }
                    catch
                    {
                        enDtl.Ens.GetNewEntity.CheckPhysicsTable();
                    }
                }

                if (i == 0)
                {
                    //this.AddLi("<a href=\"" + url + "\"  >" + enDtl.Desc + "</a>");
                    AddLi(string.Format("<div><a href='{0}'><span class='nav'>{1}</span></a></div>{2}", url, enDtl.Desc, Environment.NewLine));
                }
                else
                {
                    //this.AddLi("<a href=\"" + url + "\"   >" + enDtl.Desc + "-" + i + "</a>");
                    AddLi(string.Format("<div><a href='{0}'><span class='nav'>{1} [{2}]</span></a></div>{3}", url, enDtl.Desc, i, Environment.NewLine));
                }
            }
            #endregion

            AddULEnd();
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Entity en = BP.En.ClassFactory.GetEn(this.EnName);

            if (this.PK == null)
            {
                return;
            }

            if (en == null)
            {
                throw new Exception(this.EnsName + " " + this.EnName);
            }

            if (en.EnMap.AttrsOfOneVSM.Count + en.EnMap.Dtls.Count + en.EnMap.HisRefMethods.Count == 0)
            {
                return;
            }

            en.PKVal = this.PK;
            string keys = "&" + en.PK + "=" + this.PK + "&r=" + DateTime.Now.ToString("MMddhhmmss");

            string titleKey = "";

            if (en.EnMap.Attrs.Contains("Name"))
            {
                titleKey = "Name";
            }
            else if (en.EnMap.Attrs.Contains("Title"))
            {
                titleKey = "Title";
            }
            string desc = en.EnDesc;

            if (titleKey != "")
            {
                en.RetrieveFromDBSources();
                desc = en.GetValStrByKey(titleKey);
                if (desc.Length > 30)
                {
                    desc = en.EnDesc;
                }
            }

            //edited by liuxc,2016-3-3,修改左侧功能列表导航的表现形式,RefMethod中增加分组的概念,2016-3-7修改完成
            Dictionary <string, List <LeftMenuItem> > dictDefs = new Dictionary <string, List <LeftMenuItem> >();

            //AddUL("class='navlist'");
            //AddLi(
            //    string.Format("<div><a href='UIEn.aspx?EnName={0}&PK={1}'>{4}<span class='nav'>{2}</span></a></div>{3}", EnName, PK, titleKey == "Title" ? "主页" : desc, Environment.NewLine, GetIcon(IconFirstDefault)));
            AddGroupedLeftItem(dictDefs, "默认组", new LeftMenuItem(CCFlowPath, (titleKey == "Title" ? "主页" : desc),
                                                                 string.Format("UIEn.aspx?EnName={0}&PK={1}", EnName, PK),
                                                                 IconFirstDefault, false));

            #region 加入一对多的实体编辑
            AttrsOfOneVSM oneVsM = en.EnMap.AttrsOfOneVSM;
            string        sql    = "";
            int           i      = 0;

            if (oneVsM.Count > 0)
            {
                foreach (AttrOfOneVSM vsM in oneVsM)
                {
                    string url = "Dot2Dot.aspx?EnsName=" + en.GetNewEntities.ToString() + "&EnName=" + this.EnName + "&AttrKey=" + vsM.EnsOfMM.ToString() + keys;
                    try
                    {
                        sql = "SELECT COUNT(*) as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "='" + en.PKVal + "'";
                        i   = DBAccess.RunSQLReturnValInt(sql);
                    }
                    catch
                    {
                        sql = "SELECT COUNT(*) as NUM FROM " + vsM.EnsOfMM.GetNewEntity.EnMap.PhysicsTable + " WHERE " + vsM.AttrOfOneInMM + "=" + en.PKVal;
                        try
                        {
                            i = DBAccess.RunSQLReturnValInt(sql);
                        }
                        catch
                        {
                            vsM.EnsOfMM.GetNewEntity.CheckPhysicsTable();
                        }
                    }
                    if (i == 0)
                    {
                        if (this.AttrKey == vsM.EnsOfMM.ToString())
                        {
                            //AddLi(string.Format(
                            //    "<div style='font-weight:bold'><a href='{0}'>{3}<span class='nav'>{1}</span></a></div>{2}",
                            //    url, vsM.Desc, Environment.NewLine, GetIcon(IconM2MDefault)));
                            AddGroupedLeftItem(dictDefs, "默认组", new LeftMenuItem(CCFlowPath, vsM.Desc, url, IconM2MDefault, true));
                            ItemCount++;
                        }
                        else
                        {
                            //AddLi(string.Format("<div><a href='{0}'>{3}<span class='nav'>{1}</span></a></div>{2}", url, vsM.Desc, Environment.NewLine, GetIcon(IconM2MDefault)));
                            AddGroupedLeftItem(dictDefs, "默认组", new LeftMenuItem(CCFlowPath, vsM.Desc, url, IconM2MDefault, false));
                            ItemCount++;
                        }
                    }
                    else
                    {
                        if (this.AttrKey == vsM.EnsOfMM.ToString())
                        {
                            //AddLi(string.Format(
                            //    "<div style='font-weight:bold'><a href='{0}'>{4}<span class='nav'>{1}[{2}]</span></a></div>{3}",
                            //    url, vsM.Desc, i, Environment.NewLine, GetIcon(IconM2MDefault)));
                            AddGroupedLeftItem(dictDefs, "默认组", new LeftMenuItem(CCFlowPath, vsM.Desc + "[" + i + "]", url, IconM2MDefault, true));
                            ItemCount++;
                        }
                        else
                        {
                            //AddLi(string.Format("<div><a href='{0}'>{4}<span class='nav'>{1}[{2}]</span></a></div>{3}", url, vsM.Desc, i, Environment.NewLine, GetIcon(IconM2MDefault)));
                            AddGroupedLeftItem(dictDefs, "默认组", new LeftMenuItem(CCFlowPath, vsM.Desc + "[" + i + "]", url, IconM2MDefault, false));
                            ItemCount++;
                        }
                    }
                }
            }
            #endregion

            #region 加入他门的 方法
            Dictionary <string, List <LeftMenuItem> > dictGrps = new Dictionary <string, List <LeftMenuItem> >();

            RefMethods myreffuncs = en.EnMap.HisRefMethods;
            string     path       = this.Request.ApplicationPath;
            bool       haveGroup  = false;
            foreach (RefMethod func in myreffuncs)
            {
                if (func.Visable == false || func.RefAttrKey != null)
                {
                    continue;
                }

                haveGroup = !string.IsNullOrWhiteSpace(func.GroupName);

                if (func.RefMethodType != RefMethodType.Func)
                {
                    string myurl = func.Do(null) as string;
                    int    h     = func.Height;

                    if (func.RefMethodType == RefMethodType.RightFrameOpen)
                    {
                        //AddLi(string.Format(
                        //        "<div><a href='javascript:void(0)' onclick=\"javascript:OpenUrlInRightFrame(this,'{0}')\" title='{1}'>{4}<span class='nav'>{2}</span></a></div>{3}",
                        //        myurl, func.ToolTip, func.Title, Environment.NewLine, GetIcon(func.Icon)));
                        AddGroupedLeftItem(haveGroup ? dictGrps : dictDefs, haveGroup ? func.GroupName : "默认组",
                                           new LeftMenuItem(CCFlowPath, func.Title, "javascript:OpenUrlInRightFrame(this,'" + myurl + "')", func.Icon, false,
                                                            func.ToolTip));
                        ItemCount++;
                        continue;
                    }

                    if (func.Target == null)
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href='" + myurl + "' ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        //AddLi(string.Format("<div><a href='{0}' title='{1}'>{4}<span class='nav'>{2}</span></a></div>{3}", myurl, func.ToolTip, func.Title, Environment.NewLine, GetIcon(func.Icon)));
                        AddGroupedLeftItem(haveGroup ? dictGrps : dictDefs, haveGroup ? func.GroupName : "默认组",
                                           new LeftMenuItem(CCFlowPath, func.Title, myurl, func.Icon, false,
                                                            func.ToolTip));
                        ItemCount++;
                    }
                    else
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href=\"javascript:WinOpen('" + myurl + "','" + func.Target + "')\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        //AddLi(string.Format("<div><a href=\"javascript:WinOpen('{0}','{1}')\" title='{2}'>{5}<span class='nav'>{3}</span></a></div>{4}", myurl, func.Target, func.ToolTip, func.Title, Environment.NewLine, GetIcon(func.Icon)));
                        AddGroupedLeftItem(haveGroup ? dictGrps : dictDefs, haveGroup ? func.GroupName : "默认组",
                                           new LeftMenuItem(CCFlowPath, func.Title,
                                                            "javascript:WinOpen('" + myurl + "', '" + func.Target + "')",
                                                            func.Icon, false,
                                                            func.ToolTip));
                        ItemCount++;
                    }
                    continue;
                }

                // string url = path + "/Comm/RefMethod.aspx?Index=" + func.Index + "&EnsName=" + hisens.ToString() + keys;
                string url = "../RefMethod.aspx?Index=" + func.Index + "&EnsName=" + en.GetNewEntities.ToString() + keys;

                //  string urlRefFunc = "RefMethod.aspx?Index=" + func.Index + "&EnsName=" + en.GetNewEntities.ToString() + keys;
                if (func.Warning == null)
                {
                    if (func.Target == null)
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href='" + url + "' ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        //AddLi(string.Format("<div><a href='{0}' title='{1}'>{4}<span class='nav'>{2}</span></a></div>{3}", url, func.ToolTip, func.Title, Environment.NewLine, GetIcon(func.Icon)));
                        AddGroupedLeftItem(haveGroup ? dictGrps : dictDefs, haveGroup ? func.GroupName : "默认组",
                                           new LeftMenuItem(CCFlowPath, func.Title, url, func.Icon, false,
                                                            func.ToolTip));
                        ItemCount++;
                    }
                    else
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href=\"javascript:WinOpen('" + url + "','" + func.Target + "')\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        //AddLi(string.Format("<div><a href=\"javascript:WinOpen('{0}','{1}')\" title='{2}'>{5}<span class='nav'>{3}</span></a></div>{4}", url, func.Target, func.ToolTip, func.Title, Environment.NewLine, GetIcon(func.Icon)));
                        AddGroupedLeftItem(haveGroup ? dictGrps : dictDefs, haveGroup ? func.GroupName : "默认组",
                                           new LeftMenuItem(CCFlowPath, func.Title,
                                                            "javascript:WinOpen('" + url + "', '" + func.Target + "')",
                                                            func.Icon, false,
                                                            func.ToolTip));
                        ItemCount++;
                    }
                }
                else
                {
                    if (func.Target == null)
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href=\"javascript: if ( confirm('" + func.Warning + "') ) { window.location.href='" + url + "' }\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        //AddLi(string.Format(
                        //    "<div><a href=\"javascript: if ( confirm('{0}')){{ window.location.href='{1}' }}\" title='{2}'>{5}<span class='nav'>{3}</span></a></div>{4}",
                        //    func.Warning, url, func.ToolTip, func.Title, Environment.NewLine, GetIcon(func.Icon)));
                        AddGroupedLeftItem(haveGroup ? dictGrps : dictDefs, haveGroup ? func.GroupName : "默认组",
                                           new LeftMenuItem(CCFlowPath, func.Title,
                                                            "javascript: if ( confirm('" + func.Warning +
                                                            "')){{ window.location.href='" + url + "' }}", func.Icon,
                                                            false,
                                                            func.ToolTip));
                        ItemCount++;
                    }
                    else
                    {
                        //this.AddLi(func.GetIcon(path) + "<a href=\"javascript: if ( confirm('" + func.Warning + "') ) { WinOpen('" + url + "','" + func.Target + "') }\" ToolTip='" + func.ToolTip + "' >" + func.Title + "</a>");
                        //AddLi(string.Format(
                        //    "<div><a href=\"javascript: if ( confirm('{0}')){{ WinOpen('{1}','{2}') }}\" title='{3}'>{6}<span class='nav'>{4}</span></a></div>{5}",
                        //    func.Warning, url, func.Target, func.ToolTip, func.Title, Environment.NewLine, GetIcon(func.Icon)));
                        AddGroupedLeftItem(haveGroup ? dictGrps : dictDefs, haveGroup ? func.GroupName : "默认组",
                                           new LeftMenuItem(CCFlowPath, func.Title,
                                                            "javascript: if ( confirm('" + func.Warning +
                                                            "')){{ WinOpen('" + url + "', '" + func.Target + "') }}",
                                                            func.Icon,
                                                            false,
                                                            func.ToolTip));
                        ItemCount++;
                    }
                }
            }
            #endregion

            #region 加入他的明细
            EnDtls enDtls = en.EnMap.Dtls;
            foreach (EnDtl enDtl in enDtls)
            {
                string url = "Dtl.aspx?EnName=" + this.EnName + "&PK=" + this.PK + "&EnsName=" + enDtl.EnsName + "&RefKey=" + enDtl.RefKey + "&RefVal=" + en.PKVal.ToString() + "&MainEnsName=" + en.ToString() + keys;

                try
                {
                    i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "='" + en.PKVal + "'");
                }
                catch
                {
                    try
                    {
                        i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM " + enDtl.Ens.GetNewEntity.EnMap.PhysicsTable + " WHERE " + enDtl.RefKey + "=" + en.PKVal);
                    }
                    catch
                    {
                        enDtl.Ens.GetNewEntity.CheckPhysicsTable();
                    }
                }

                if (i == 0)
                {
                    //this.AddLi("<a href=\"" + url + "\"  >" + enDtl.Desc + "</a>");
                    //AddLi(string.Format("<div><a href='{0}'>{3}<span class='nav'>{1}</span></a></div>{2}", url, enDtl.Desc, Environment.NewLine, GetIcon(IconDtlDefault)));
                    AddGroupedLeftItem(dictDefs, "默认组", new LeftMenuItem(CCFlowPath, enDtl.Desc, url, IconDtlDefault, false));
                    ItemCount++;
                }
                else
                {
                    //this.AddLi("<a href=\"" + url + "\"   >" + enDtl.Desc + "-" + i + "</a>");
                    //AddLi(string.Format("<div><a href='{0}'>{4}<span class='nav'>{1} [{2}]</span></a></div>{3}", url, enDtl.Desc, i, Environment.NewLine, GetIcon(IconDtlDefault)));
                    AddGroupedLeftItem(dictDefs, "默认组", new LeftMenuItem(CCFlowPath, enDtl.Desc + "[" + i + "]", url, IconDtlDefault, false));
                    ItemCount++;
                }
            }
            #endregion

            //AddULEnd();

            //added by liuxc,2016-3-7
            if (dictGrps.Count == 0)
            {
                AddUL("class='navlist'");

                foreach (LeftMenuItem item in dictDefs["默认组"])
                {
                    AddLi(item.LiString);
                }

                AddULEnd();
            }
            else
            {
                Add("<div class='easyui-accordion' data-options='fit:true'>");

                //增加默认组
                Add("<div title='基本功能' style='overflow:auto;'>");
                AddUL("class='navlist'");

                foreach (LeftMenuItem item in dictDefs["默认组"])
                {
                    AddLi(item.LiString);
                }

                AddULEnd();
                AddDivEnd();

                //增加RefMethod分组
                foreach (KeyValuePair <string, List <LeftMenuItem> > grp in dictGrps)
                {
                    Add("<div title='" + grp.Key + "' style='overflow:auto;'>");
                    AddUL("class='navlist'");

                    foreach (LeftMenuItem item in grp.Value)
                    {
                        AddLi(item.LiString);
                    }

                    AddULEnd();
                    AddDivEnd();
                }

                AddDivEnd();
            }
        }