Exemple #1
0
 private void Update_Pipe_ToDB(object sender, RoutedEventArgs e)
 {
     try
     {
         for (int i = 0; i < pipelineAreaList.Count; i++)
         {
             if (i >= list_pipe.Count)
             {
                 continue;
             }
             YimaWF.data.Pipeline pl = new YimaWF.data.Pipeline();
             TextBox tb10            = FindName(PipelineDataGrid, 0, i, "id") as TextBox;
             TextBox tb11            = FindName(PipelineDataGrid, 1, i, "name") as TextBox;
             TextBox tb_width        = FindName(PipelineDataGrid, 2, i, "width") as TextBox;
             TextBox tb12            = FindName(PipelineDataGrid, 3, i, "level") as TextBox;
             TextBox tb13            = FindName(PipelineDataGrid, 4, i, "note") as TextBox;
             pl.ID = Convert.ToInt32(tb10.Text);
             if (pl.ID < 200 || pl.ID > 255)
             {
                 continue;
             }
             pl.Name       = tb11.Text;
             pl.AlarmLevel = Convert.ToInt32(tb12.Text);
             pl.Remark     = tb13.Text;
             pl.PointList  = list_pipe[i].PointList;
             pl.width      = Convert.ToInt32(tb_width.Text);
             (new dataAnadll.PipeLineProtectAreaManager()).UpdatePipeLineProtectArea(pl, GetgeoFactor());
         }
         Update_PolyAndPipe_FromDB();
     }
     catch (Exception ee)
     {
     }
 }
Exemple #2
0
        private void Delete_Click(object sender, RoutedEventArgs e)//行删除
        {
            try
            {
                Button b     = sender as Button;
                int    index = int.Parse(b.Tag.ToString());
                App    app   = (App)App.Current;

                if (!polygonBtn.IsEnabled)
                {
                    //MainWindow.data.removePolygonAeraByName(MainWindow.mycon, polygonAreaList[index].Name);//数据库删除多边形
                    YimaWF.data.ForbiddenZone fz = new YimaWF.data.ForbiddenZone();
                    fz.ID = Convert.ToInt32(polygonAreaList[index].ID);
                    (new dataAnadll.PolygonAreaManager()).DeletePolygonArea(fz);
                    int num = (int)double.Parse(polygonAreaList[index].ID) - 210;
                    MonitoringX.deleteForbiddenZone(polygonAreaList[index].Name, num);//显控同步+海图删除
                    polygonAreaList[index].ID          = null;
                    polygonAreaList[index].Name        = null;
                    polygonAreaList[index].Level       = null;
                    polygonAreaList[index].Description = null;
                    polygonAreaList[index].ReadOnly    = true;
                    polyID[index] = 0;
                }
                else
                {
                    //MainWindow.data.removeProtectAeraByName(MainWindow.mycon, pipelineAreaList[index].Name);//数据库删除管道
                    YimaWF.data.Pipeline pl = new YimaWF.data.Pipeline();
                    pl.ID = Convert.ToInt32(pipelineAreaList[index].ID);
                    (new dataAnadll.PipeLineProtectAreaManager()).DeletePipeLineProtectArea(pl);
                    int num = (int)double.Parse(pipelineAreaList[index].ID) - 220;
                    MonitoringX.deletePipeline(pipelineAreaList[index].Name, num);//显控同步+海图删除
                    pipelineAreaList[index].ID          = null;
                    pipelineAreaList[index].Name        = null;
                    pipelineAreaList[index].Width       = null;
                    pipelineAreaList[index].Level       = null;
                    pipelineAreaList[index].Description = null;
                    pipelineAreaList[index].ReadOnly    = true;
                    pipeID[index] = 0;
                }
                Update_PolyAndPipe_FromDB();

                if (!polygonBtn.IsEnabled)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        ToggleButton tb = FindName("tb" + i.ToString()) as ToggleButton;
                        Button       bt = FindName("b" + i.ToString()) as Button;
                        if (String.IsNullOrWhiteSpace(polygonAreaList[i].ID))
                        {
                            tb.IsChecked = false;
                            tb.IsEnabled = false;
                            bt.IsEnabled = false;
                        }
                        else
                        {
                            tb.IsChecked = false;
                            tb.IsEnabled = true;
                            bt.IsEnabled = true;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < 5; i++)
                    {
                        ToggleButton tb = FindName("tb" + i.ToString()) as ToggleButton;
                        Button       bt = FindName("b" + i.ToString()) as Button;
                        if (String.IsNullOrWhiteSpace(pipelineAreaList[i].ID))
                        {
                            tb.IsChecked = false;
                            tb.IsEnabled = false;
                            bt.IsEnabled = false;
                        }
                        else
                        {
                            tb.IsChecked = false;
                            tb.IsEnabled = true;
                            bt.IsEnabled = true;
                        }
                    }
                }
            }
            catch (Exception ee)
            {
            }
        }