protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CityId = (this.Page as EyouSoft.Common.Control.FrontPage).CityId; if ((this.Page as EyouSoft.Common.Control.FrontPage).CityModel != null) { PrivoinceId = (this.Page as EyouSoft.Common.Control.FrontPage).CityModel.ProvinceId; } IsSiteExtend = EyouSoft.BLL.AdvStructure.SiteExtend.CreateInstance().IsExtendSite(CityId); GetUnionLogo(); //联盟logo this.GetHotCitys(); //热门城市 this.GetThemeList(); //旅游主题 switch (HeadMenuIndex) { case 1: this.liMenu1.Attributes["class"] = "dqy"; break; case 2: this.liMenu2.Attributes["class"] = "dqy"; break; case 3: this.liMenu3.Attributes["class"] = "dqy"; break; case 4: this.liMenu4.Attributes["class"] = "dqy"; break; case 5: this.liMenu5.Attributes["class"] = "dqy"; break; case 6: this.liMenu6.Attributes["class"] = "dqy"; break; case 7: this.liMenu7.Attributes["class"] = "dqy"; break; default: this.liMenu1.Attributes["class"] = "dqy"; break; } menu1.HRef = SubStation.CityUrlRewrite(CityId); menu2.HRef = Tour.GetXianLuUrl(CityId); menu3.HRef = Plane.PlaneDefaultUrl(CityId); menu4.HRef = Hotel.GetHotelBannerUrl(CityId); menu5.HRef = ScenicSpot.ScenicDefalutUrl(CityId); menu6.HRef = EyouSoft.Common.URLREWRITE.SupplierInfo.InfoDefaultUrlWrite(CityId); menu7.HRef = Infomation.InfoDefaultUrlWrite(); } }
public void SetSubstation(SubStation substation) { var selectedObject = new SubstationAttributes(); selectedObject.SetSubstation(substation, this); this.DataContext = selectedObject; _propertyGrid.Update(); }
public City(DataBus databus) { _databus = databus; SubStation = new SubStation(_databus); NuclearStation = new NuclearStation(_databus); WeatherStantion = new WeatherStantion(_databus); Municipality = new Municipality(_databus); Bank = new Bank(_databus); Houses = new Houses(_databus); Airport = new Airport(_databus); Start(); _instance = this; }
protected void Page_Load(object sender, EventArgs e) { if (CityId > 0) { DefaultUrl = SubStation.CityUrlRewrite(CityId); } else { DefaultUrl = Domain.UserPublicCenter + "/"; } if (!Page.IsPostBack) { GetUnionLogo(); GetAllSaleCity(); } this.Page.Title = "选择城市"; }
//生成block预览 //插入block public void Insertblock(string s, out bool status) { status = false; DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument(); Database db = HostApplicationServices.WorkingDatabase; ObjectId spaceId = db.CurrentSpaceId; Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; String promptText = s.Contains("锅炉") ? "\n 选择插入热源的位置" : "\n 选择插入热力站的位置"; PromptPointOptions getPointOptions = new PromptPointOptions(promptText); getPointOptions.AppendKeywordsToMessage = true; PromptPointResult getPointResult = ed.GetPoint(getPointOptions); if (getPointResult.Status == PromptStatus.Cancel) { status = true; return; } using (Transaction trans = db.TransactionManager.StartTransaction()) { ObjectId layerid = HeatSourceLayoutApp.currentSolution.BaseObjectId; LayerTableRecord layer = trans.GetObject(layerid, OpenMode.ForWrite) as LayerTableRecord; ObjectId blockid = spaceId.InsertBlockReference(layer.Name, s, getPointResult.Value, new Scale3d(HeatSourceLayoutApp.globalProperty.BlockScale), 0); trans.Commit(); //将新建的热力站/热源存入解决方案的对象中 if (s.CompareTo("锅炉5吨") == 0) { HeatProducer producer = new HeatProducer(HeatSourceLayoutApp.currentSolution, true); producer.BaseObjectId = blockid; producer.Save(); HeatSourceLayoutApp.currentSolution.HeatProducers.Add(blockid, producer); } else if (s.CompareTo("换热机组") == 0) { SubStation station = new SubStation(HeatSource.HeatSourceLayoutApp.currentSolution, true); station.BaseObjectId = blockid; station.Save(); HeatSourceLayoutApp.currentSolution.SubStations.Add(blockid, station); } } }
private static int GetOrAddSubStation(string name, LookupTables lookupTables, AdoDataConnection connection) { SubStation station = new SubStation { Name = name, }; if (lookupTables.SubStationsLookup.ContainsKey(name)) { station.ID = lookupTables.SubStationsLookup[name].ID; (new TableOperations <SubStation>(connection)).UpdateRecord(station); } else { (new TableOperations <SubStation>(connection)).AddNewRecord(station); station.ID = connection.ExecuteScalar <int>("SELECT @@IDENTITY"); lookupTables.SubStationsLookup.Add(name, station); } return(station.ID); }
public FakeNetworksService() { networks = new List <Network>(); Network network = new Network(1, "Network 1", 10); SubStation substation1 = new SubStation(2, "Substation A"); Device switch1 = new Switch(3, "Switch A"); Line line1 = new Line(4, "Line A", 100); line1.Terminal1 = substation1; line1.Terminal2 = switch1; substation1.Terminal = line1; switch1.Terminal1 = line1; SubStation subStation2 = new SubStation(10, "Substation B"); subStation2.Terminal = line1; switch1.Terminal2 = subStation2; Load load1 = new Load(5, "Load 1"); line1.Connect(load1); Load load2 = new Load(7, "Load 2"); line1.Connect(load2); network.Add(substation1); network.Add(subStation2); network.Add(switch1); network.Add(line1); networks.Add(network); }
/// <summary> /// 获的所有的销售城市 /// </summary> protected void GetAllSaleCity() { int Index = EyouSoft.Common.Utils.GetInt(Request.QueryString["Index"]); string strUrl = "/Default.aspx"; switch (Index) { case 2: strUrl = "/RouteManage/Default.aspx"; break; case 3: strUrl = "/PlaneInfo/PlaneListPage.aspx"; break; case 4: strUrl = "/ScenicManage/ScenicDefalut.aspx"; break; case 5: strUrl = "/HotelManage/Default.aspx"; break; case 6: strUrl = "/CarInfo/CarListPage.aspx"; break; case 7: strUrl = "/TravelManage/TravelDefault.aspx"; break; case 8: strUrl = "/ShoppingInfo/ShoppingListPage.aspx"; break; case 9: strUrl = "/SupplierInfo/SupplierInfo.aspx"; break; } StringBuilder strAllCity = new StringBuilder(); IList <EyouSoft.Model.SystemStructure.SysProvince> ProvinceList = EyouSoft.BLL.SystemStructure.SysProvince.CreateInstance().GetProvinceList(); if (ProvinceList != null && ProvinceList.Count > 0) { EyouSoft.IBLL.SystemStructure.ISysCity Citybll = EyouSoft.BLL.SystemStructure.SysCity.CreateInstance(); foreach (EyouSoft.Model.SystemStructure.SysProvince Province in ProvinceList) { IList <EyouSoft.Model.SystemStructure.SysCity> Citylist = Citybll.GetSysCityList(Province.ProvinceId, null); if (Citylist != null && Citylist.Count > 0) { strAllCity.Append("<tr>"); strAllCity.Append("<td align=\"left\" style=\"border-bottom: 1px dashed rgb(238, 238, 238);\">"); strAllCity.AppendFormat("<h3>{0}:", Province.ProvinceName); string allCity = ""; int Count = 0; Citylist = (Citylist.OrderByDescending(pet => pet.IsEnabled)).ToList(); foreach (EyouSoft.Model.SystemStructure.SysCity City in Citylist) { if (Count != 0 && Count % 7 == 0) { allCity += "<br/> "; } string Enabledstyle = ""; if (!City.IsEnabled) { Enabledstyle = "style='color:#6E90B6'"; } allCity += string.Format("<nobr><a href=\"{0}\" nowrap=\"nowrap\" {2}>{1}</a></nobr> <span style='color:#eeeeee'>|</span> ", SubStation.CityUrlRewrite(City),//strUrl + "?CityId=" + City.CityId + "&isCut=1", City.CityName, Enabledstyle); Count++; } if (allCity != "") { allCity = allCity.Substring(0, allCity.Length - 9); } strAllCity.Append(allCity); strAllCity.Append("</h3>"); strAllCity.Append("</td>"); strAllCity.Append("</tr>"); } Citylist = null; } Citybll = null; } ProvinceList = null; strAllCityList = strAllCity.ToString(); }
public void restore() { isReStoring = true; if (Application.DocumentManager.MdiActiveDocument == null) { return; } Application.DocumentManager.MdiActiveDocument.Database.ObjectAppended -= Database_ObjectAppended; globalProperty = new GlobalProperty(true); Utility.ImportBlocks(); BindEventListener(); showSolution(); BaseModel.ApplicationBaseModels.Clear(); buildings.Clear(); solutions.Clear(); ToolPanel.changedEntityList.Clear(); currentSolution = null; this.LoadMLineStyle(); if (Application.DocumentManager.MdiActiveDocument == null) { return; } //先将所有注册的对象都清空! using (DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument()) { globalProperty.Initialize(); Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; Database db = HostApplicationServices.WorkingDatabase; using (Transaction trans = db.TransactionManager.StartTransaction()) { //首先重建所有的Solution LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite, false); foreach (ObjectId layerId in lt) { //设置图层颜色 LayerTableRecord ltr = (LayerTableRecord)trans.GetObject(layerId, OpenMode.ForWrite); Dictionary <String, String> pairs = BaseModel.Load(layerId); if (pairs != null && pairs.ContainsKey("type") && pairs["type"].CompareTo("solution") == 0) { ChromeTabItem chrometabitem = solutionPanel.chrometabs.RestoreTab(new System.Windows.Controls.Label(), false); chrometabitem.CanDelete = true; solutionPanel.AddCloseHandler(chrometabitem); Solution solution = new Solution(false); solution.ResetAttributes(pairs, layerId); solution.RestoreAttributes(); solution.TabItem = chrometabitem; chrometabitem.Header = solution.SolutionName; solutions.Add(solution); } else if (ltr.Name != "our_outline_layer" && (pairs == null || !pairs.ContainsKey("type"))) { ltr.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Gray); } } trans.Commit(); trans.Dispose(); } using (Transaction trans1 = db.TransactionManager.StartTransaction()) { LayerTable lt = (LayerTable)db.LayerTableId.GetObject(OpenMode.ForWrite); foreach (var layerid in lt) { LayerTableRecord ltr = (LayerTableRecord)layerid.GetObject(OpenMode.ForRead); if (ltr.Name.Contains("outline_layer") || ltr.Name.Contains("方案")) { TypedValue[] tvs = new TypedValue[1] { new TypedValue((int)DxfCode.LayerName, (ltr.Name)) }; SelectionFilter sf = new SelectionFilter(tvs); PromptSelectionResult psr = ed.SelectAll(sf); if (psr.Value != null) { foreach (var objectid in psr.Value.GetObjectIds()) { Dictionary <String, String> pairs = BaseModel.Load(objectid); if (pairs != null && pairs.ContainsKey("type")) { String type = pairs["type"]; if (type.CompareTo(Building.modelType) == 0) { Building b = new Building(false); b.ResetAttributes(pairs, objectid); buildings.Add(objectid, b); } else if (type.CompareTo(HeatProducer.modelType) == 0) { var b = new HeatProducer(); b.ResetAttributes(pairs, objectid); } else if (type.CompareTo(SubStation.modelType) == 0) { var b = new SubStation(); b.ResetAttributes(pairs, objectid); } else if (type.CompareTo(PipeLine.modelType) == 0) { var b = new PipeLine(); b.ResetAttributes(pairs, objectid); b.RetriveMline(); } else if (type.CompareTo(District.modelType) == 0) { var d = new District(); d.ResetAttributes(pairs, objectid); } } } } } } trans1.Dispose(); } using (Transaction trans2 = db.TransactionManager.StartTransaction()) { //然后遍历所有的管道结头 DBDictionary groups = trans2.GetObject(db.GroupDictionaryId, OpenMode.ForRead) as DBDictionary; foreach (DBDictionaryEntry entry in groups) { ObjectId objId = entry.Value; Dictionary <String, String> pairs = BaseModel.Load(objId); if (pairs != null && pairs.ContainsKey("type")) { string type = pairs["type"]; if (type.CompareTo(SimplePipeJoint.modelType) == 0) { var b = new SimplePipeJoint(); b.ResetAttributes(pairs, objId); b.Retrive(); } if (type.CompareTo(MultiPipeJoint.modelType) == 0) { var b = new MultiPipeJoint(); b.ResetAttributes(pairs, objId); b.Retrive(); } } // } } trans2.Dispose(); } foreach (var item in BaseModel.ApplicationBaseModels) { item.Value.RestoreAttributes(); } if (globalProperty.ActiveTab == -1 || globalProperty.ActiveTab == 0) { solutionPanel.SelectOutLineLayer(); HeatSourceLayoutApp.currentSolution = null; } else { foreach (var i_solution in solutions) { if (i_solution.SId == globalProperty.ActiveTab) { solutionPanel.chrometabs.ChangeSelectedItem(i_solution.TabItem); HeatSourceLayoutApp.currentSolution = i_solution; break; } } } } isReStoring = false; Application.DocumentManager.MdiActiveDocument.Database.ObjectAppended += Database_ObjectAppended; }
public void DoubleClick(object sender, BeginDoubleClickEventArgs e) { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; PromptSelectionResult res = ed.SelectImplied(); if (res.Status != PromptStatus.Error) { if ((lastDoubleClickModel is SubStation || lastDoubleClickModel is HeatProducer) && currentSolution != null) { currentSolution.CancelHighLightPipeLine(); } SelectionSet set = res.Value; if (set.Count > 0) { List <ObjectId> vals = new List <ObjectId>(); for (int i = 0; i < set.Count; i++) { if (set[i].SelectionMethod != SelectionMethod.Unavailable) { vals.Add(set[i].ObjectId); } } if (vals.Count == 0) { return; } ObjectId lastId = vals.Last(); //从选择的项目中移除除最后的选择外的其他选择 ObjectId[] newids = { lastId }; ed.SetImpliedSelection(newids); if (HeatSourceLayoutApp.buildings.ContainsKey(lastId)) { Building b = buildings[lastId]; lastDoubleClickModel = b; showBuildingAttrsEditor(); buildingAttrEditor.SetBuilding(b); return; } if (currentSolution == null) { return; } HeatProducer producer = HeatSourceLayoutApp.currentSolution.GetHeatProducer(lastId); if (producer != null) { lastDoubleClickModel = producer; showHeatproducerAttrsEditor(); heatProducerAttrEditor.SetHeatProducer(producer); currentSolution.HighLight(producer); return; } SubStation substation = HeatSourceLayoutApp.currentSolution.GetSubStation(lastId); if (substation != null) { lastDoubleClickModel = substation; showSubstationAttrsEditor(); substationAttrEditor.SetSubstation(substation); currentSolution.HighLight(substation); return; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetUnionLogo(); InitCompanyInfo(); FrontPage basepage = this.Page as FrontPage; basepage.AddJavaScriptInclude(JsManage.GetJsFilePath("jquery"), false, false); basepage.AddStylesheetInclude(CssManage.GetCssFilePath("gouwu")); basepage.AddStylesheetInclude(CssManage.GetCssFilePath("body")); GetCity(); CityId = (this.Page as EyouSoft.Common.Control.FrontPage).CityId; IsSiteExtend = EyouSoft.BLL.AdvStructure.SiteExtend.CreateInstance().IsExtendSite(CityId); BindNotice(); //公告 BindNum(); //采购商、供应商、供需数量 GetUnionLogo(); //联盟logo this.GetHotCitys(); //热门城市 switch (HeadMenuIndex) { case 1: menu1.Attributes["class"] = "select"; break; case 2: menu2.Attributes["class"] = "select"; break; case 3: menu3.Attributes["class"] = "select"; break; case 4: menu4.Attributes["class"] = "select"; break; case 5: menu5.Attributes["class"] = "select"; break; case 6: menu6.Attributes["class"] = "select"; break; case 7: menu7.Attributes["class"] = "select"; break; default: menu1.Attributes["class"] = "select"; break; } menu1.HRef = SubStation.CityUrlRewrite(CityId); menu2.HRef = Tour.GetXianLuUrl(CityId); //menu3.HRef = Plane.PlaneDefaultUrl(CityId); menu4.HRef = Hotel.GetHotelBannerUrl(CityId); menu5.HRef = ScenicSpot.ScenicDefalutUrl(CityId); menu6.HRef = EyouSoft.Common.URLREWRITE.SupplierInfo.InfoDefaultUrlWrite(CityId); menu7.HRef = Infomation.InfoDefaultUrlWrite(); } }
public void SetSubstation(SubStation substation, SubstationAttrEditor editor) { this.currentSubStation = substation; substationAttrEditor = editor; }
public SubstationInfo(string name, SubStation substation) : base(name) { _substation = substation; }