Example #1
0
        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);
            }
        }
Example #2
0
 public itemobj(sd_gt gt) {
     Gt = gt;
 }
Example #3
0
 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);
     }
 }
Example #4
0
        internal static double CountLineLen(sd_xl xl) {
            double dLen0 = 0;//总长度,包括下级线路
            double dLen1 = 0;//当前线路长度
            IList<sd_gt> gtList = Client.ClientHelper.PlatformSqlMap.GetList<sd_gt>("where linecode='" + xl.LineCode + "' order by gtcode");
            sd_gt gt0 = new sd_gt();
            List<object> updateList = new List<object>();
            for (int i = 0; i < gtList.Count; i++) {
                sd_gt gt = gtList[i];
                double d1 = 0;
                if (gt.gtLat == 0 || gt.gtLon == 0) d1 = -1;
                if (gt0.gtLat == 0 || gt0.gtLon == 0) {
                    gt0 = gt; d1 = -1;
                }
                if (d1 == 0) {
                    d1 = GetDistance(new PointLatLng(gt.gtLat, gt.gtLon), new PointLatLng(gt0.gtLat, gt0.gtLon));
                    gt.gtSpan = (decimal)Math.Round(d1, 1);
                    if (gt.gtSpan > 9999) {
                        string err = string.Format("数据异常,计算终止。异常杆塔号{0}-{1},所在线路{2}", gt0.gth, gt.gth, xl.LineName);
                        throw new Exception(err);
                    }
                } else {
                    gt.gtSpan = 0;
                    d1 = 0;
                }
                //gt.
                updateList.Add(gt);
                dLen1 += d1;
                gt0 = gt;
            }
            xl.WireLength = (int)(dLen1);//

            Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(null, updateList, null);
            updateList.Clear();
            IList<sd_xl> xlList = Client.ClientHelper.PlatformSqlMap.GetList<sd_xl>("where parentid='" + xl.LineID + "' and linevol='" + xl.LineVol + "'");
            foreach (sd_xl xl0 in xlList) {
                double d0 = CountLineLen(xl0);
                dLen0 += d0;
                if (xl0.TotalLength == (int)d0) continue;
                xl0.TotalLength = (int)d0;
                updateList.Add(xl0);
            }
            Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(null, updateList, null);
            dLen0 += dLen1;
            return dLen0;
        }
Example #5
0
        /// <summary>
        /// 新建对象设置Key值
        /// </summary>
        /// <param name="newobj"></param>
        void gridViewOperation_CreatingObjectEvent(sd_gt newobj)
        {
            if (parentID == null) return;
            newobj.LineCode = parentID;

            if (gtInsert) {
                gtInsert = false;
                newobj.gth = getInsertGh();
            } else {
                newobj.gth = getGgh();
            }
            
            newobj.gtCode = ParentObj.LineCode + newobj.gth;
            newobj.gtID = newobj.gtCode;
            newobj.c1 = newobj.gth;
            newobj.gtID += mRandom.Next(10, 99);
            newobj.gtSpan = 50;
            newobj.gtMs = 1.7m;
            newobj.gtHeight = 10m;
            newobj.gtModle = "直线杆";
            newobj.gtType = "水泥杆";
            newobj.gtJg = "否";
        }