Exemple #1
0
 private void btAddM_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
     if (parentID == null)
         return;
     PS_gt gt = new PS_gt();
     gt.gth = getGgh();
     gt.gtCode = ParentObj.LineCode + gt.gth;
     gt.gtSpan = 50;
     gt.gtMs = 1.7m;
     gt.gtHeight = 10m;
     gt.gtNode = "否";
     gt.gtModle = "直线杆";
     gt.gtType = "混凝土拔梢杆";
     frmgtEdit frm = new frmgtEdit();
     frm.RowData = gt;
     frm.MultipleAdd = true;//批量增加
     if (frm.ShowDialog() == DialogResult.OK) {
         gt = frm.RowData as PS_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++) {
             PS_gt newgt = new PS_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);
     }
 }
Exemple #2
0
        public void ShowDialog(GMapMarker marker) {
            if (marker.Tag is sd_gt) {

                ShowDialogSD(marker);
                return;
            }
            frmgtEdit frm = new frmgtEdit();            
            PS_gt gt0 = marker.Tag as PS_gt;
            GMapMarkerVector pm = (marker as GMapMarkerVector).ParentMarker;
            if (pm != null) {
                gt0.gtSpan = (decimal)Math.Round(control.Manager.GetDistance(pm.Position, marker.Position)*1000, 1);
            }
            PS_gt gt2 = new PS_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);
                PS_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<PS_gt>(gt);
                }
                
                marker.Position = new PointLatLng((double)gt.gtLat, (double)gt.gtLon);
                OnMarkerChanged(marker as GMapMarkerVector);
            }
        }