public MainForm() { InitializeComponent(); btnMenuGroup1.Image = Properties.Resources.up; btnMenuGroup2.Image = Properties.Resources.up; btnMenuGroup3.Image = Properties.Resources.up; var pikFlats = new C_Flats_PIK1_AreasTableAdapter(); flatsAreas = pikFlats.GetData(); dictFlatsAreas = flatsAreas.ToDictionary(k => k.Short_Type, v => v); var flatsTableAdapter = new C_Flats_PIK1TableAdapter(); dbFlats = flatsTableAdapter.GetData(); }
public List <GeneralObject> Load(PIK1.C_Flats_PIK1DataTable dbFlats, out ProjectInfo pi) { List <GeneralObject> gos = new List <GeneralObject>(); pi = null; dictRoomInfo = new Dictionary <string, RoomInfo>(); foreach (var dbFlat in dbFlats) { if (!dictRoomInfo.ContainsKey(dbFlat.Type)) { RoomInfo flat = new RoomInfo(); flat.Type = dbFlat.Type; flat.AreaLive = dbFlat.AreaLive; flat.AreaModules = dbFlat.AreaInModule; flat.AreaTotal = dbFlat.AreaTotalStandart; flat.FactorSmoke = dbFlat.FactorSmoke; flat.ShortType = dbFlat.ShortType; flat.SubZone = dbFlat.SubZone; flat.SelectedIndexBottom = Convert.ToInt32(dbFlat.IndexBottom); flat.SelectedIndexTop = Convert.ToInt32(dbFlat.IndexTop); dictRoomInfo.Add(dbFlat.Type, flat); } } var fileResult = PromptFileResult(); using (ZipArchive zip = ZipFile.OpenRead(fileResult)) { using (var stream = zip.GetEntry("gos").Open()) { using (reader = new BinaryReader(stream)) { pi = ReadProjectInfo(); pi.SpotOptions = ReadSpotOptions(); pi.InsModulesAll = ReadInsModules(); var countGos = reader.ReadInt32(); for (int i = 0; i < countGos; i++) { var go = new GeneralObject(); go.GUID = reader.ReadString(); go.Houses = new List <HouseInfo>(); var countHouse = reader.ReadInt32(); for (int h = 0; h < countHouse; h++) { var hi = new HouseInfo(); hi.Sections = ReadSections(); //hi.SpotInf = ReadSpotInfo(); go.Houses.Add(hi); } go.SpotInf = ReadProjectInfo(); go.SpotInf.InsModulesAll = pi.InsModulesAll; gos.Add(go); } } } } return(gos); }