public void ShowDialogSD(GMapMarker marker) { frmsdgtEdit frm = new frmsdgtEdit(); sd_gt gt0 = marker.Tag as sd_gt; GMapMarkerVector pm = (marker as GMapMarkerVector).ParentMarker; if (pm != null) { gt0.gtSpan = (decimal)Math.Round(control.Manager.GetDistance(pm.Position, marker.Position) * 1000, 1); } sd_gt gt2 = new sd_gt(); Ebada.Core.ConvertHelper.CopyTo(gt0, gt2); frm.RowData = gt2; frm.ShowTab2 = true; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK && allowEdit) { Ebada.Core.ConvertHelper.CopyTo(frm.RowData, gt0); sd_gt gt = gt0; PS_Image image = frm.GetPS_Image(); if (frm.GetImage() != null) { if (gt.ImageID == "" || image == null) { image = new PS_Image(); image.ImageName = "杆塔照片"; image.ImageType = "gt"; image.ImageData = (byte[])frm.GetImage(); gt.ImageID = image.ImageID; Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(image, gt, null); } else { Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(null, new object[] { gt, image }, null); } } else { Client.ClientHelper.PlatformSqlMap.Update<sd_gt>(gt); } marker.Position = new PointLatLng((double)gt.gtLat, (double)gt.gtLon); OnMarkerChanged(marker as GMapMarkerVector); } }
private void btAddM_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (parentID == null) return; sd_gt gt = new sd_gt(); gt.gth = getGgh(); gt.gtCode = ParentObj.LineCode + gt.gth; gt.gtSpan = 50; gt.gtMs = 1.7m; gt.gtHeight = 10m; gt.gtModle = "直线杆"; gt.gtType = "水泥杆"; gt.gtJg = "否"; frmsdgtEdit frm = new frmsdgtEdit(); frm.RowData = gt; frm.MultipleAdd = true;//批量增加 if (frm.ShowDialog() == DialogResult.OK) { gt = frm.RowData as sd_gt; int num = frm.MultipleNum;//批量增加杆塔数 int gh = int.Parse(gt.gth); int count = num; PS_Image image = null; if (frm.GetImage() != null) { count++; image = new PS_Image(); image.ImageName = "杆塔照片"; image.ImageType = "gt"; image.ImageData = (byte[])frm.GetImage(); gt.ImageID = image.ImageID; } object[] gts = new object[count]; if (image != null) gts[count - 1] = image; gt.LineCode = ParentObj.LineCode; string id = DateTime.Now.ToString("yyyyMMddHHmmss"); for (int i = 0; i < num; i++) { sd_gt newgt = new sd_gt(); Ebada.Core.ConvertHelper.CopyTo(gt, newgt); string gth = (gh + 10 * i).ToString("0000"); newgt.gth = gth; newgt.gtID=newgt.gtCode = newgt.LineCode + gth; newgt.gtID+= mRandom.Next(10, 99); gts[i] = newgt; } Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(gts, null, null); gridViewOperation.BindingList.Add(gts); } }