Ejemplo n.º 1
0
 private void wbMap_MapDirectionEvent(object sender, HtmlElementEventArgs e)
 {
     try
     {
         string str = this.wbMap.getSketchPoints().ToString().Trim(new char[] { ';' });
         if (!string.IsNullOrEmpty(str))
         {
             string[] strArray = str.Split(new char[] { ';' });
             if ((strArray.Length >= 2) && ((strArray.Length != 2) || (strArray[0] != strArray[1])))
             {
                 if (!this.isUpdate)
                 {
                     MapPath path = new MapPath(this.preType)
                     {
                         PathDot = str
                     };
                     this.cachSegment["路段"] = str;
                     path.IsMapDirection    = true;
                     path.PathSegment       = this.cachSegment;
                     path.ReMark            = "";
                     if (path.ShowDialog() == DialogResult.OK)
                     {
                         this.addCachSegmentToDt(path.PathId);
                         if (this.pnlRegion.Visible)
                         {
                             DataTable dataSource = (DataTable)this.cmbPath.DataSource;
                             DataRow   row        = dataSource.NewRow();
                             row["PathId"]          = path.PathId;
                             row["PathName"]        = path.PathName;
                             row["AlarmPathDot"]    = path.PathDot;
                             row["Remark"]          = path.ReMark;
                             row["region_radius"]   = path.Radius;
                             row["factoryName"]     = path.BeginName;
                             row["buildingSitName"] = path.EndName;
                             row["pathGroupID"]     = path.Group;
                             row["pathType"]        = path.PathType;
                             dataSource.Rows.Add(row);
                             this.cmbPath.SelectedIndex = dataSource.DefaultView.Find(path.PathName);
                         }
                     }
                     else
                     {
                         this.cmbPath_SelectedIndexChanged(sender, e);
                     }
                     this.clearCachSegment();
                 }
                 else
                 {
                     this.modifyPath((DataRowView)this.cmbPath.SelectedItem, str, true, true);
                 }
             }
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 2
0
        private void modifyPath(DataRowView selectItemDataRowView, string pathdot, bool isNewPathDot, bool isMapDirection)
        {
            MapPath path = new MapPath(this.preType)
            {
                IsMapDirection   = isMapDirection,
                IsUpdate         = true,
                PathLonLatChange = isNewPathDot,
                PathId           = selectItemDataRowView["Pathid"].ToString(),
                PathName         = selectItemDataRowView["PathName"].ToString(),
                PathDot          = pathdot,
                PathSegment      = this.cachSegment,
                ReMark           = this.remark,
                BeginName        = selectItemDataRowView["factoryName"].ToString(),
                EndName          = selectItemDataRowView["buildingSitName"].ToString(),
                Group            = selectItemDataRowView["pathGroupID"].ToString(),
                PathType         = selectItemDataRowView["pathType"].ToString(),
                Radius           = selectItemDataRowView["region_radius"].ToString().Equals("") ? 300M : Convert.ToDecimal(selectItemDataRowView["region_radius"])
            };

            if (path.ShowDialog() == DialogResult.OK)
            {
                if (isNewPathDot)
                {
                    this.addCachSegmentToDt(path.PathId);
                }
                if (this.pnlRegion.Visible)
                {
                    DataRow row = selectItemDataRowView.Row;
                    row["PathName"]        = path.PathName;
                    row["AlarmPathDot"]    = path.PathDot;
                    row["Remark"]          = path.ReMark;
                    row["region_radius"]   = path.Radius;
                    row["factoryName"]     = path.BeginName;
                    row["buildingSitName"] = path.EndName;
                    row["pathGroupID"]     = path.Group;
                    row["pathType"]        = path.PathType;
                }
            }
            this.clearCachSegment();
            this.cmbPath_SelectedIndexChanged(null, null);
            this.wbMap.setPanTool();
            this.setUpdateUIState(false);
        }
Ejemplo n.º 3
0
        private void execRefRegion(string sPoints)
        {
            MapPath path = new MapPath(this.preType)
            {
                PathDot = sPoints
            };

            if (this.isModify)
            {
                path.PathId   = (this.cmbRegion.SelectedItem as DataRowView)["RegionId"].ToString();
                path.PathName = (this.cmbRegion.SelectedItem as DataRowView)["RegionName"].ToString();
                path.Group    = (this.cmbRegion.SelectedItem as DataRowView)["pathGroupID"].ToString();
                path.IsUpdate = true;
            }
            if ((path.ShowDialog() == DialogResult.OK) && this.pnlRegion.Visible)
            {
                DataTable dataSource = (DataTable)this.cmbRegion.DataSource;
                if (this.isModify)
                {
                    DataRow row = dataSource.Rows.Find(path.PathId);
                    if (row != null)
                    {
                        row["RegionDot"]   = path.PathDot;
                        row["RegionName"]  = path.PathName;
                        row["pathGroupID"] = path.Group;
                    }
                    this.btnModifyRegion_Click(null, null);
                }
                else
                {
                    DataRow row2 = dataSource.NewRow();
                    row2["regionID"]    = path.PathId;
                    row2["regionName"]  = path.PathName;
                    row2["regionDot"]   = path.PathDot;
                    row2["pathGroupID"] = path.Group;
                    dataSource.Rows.Add(row2);
                    this.cmbRegion.SelectedIndex = this.cmbRegion.Items.Count - 1;
                }
            }
        }
Ejemplo n.º 4
0
 private void execRefRegion(string sPoints)
 {
     MapPath path = new MapPath(this.preType) {
         PathDot = sPoints
     };
     if (this.isModify)
     {
         path.PathId = (this.cmbRegion.SelectedItem as DataRowView)["RegionId"].ToString();
         path.PathName = (this.cmbRegion.SelectedItem as DataRowView)["RegionName"].ToString();
         path.Group = (this.cmbRegion.SelectedItem as DataRowView)["pathGroupID"].ToString();
         path.IsUpdate = true;
     }
     if ((path.ShowDialog() == DialogResult.OK) && this.pnlRegion.Visible)
     {
         DataTable dataSource = (DataTable) this.cmbRegion.DataSource;
         if (this.isModify)
         {
             DataRow row = dataSource.Rows.Find(path.PathId);
             if (row != null)
             {
                 row["RegionDot"] = path.PathDot;
                 row["RegionName"] = path.PathName;
                 row["pathGroupID"] = path.Group;
             }
             this.btnModifyRegion_Click(null, null);
         }
         else
         {
             DataRow row2 = dataSource.NewRow();
             row2["regionID"] = path.PathId;
             row2["regionName"] = path.PathName;
             row2["regionDot"] = path.PathDot;
             row2["pathGroupID"] = path.Group;
             dataSource.Rows.Add(row2);
             this.cmbRegion.SelectedIndex = this.cmbRegion.Items.Count - 1;
         }
     }
 }
Ejemplo n.º 5
0
 private void wbMap_MapDirectionEvent(object sender, HtmlElementEventArgs e)
 {
     try
     {
         string str = this.wbMap.getSketchPoints().ToString().Trim(new char[] { ';' });
         if (!string.IsNullOrEmpty(str))
         {
             string[] strArray = str.Split(new char[] { ';' });
             if ((strArray.Length >= 2) && ((strArray.Length != 2) || (strArray[0] != strArray[1])))
             {
                 if (!this.isUpdate)
                 {
                     MapPath path = new MapPath(this.preType) {
                         PathDot = str
                     };
                     this.cachSegment["路段"] = str;
                     path.IsMapDirection = true;
                     path.PathSegment = this.cachSegment;
                     path.ReMark = "";
                     if (path.ShowDialog() == DialogResult.OK)
                     {
                         this.addCachSegmentToDt(path.PathId);
                         if (this.pnlRegion.Visible)
                         {
                             DataTable dataSource = (DataTable) this.cmbPath.DataSource;
                             DataRow row = dataSource.NewRow();
                             row["PathId"] = path.PathId;
                             row["PathName"] = path.PathName;
                             row["AlarmPathDot"] = path.PathDot;
                             row["Remark"] = path.ReMark;
                             row["region_radius"] = path.Radius;
                             row["factoryName"] = path.BeginName;
                             row["buildingSitName"] = path.EndName;
                             row["pathGroupID"] = path.Group;
                             row["pathType"] = path.PathType;
                             dataSource.Rows.Add(row);
                             this.cmbPath.SelectedIndex = dataSource.DefaultView.Find(path.PathName);
                         }
                     }
                     else
                     {
                         this.cmbPath_SelectedIndexChanged(sender, e);
                     }
                     this.clearCachSegment();
                 }
                 else
                 {
                     this.modifyPath((DataRowView) this.cmbPath.SelectedItem, str, true, true);
                 }
             }
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 6
0
 private void modifyPath(DataRowView selectItemDataRowView, string pathdot, bool isNewPathDot, bool isMapDirection)
 {
     MapPath path = new MapPath(this.preType) {
         IsMapDirection = isMapDirection,
         IsUpdate = true,
         PathLonLatChange = isNewPathDot,
         PathId = selectItemDataRowView["Pathid"].ToString(),
         PathName = selectItemDataRowView["PathName"].ToString(),
         PathDot = pathdot,
         PathSegment = this.cachSegment,
         ReMark = this.remark,
         BeginName = selectItemDataRowView["factoryName"].ToString(),
         EndName = selectItemDataRowView["buildingSitName"].ToString(),
         Group = selectItemDataRowView["pathGroupID"].ToString(),
         PathType = selectItemDataRowView["pathType"].ToString(),
         Radius = selectItemDataRowView["region_radius"].ToString().Equals("") ? 300M : Convert.ToDecimal(selectItemDataRowView["region_radius"])
     };
     if (path.ShowDialog() == DialogResult.OK)
     {
         if (isNewPathDot)
         {
             this.addCachSegmentToDt(path.PathId);
         }
         if (this.pnlRegion.Visible)
         {
             DataRow row = selectItemDataRowView.Row;
             row["PathName"] = path.PathName;
             row["AlarmPathDot"] = path.PathDot;
             row["Remark"] = path.ReMark;
             row["region_radius"] = path.Radius;
             row["factoryName"] = path.BeginName;
             row["buildingSitName"] = path.EndName;
             row["pathGroupID"] = path.Group;
             row["pathType"] = path.PathType;
         }
     }
     this.clearCachSegment();
     this.cmbPath_SelectedIndexChanged(null, null);
     this.wbMap.setPanTool();
     this.setUpdateUIState(false);
 }