public void NewLocation(string name, string address, string city, int phone) { TLocation newLocation = new TLocation { Name = name, Address = address, City = city, Phone = phone }; db.TLocations.InsertOnSubmit(newLocation); // Submit the change to the database. try { db.SubmitChanges(); MessageBox.Show("Successfully added new location"); } catch (Exception e) { MessageBox.Show("Failed to insert the new location."); MessageBox.Show(e.ToString()); db.SubmitChanges(); } }
private void button7_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string s in File.ReadAllLines(ofd.FileName)) { bool isok; double d; string[] p = s.Split(','); if (p.Length == 5) { TLocation loc = new TLocation(); loc.CityName = p[0]; loc.CountryISOCode = p[1]; isok = GCEarthData.ToDouble(p[2], out d, 'N', 'S'); if (!isok) { continue; } loc.Latitude = d; isok = GCEarthData.ToDouble(p[3], out d, 'E', 'W'); if (!isok) { continue; } loc.Longitude = d; loc.TimeZoneName = p[4]; listBox1.Items.Add(new LocProxy(loc)); } } } }
private void button1_Click(object sender, EventArgs e) { LocationWrapper lw = new LocationWrapper(SelectedLocation); if (SelectedLocation == null) { SelectedLocation = lw.location; } double d; SelectedLocation.CityName = textBox1.Text; SelectedLocation.CountryISOCode = (comboBox1.SelectedItem as TCountry).ISOCode; ToDouble(textBox2.Text, out d, 'N', 'S'); SelectedLocation.Latitude = d; ToDouble(textBox3.Text, out d, 'E', 'W'); SelectedLocation.Longitude = d; TTimeZone tz = comboBox2.SelectedItem as TTimeZone; SelectedLocation.TimeZone = tz; if (OnEditLocationDone != null) { OnEditLocationDone(lw, e); } Controller.RemoveFromContainer(); }
private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { lastLocation = listView1.SelectedItems[0].Tag as TLocation; } }
private void button2_Click(object sender, EventArgs e) { // 把JSON資料轉回物件 string s = "{\"X\":100,\"Y\":200,\"Name\":\"TC\"}"; TLocation obj = JsonConvert.DeserializeObject <TLocation>(s); // Deserialize 反序列化 button2.Text = obj.Name; }
public void Post([FromBody] string value) { TLocation location = new TLocation { address = "Avenida Sumaré", number = 300, zip = "55123000" }; this.OrdersStorage.Add(DateTime.Now, 1, 1, location); }
public void setLocation(TLocation selloc) { SelectedLocation = selloc; TCountry findCountry = (PrefferedCountry is TCountry ? PrefferedCountry as TCountry : null); comboBox1.BeginUpdate(); foreach (TCountry ct in TCountry.Countries) { comboBox1.Items.Add(ct); } comboBox1.Sorted = true; comboBox1.EndUpdate(); comboBox2.BeginUpdate(); foreach (TTimeZone tz in TTimeZone.TimeZoneList) { comboBox2.Items.Add(tz); } comboBox2.EndUpdate(); if (SelectedLocation == null) { textBox1.Text = "<new location>"; textBox2.Text = "12N50"; textBox3.Text = "50W13"; comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; } else { textBox1.Text = SelectedLocation.CityName; for (int i = 0; i < comboBox1.Items.Count; i++) { TCountry tc = comboBox1.Items[i] as TCountry; if (tc.Name.Equals(SelectedLocation.Country.Name)) { comboBox1.SelectedIndex = i; break; } } textBox2.Text = GCEarthData.GetTextLatitude(SelectedLocation.Latitude); textBox3.Text = GCEarthData.GetTextLongitude(SelectedLocation.Longitude); for (int j = 0; j < comboBox2.Items.Count; j++) { TTimeZone tz = comboBox2.Items[j] as TTimeZone; if (tz.Name.Equals(SelectedLocation.TimeZoneName)) { comboBox2.SelectedIndex = j; break; } } } }
private void AddLocationToListView(TLocation loc) { ListViewItem lvi = new ListViewItem(loc.CityName); lvi.SubItems.Add(loc.Country.Name); lvi.SubItems.Add(GCEarthData.GetTextLatitude(loc.Latitude)); lvi.SubItems.Add(GCEarthData.GetTextLongitude(loc.Longitude)); lvi.SubItems.Add(TTimeZone.GetTimeZoneOffsetText(loc.TimeZone.OffsetMinutes / 60.0)); lvi.Tag = loc; listView1.Items.Add(lvi); }
private ListViewItem ListItemFromLocation(TLocation L) { ListViewItem lvi = new ListViewItem(L.CityName); lvi.SubItems.Add(L.Country.Name); lvi.SubItems.Add(GCEarthData.GetTextLatitude(L.Latitude)); lvi.SubItems.Add(GCEarthData.GetTextLongitude(L.Longitude)); lvi.SubItems.Add(L.TimeZoneName); lvi.Tag = L; return(lvi); }
private void button1_Click(object sender, EventArgs e) { // 寫一個類別,用JSON格式序列化資料 TLocation obj = new TLocation() { X = 100, Y = 200, Name = "TC" }; // JSON用: , C# 用 = string s = JsonConvert.SerializeObject(obj); textBox1.Text += s + System.Environment.NewLine + System.Environment.NewLine; }
public string GenerateYearIndex(TLocation loc, int sy, int ey) { StringBuilder sb = new StringBuilder(); sb.Append("<html><head></title>Vaisnava calendars</title></head>"); sb.Append("<body>"); sb.AppendLine("<h1>" + loc.CityName + " (" + loc.Country.Name + ")" + "</h1>"); sb.AppendFormat("<p>{0} {1}</p>", GCEarthData.GetTextLatitude(loc.Latitude), GCEarthData.GetTextLongitude(loc.Longitude)); sb.AppendLine("<hr>"); sb.AppendLine("<h2>Text (Brief)</h2>"); sb.AppendLine("<p>"); for (int y = sy; y <= ey; y++) { if (y > sy) { sb.AppendLine(" | "); } sb.AppendFormat("<a href=\"{1}\">{0}</a> ", y, y.ToString() + "_" + ToFilePart(loc.CityName) + ".html", sy); } sb.AppendLine("</p>"); sb.AppendLine("<hr>"); sb.AppendLine("<h2>Text (Full)</h2>"); sb.AppendLine("<p>"); for (int y = sy; y <= ey; y++) { if (y > sy) { sb.AppendLine(" | "); } sb.AppendFormat("<a href=\"{1}\">{0}</a> ", y, y.ToString() + "_" + ToFilePart(loc.CityName) + "_d.html", sy); } sb.AppendLine("</p>"); sb.AppendLine("<hr>"); sb.AppendLine("<h2>PDF</h2>"); sb.AppendLine("<p>"); for (int y = sy; y <= ey; y++) { if (y > sy) { sb.AppendLine(" | "); } sb.AppendFormat("<a href=\"{1}\">{0}</a> ", y, y.ToString() + "_" + ToFilePart(loc.CityName) + ".pdf", sy); } sb.AppendLine("</p>"); sb.Append("</body>"); sb.Append("</html>"); return(sb.ToString()); }
/// <summary> /// edit location /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonEdit_Click(object sender, EventArgs e) { if (listViewLocations.SelectedItems.Count == 0) { return; } TLocation loc = listViewLocations.SelectedItems[0].Tag as TLocation; EditLocationPanel d = new EditLocationPanel(); d.setLocation(loc); d.PrefferedCountry = m_wndCountry.SelectedItem; d.OnEditLocationDone += new TBButtonPressed(OnEditLocationDone); EditLocationPanelController dc = new EditLocationPanelController(d); dc.ShowInContainer(Controller.ViewContainer, GVControlAlign.Center); }
/// <summary> /// delete location /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonDelete_Click(object sender, EventArgs e) { if (listViewLocations.SelectedItems.Count == 0) { return; } TLocation loc = listViewLocations.SelectedItems[0].Tag as TLocation; string ask = string.Format("Do you want to remove location for city \"{0}\" ?", loc.CityName); if (MessageBox.Show(ask, "Confirm", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { TLocationDatabase.LocationList.Remove(loc); TLocationDatabase.Modified = true; UpdateLocationList(); } }
/// <summary> /// Show Google Maps /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button6_Click(object sender, EventArgs e) { if (listViewLocations.SelectedItems.Count == 0) { return; } TLocation loc = listViewLocations.SelectedItems[0].Tag as TLocation; if (loc != null) { string str = string.Format("<html><head><meta http-equiv=\"REFRESH\" content=\"0;url=http://maps.google.com/?ie=UTF8&ll={0},{1}&spn=0.774196,1.235962&z=10" + "\"></head><body></body><html>", loc.Latitude, loc.Longitude); string fileName = GCGlobal.TemporaryFolderPath; fileName += "temp.html"; File.WriteAllText(fileName, str); System.Diagnostics.Process.Start(fileName); } }
private void SelectLocation(TLocation loc) { if (loc == null) { SelectFirstLocation(); return; } foreach (ListViewItem lvi in listView1.Items) { if (lvi.Tag == loc) { listView1.SelectedItems.Clear(); lvi.Selected = true; listView1.EnsureVisible(lvi.Index); return; } } SelectFirstLocation(); }
private void buttonSetCountryByCity_Click(object sender, EventArgs e) { if (lastLocation != null) { TLocation loc = lastLocation; int i = 0; foreach (object c in comboBoxCountry.Items) { if (c is TCountry) { TCountry tc = c as TCountry; if (tc.ISOCode.Equals(loc.CountryISOCode)) { comboBoxCountry.SelectedIndex = i; break; } } i++; } } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { SetProgressValue locdel = new SetProgressValue(SetLocationsProgressValue); SetProgressValue yrdel = new SetProgressValue(SetYearsProgressvalue); List <FileRec> files = new List <FileRec>(); HashSet <string> countries = new HashSet <string>(); GCDisplaySettings stateDetailedText = new GCDisplaySettings("Detailed Calendar"); GCDisplaySettings stateText = new GCDisplaySettings("Brief Calendar"); GCDisplaySettings stateOrig = GCDisplaySettings.Current; try { // stateText.Clear(); stateText.setValue(GCDS.CAL_DST_CHANGE, 1); stateText.setValue(GCDS.CAL_EKADASI_PARANA, 1); stateText.setValue(GCDS.CAL_FEST_0, 1); stateText.CalHeaderType = 1; stateText.setValue(GCDS.CAL_MASA_CHANGE, 1); stateText.setValue(GCDS.CAL_MOON_LONG, 0); stateText.setValue(GCDS.CAL_MOON_RISE, 0); stateText.setValue(GCDS.CAL_MOON_SET, 0); stateText.setValue(GCDS.CAL_SANKRANTI, 0); stateText.setValue(GCDS.CAL_SUN_LONG, 0); stateText.setValue(GCDS.CAL_SUN_RISE, 0); stateText.setValue(GCDS.CAL_SUN_SANDHYA, 0); stateText.setValue(GCDS.CAL_VRDDHI, 0); stateText.setValue(GCDS.COREEVENTS_ABHIJIT_MUHURTA, 0); stateText.setValue(GCDS.COREEVENTS_ASCENDENT, 0); stateText.setValue(GCDS.COREEVENTS_CONJUNCTION, 0); stateText.setValue(GCDS.COREEVENTS_GULIKALAM, 0); stateText.setValue(GCDS.COREEVENTS_MOON, 0); stateText.setValue(GCDS.COREEVENTS_MOONRASI, 0); stateText.setValue(GCDS.COREEVENTS_NAKSATRA, 0); stateText.setValue(GCDS.COREEVENTS_RAHUKALAM, 0); stateText.setValue(GCDS.COREEVENTS_SANKRANTI, 0); stateText.setValue(GCDS.COREEVENTS_SUN, 0); stateText.setValue(GCDS.COREEVENTS_TITHI, 0); stateText.setValue(GCDS.COREEVENTS_YAMAGHANTI, 0); stateText.setValue(GCDS.COREEVENTS_YOGA, 0); stateDetailedText.setValue(GCDS.CAL_ARUN_TIME, 0); stateDetailedText.setValue(GCDS.CAL_ARUN_TITHI, 0); stateDetailedText.setValue(GCDS.CAL_AYANAMSHA, 0); stateDetailedText.setValue(GCDS.CAL_BRAHMA_MUHURTA, 1); stateDetailedText.setValue(GCDS.CAL_COREEVENTS, 1); stateDetailedText.setValue(GCDS.CAL_DST_CHANGE, 1); stateDetailedText.setValue(GCDS.CAL_EKADASI_PARANA, 1); stateDetailedText.setValue(GCDS.CAL_FEST_0, 1); stateDetailedText.CalHeaderType = 1; stateDetailedText.setValue(GCDS.CAL_JULIAN, 0); stateDetailedText.setValue(GCDS.CAL_KSAYA, 0); stateDetailedText.setValue(GCDS.CAL_MASA_CHANGE, 1); stateDetailedText.setValue(GCDS.CAL_SUN_RISE, 1); stateDetailedText.setValue(GCDS.CAL_SUN_SANDHYA, 1); stateDetailedText.setValue(GCDS.COREEVENTS_CONJUNCTION, 1); stateDetailedText.setValue(GCDS.COREEVENTS_GULIKALAM, 0); stateDetailedText.setValue(GCDS.COREEVENTS_MOON, 1); stateDetailedText.setValue(GCDS.COREEVENTS_MOONRASI, 1); stateDetailedText.setValue(GCDS.COREEVENTS_NAKSATRA, 1); stateDetailedText.setValue(GCDS.COREEVENTS_TITHI, 1); stateDetailedText.setValue(GCDS.COREEVENTS_YAMAGHANTI, 0); stateDetailedText.setValue(GCDS.COREEVENTS_YOGA, 1); stateDetailedText.setValue(GCDS.GENERAL_FIRST_DOW, stateOrig.getValue(GCDS.GENERAL_FIRST_DOW)); string content; FileRec currentFileRec; for (int locIndex = 0; locIndex < SelectedLocations.Count; locIndex++) { TLocation loc = SelectedLocations[locIndex]; if (!countries.Contains(loc.Country.Name)) { countries.Add(loc.Country.Name); } progressBar1.Invoke(locdel, locIndex); for (int year = StartYear; year <= EndYear; year++) { if (backgroundWorker1.CancellationPending) { return; } if (CancelRequested) { return; } progressBar2.Invoke(yrdel, year); // Thread.Sleep(1000); TResultCalendar calendar; GCLocation locRef = loc.GetLocationRef(); currentFileRec = new FileRec() { filename = year.ToString() + "_" + ToFilePart(loc.CityName) + ".html", filenameDetail = year.ToString() + "_" + ToFilePart(loc.CityName) + "_d.html", filenamePdf = year.ToString() + "_" + ToFilePart(loc.CityName) + ".pdf", city = loc.CityName, country = loc.Country.Name, year = year }; files.Add(currentFileRec); GCDisplaySettings.Current = stateText; calendar = new TResultCalendar(loc.GetLocationRef(), year); content = calendar.formatText(GCDataFormat.HTML); // print plain TXT File.WriteAllText(Path.Combine(OutputDir, currentFileRec.filename), content); // print PDF PrintPdfYear(calendar, year, Path.Combine(OutputDir, currentFileRec.filenamePdf)); GCDisplaySettings.Current = stateDetailedText; calendar = new TResultCalendar(loc.GetLocationRef(), year); content = calendar.formatText(GCDataFormat.HTML); // print detailed TXT File.WriteAllText(Path.Combine(OutputDir, currentFileRec.filenameDetail), content); } // write location index file if (StartYear != EndYear) { File.WriteAllText(Path.Combine(OutputDir, ToFilePart(loc.CityName) + ".html"), GenerateYearIndex(loc, StartYear, EndYear)); } } for (int year = StartYear; year <= EndYear; year++) { // write main index file File.WriteAllText(Path.Combine(OutputDir, "y" + year.ToString() + ".html"), GenerateMainIndex(countries, year, year)); } // write main index file File.WriteAllText(Path.Combine(OutputDir, "index.html"), GenerateMainIndex(countries, StartYear, EndYear)); // write main years file //File.WriteAllText(Path.Combine(OutputDir, "years.html"), GenerateYearsOverview(StartYear, EndYear)); progressBar1.Invoke(new SetProgressValue(SetDialogCompleted), 0); } catch (Exception ex) { Debugger.Log(0, "", "Error: " + ex.Message + "\n" + ex.StackTrace + "\n"); } finally { GCDisplaySettings.Current = stateOrig; } }
public ResponseMessage SortPoints([FromBody] PointsVm pointsVm) { try { var tspmode = TTSPmode.tspOpen; var gf = TGISFormat.gfSHP; var mTSP = new List <int>(); var sortedPoint = new List <GeoNode>(); //var point = JsonConvert.DeserializeObject<points>(w); //var count = point.coordinates.Count - 1; var shpfolder = _appSettings.RoutewareSettings.ShapeFolder.Replace("{{region}}", pointsVm.Region); var binfolder = _appSettings.RoutewareSettings.BinFolder.Replace("{{region}}", pointsVm.Region); var outfolder = _appSettings.RoutewareSettings.OutputFolder.Replace("{{region}}", pointsVm.Region); var NW = new TNetwork(); NW.InitPassword(_appSettings.RoutewareSettings.Password); NW.Directory = binfolder; NW.Open(true, true, true, 0); // open attributes too, don't cache coord3 and open externID without caching NW.OpenLimit(1, 1, false); NW.OpenLimit(2, 2, true); NW.OpenRoadName(1, false); NW.CreateArrayTime(3); // 3 time arrays: 0,1,2 NW.CreateArrayCost(1); // 1 cost array: 0 // set speed as value based upon road classes 1,2,3,4,6 (store in index 0) TRoadClassSpeed rcs = new TRoadClassSpeed(); rcs[1] = 110; rcs[2] = 80; rcs[3] = 65; rcs[4] = 55; rcs[5] = 45; rcs[6] = 25; NW.CalculateTime(0, rcs); TRandom r = new TRandom(); r.SetSeed(987654321); // read speed into ArrayTime[2] from field "speed" in link.dbf NW.ReadSpeed(2, shpfolder + "\\link.dbf", 0, "speed", false); int link; // set speed as random value from 60-100 km/h (store in index 1) for (link = 1; link <= NW.LinkCount; link++) { NW.SetSpeed(1, link, 60 + 40 * (float)r.NextDouble()); } // set cost as the same as time from index 0 for (link = 1; link <= NW.LinkCount; link++) { NW.SetCost(0, link, NW.GetTime(0, link)); } NW.UpdateAlphas(); TSpatialSearch ss = new TSpatialSearch(NW); TLocationList ll = new TLocationList(); TBitArray TBA = new TBitArray(1000); TIntegerList nl = new TIntegerList(); if (pointsVm.Nodes != null) { for (int i = 0; i < pointsVm.Nodes.Count; i++) { TFloatPoint fp; fp.x = Convert.ToDouble(pointsVm.Nodes[i].Coordinates[0]); fp.y = Convert.ToDouble(pointsVm.Nodes[i].Coordinates[1]); TLocation ll1 = new TLocation(); int side = 0; double distance = 0; TFloatPoint fPnew = new TFloatPoint(); ss.NearestLocation(fp, out ll1, out side, out distance, out fPnew); ll.Add1(ll1); ll.Add3(fp); ll.Add4(ll1, fp); nl.Add(ss.NearestNodeSimple(fp)); } ll.Sort(); nl.Sort(); nl.RemoveDuplicates(); } TRouteCalc calc = new TRouteCalc(NW, false); calc.SetTime(0); calc.SetFastest(false); calc.MaxSpeed = 110; // 90 > 80 and 110 > 80 float[][] matrix = calc.Matrix(nl, (tspmode != TTSPmode.tspRoundTrip), false); // A faster and straight-line matrix // TMatrix Matrix = NW.Matrix(NL,(mode != TTspmode.tspRoundTrip)); // optimize sequence of matrix TTSP tsp = new TTSP { Mode = tspmode }; tsp.Execute(matrix); for (int i = 0; i < nl.Count; i++) { mTSP.Add(tsp.SortedIndex[i]); } // Use TDrivingDirections for output TGISWrite output = NW.GISoutputInit(outfolder + "tsp_driving", gf); TDrivingDirections dd = new TDrivingDirections(calc) { ConcatenationMode = TConcatenationMode.cmCompact, RoundTrip = (tspmode == TTSPmode.tspRoundTrip), SortedIndex = tsp.SortedIndex }; dd.RouteList(output, nl); output = NW.GISoutputInit(outfolder + "tsp", gf); output.StartHeader(1, TObjectTypes.otPline); output.AddField("sequence", TGISField.gfInteger, 0, 0); int d = 0; if (tspmode != TTSPmode.tspRoundTrip) { d = 1; } for (int i = 0; i < nl.Count - d; i++) { int node1 = nl[tsp.SortedIndex[i]]; int node2 = i != nl.Count - 1 ? nl[tsp.SortedIndex[i + 1]] : nl[tsp.SortedIndex[0]]; calc.Route(node1, node2); TRoute route = calc.RouteFind(node2); TFloatPointArrayEx list = NW.GetGISSectionRoute(route); output.AddObject(1, false, i.ToString(CultureInfo.InvariantCulture)); output.AddSection(1, ref list); } output.Close(); output = NW.GISoutputInit(outfolder + "tsppoint", gf); output.StartHeader(1, TObjectTypes.otPoint); output.AddField("sequence", TGISField.gfInteger, 0, 0); for (int i = 0; i < nl.Count; i++) { int node1 = nl[tsp.SortedIndex[i]]; TFloatPoint p1 = NW.Node2Coordinate(node1); output.AddPoint2(p1, i.ToString(CultureInfo.InvariantCulture)); } output.Close(); for (int i = 0; i < mTSP.Count; i++) { sortedPoint.Add(pointsVm.Nodes[mTSP[i]]); } return(new ResponseMessage { Status = "Ok", Data = sortedPoint }); } catch (Exception ex) { return(new ResponseMessage { Status = "Error", Message = "Error sorting nodes." }); } }
public LocationWrapper(TLocation loc) { created = (loc == null); location = (loc == null ? new TLocation() : loc); }
/// <summary> /// 初始化数据库 /// </summary> private static void InitializeDB() { BLL.TLocation.EmptyData(); BLL.TManufacture.EmptyData(); BLL.TManufactureWorkpiece.EmptyData(); BLL.TEquipment.EmptyData(); BLL.TWorkpiece.EmptyData(); BLL.TWorkpieceProcess.EmptyData(); BLL.TSetting.EmptyData(); if (!BLL.SettingExist(AdminID, "MacIP")) { string[] array = { "192.168.1.120", "192.168.1.121", "192.168.1.122", "192.168.1.123", "192.168.1.124" }; BLL.SettingAdd(AdminID, "MacIP", string.Join(";", array)); } if (!BLL.SettingExist(AdminID, "RFIDIP")) { string[] array = { "192.168.1.131", "192.168.1.132", "192.168.1.133", "192.168.1.134", "192.168.1.135", "192.168.1.136", "192.168.1.137", "192.168.1.138", "192.168.1.139" }; BLL.SettingAdd(AdminID, "RFIDIP", string.Join(";", array)); } var location = new TLocation { Name = LocationName, Type = "默认", //EnumHelper.GetName(TLocation.EnumType.默认), State = "正常", //EnumHelper.GetName(TLocation.EnumState.正常), Description = LocationName, }; BLL.TLocation.Insert(location, AdminID); LocationID = location.ID; BLL.SettingAdd(AdminID, "SelectedLocation", LocationID, "TLocation"); var wps = Enum.GetValues(typeof(EnumWorkpiece)).Cast <EnumWorkpiece>().ToArray(); string[] wpDescriptions = { "小圆", "中圆", "大圆", "底座", "装配成品" }; for (int i = 0; i < wps.Length; i++) { var workpiece = new TWorkpiece { LocationID = LocationID, Name = Enum.GetName(typeof(EnumWorkpiece), wps[i]), Type = "默认", //EnumHelper.GetName(TWorkpiece.EnumType.默认), State = "正常", //EnumHelper.GetName(TWorkpiece.EnumState.正常), Description = wpDescriptions[i], }; BLL.TWorkpiece.Insert(workpiece, AdminID); WorkpieceIDs.Add(wps[i], workpiece.ID); } var manufacture = new TManufacture { LocationID = LocationID, Name = ManufactureName, Type = "默认", //EnumHelper.GetName(TManufacture.EnumType.默认), State = "停止", //EnumHelper.GetName(TManufacture.EnumState.停止), Description = ManufactureName, WorkpieceID = WorkpieceIDs[EnumWorkpiece.E], }; BLL.TManufacture.Insert(manufacture, AdminID); ManufactureID = manufacture.ID; foreach (var wpid in WorkpieceIDs.Values.ToArray()) { var mw = new TManufactureWorkpiece { ManufactureID = manufacture.ID, WorkpieceID = wpid, IsAllowed = true, }; BLL.TManufactureWorkpiece.Insert(mw, AdminID); } var jc1 = new TEquipment { Name = "车床", Type = "机床", //EnumHelper.GetName(TEquipment.EnumType.机床), State = "停止", //EnumHelper.GetName(TEquipment.EnumState.停止), Description = "IP地址:192.168.1.121", ManufactureID = manufacture.ID, }; BLL.TEquipment.Insert(jc1, AdminID); var jc2 = new TEquipment { Name = "高速钻工中心", Type = "机床", //EnumHelper.GetName(TEquipment.EnumType.机床), State = "停止", //EnumHelper.GetName(TEquipment.EnumState.停止), Description = "IP地址:192.168.1.122", ManufactureID = manufacture.ID, }; BLL.TEquipment.Insert(jc2, AdminID); var jc3 = new TEquipment { Name = "铣床", Type = "机床", //EnumHelper.GetName(TEquipment.EnumType.机床), State = "停止", //EnumHelper.GetName(TEquipment.EnumState.停止), Description = "IP地址:192.168.1.123", ManufactureID = manufacture.ID, }; BLL.TEquipment.Insert(jc3, AdminID); var jc4 = new TEquipment { Name = "五轴加工中心", Type = "机床", //EnumHelper.GetName(TEquipment.EnumType.机床), State = "停止", //EnumHelper.GetName(TEquipment.EnumState.停止), Description = "IP地址:192.168.1.124", ManufactureID = manufacture.ID, }; BLL.TEquipment.Insert(jc4, AdminID); }
public LocProxy(TLocation l) { loc = l; }