/// <summary> /// 改写BasePage起点定位单元规则,不继承父类规则 /// </summary> /// <param name="e"></param> override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // if (Session["userid"] == null) { this.Response.Write("<script language=\"javascript\">"); this.Response.Write("alert('您未正常登录,请登录后再使用,谢谢!')"); this.Response.Write("</script>"); this.Response.Redirect("default.htm"); } this.PgInitRequestParams(); this.PgUnitName = BuildParamList.getValue(this.PgParamXmlDoc, "UnitName"); UnitItem parentUnit = new UnitItem(DataAccRes.AppSettings("WorkConfig"), this.PgUnitName); AppendItem appendItem = parentUnit.GetAppendItem( BuildParamList.getValue(this.PgParamXmlDoc,"AppendItem")); if (null != appendItem && (null == appendItem.UnitName || "" == appendItem.UnitName.Trim())) { this.PgUnitItem = new UnitItem(); WorkItem workitem = new WorkItem(); this.PgUnitItem.UnitName = appendItem.ItemName; this.PgUnitItem.DataSrcFile = parentUnit.DataSrcFile; this.PgUnitItem.DictColSrcFile = parentUnit.DictColSrcFile; workitem.ItemName = appendItem.ItemName; workitem.DataSrc = appendItem.DataSrc; workitem.ItemType = WorkItemType.MasterData; workitem.AliasList = new System.Collections.Specialized.NameValueCollection(); workitem.DictCol = new DictColumn[0]; workitem.Validities = new Validity[0]; this.PgUnitItem.WorkItemList = new WorkItem[1]; this.PgUnitItem.WorkItemList[0] = workitem; string strXmlItem = "<Item name='{0}' relation='D' linkcol='' dataitem='{1}'/>"; strXmlItem = string.Format(strXmlItem, workitem.ItemName, workitem.DataSrc); this.PgUnitItem.UnitNode.InnerXml = strXmlItem; } else if (null != appendItem) { this.PgUnitItem = new UnitItem(DataAccRes.AppSettings("WorkConfig"), appendItem.UnitName); this.PgUnitName = appendItem.UnitName; BuildParamList.setValue(this.PgParamXmlDoc, ParamRangeType.Page, ParamUseType.Data, "UnitName", appendItem.UnitName); } else if (null == appendItem) { this.PgUnitItem = parentUnit; this.PgUnitName = parentUnit.UnitName; } this.PgQuery = new QueryDataRes(this.PgUnitItem.DataSrcFile); this.PgDictQuery = new QueryDataRes(this.PgUnitItem.DictColSrcFile); this.PgWorkItemList = this.PgUnitItem.WorkItemList; this.PgUserRight = new Estar.Business.UserRight.User(this.Session["userid"].ToString()); //动态创建控件 this.PgWfInit(e); InitializeComponent(); //base.OnInit(e); }
/// <summary> /// 根据窗口类型返回URL;应用于主窗口的附加功能 /// </summary> /// <param name="winType">窗口类型</param> /// <returns>打开工作单元附加功能窗口的URL</returns> private string getUrlByWinType(UnitItem unitItem, string winType, string strAppendName) { string ls_workurl=""; switch(winType.ToLower()) { //当前单元的明细内容 case "detail": string strTp = unitItem.FileEditTp; if(null==strTp || string.Empty==strTp) break; else ls_workurl="wfIndepend.aspx"; break; //当前单元的附加项内容 case "appenditem": AppendItem appendItem = unitItem.GetAppendItem(strAppendName); //取得appenditem的url,如果为HTML,则返回HTML路径 if (appendItem.HTMLURL == "") { switch (appendItem.FunType) { case AppendFunType.Browse: ls_workurl = @"wfSimpAppend.aspx?"; break; case AppendFunType.Import: ls_workurl = @"wfSimpAppend.aspx?"; break; case AppendFunType.Report: break; default: ls_workurl = @appendItem.HTMLURL + "?"; break; } } else { ls_workurl = @appendItem.HTMLURL+"?"; } ls_workurl +=appendItem.DialogHeight+","+appendItem.DialogWidth; break; //其他弹出窗口 case "chart": ls_workurl="wfChartModal.aspx"; break; case "print": string prnmode = DataAccRes.AppSettings("prnmode"); if (prnmode!=null) { if (prnmode.ToLower() == "inline") ls_workurl = "frmprint.aspx"; else ls_workurl = "frmprint.aspx?100,200"; } else ls_workurl = "frmprint.aspx?100,200"; break; //单独打开的单元 case "newwinitem": ls_workurl = @"wfSimpAppend.aspx?"; break; default: ls_workurl=string.Empty;break; } return ls_workurl; }