Example #1
0
        public void DesligaPonto(Ponto ponto)
        {
            ponto.X_ = 0;
            ponto.Y_ = 0;

            SqlCeCommand sql =
                new SqlCeCommand("update pontos set cx = " + ponto.X + ", cy = " + ponto.Y + ", " +
                                 "cx_ = " + ponto.X_ + ", cy_ = " + ponto.Y_ + " where id = " + Usuario.idPonto +
                                 " and cx <> 0", Conn.sqlConn);
            sql.ExecuteNonQuery();
            this.GetPontos().AcceptChanges();
        }
        private void atualizaPontosList()
        {
            PontosList.Clear();
            data.RefreshPontos();
            foreach (DataRow row in data.GetPontos().Rows)
            {
                string ativacao = (string)row["ativacao"];
                string lat = (string)row["lat"];
                string lon = (string)row["lon"];
                int idT = (int)row["id"];
                string cidade = (string)row["cidade_fk"];
                string chave = (string)row["chave_fk"];
                string bairro = (string)row["bairro"];
                string rua = (string)row["rua"];
                string casa = (string)row["casa"];
                string lum = (string)row["luminaria"];
                string util = (string)row["utilizadores"];
                string reat = (string)row["reat_id"];
                string braco = (string)row["braco"];
                string medidor = (string)row["medidor"];
                DateTime dataT = (DateTime)row["data_reg"];
                int seq = (int)row["sequencia"];
                string barr = (string)row["barramento"];
                string medido = (string)row["medido"];
                string aceso = (string)row["aceso"];
                string fase = (string)row["fase"];
                int mult = (int)row["multiplicador"];
                int cxT = (int)row["cx"];
                int cyT = (int)row["cy"];
                int cx_T = (int)row["cx_"];
                int cy_T = (int)row["cy_"];
                string obs = (string)row["observacao"];
                string lamp = (string)row["lamp_id"];
                string lig = (string)row["ligacao"];
                string cadastrador = (string)row["cadastrador"];
                string gpggastr = row["gpgga"].ToString();
                string esforco = row["esforco_poste"].ToString();
                string material = row["material_poste"].ToString();
                string estrutura = row["estrutura"].ToString();
                string altura = row["altura_poste"].ToString();
                string condicao_risco = row["condicao_risco"].ToString();
                string ligacao_clandestina = row["ligacao_clandestina"].ToString();

                //light
                string suporte = row["suporte"].ToString();
                string gerencia = row["gerencia"].ToString();
                string nProjeto = row["n_projeto"].ToString();
                string officio = row["officio_inter"].ToString();
                string finalidade = row["finalidade"].ToString();
                string classePi = row["classe_pi"].ToString();
                string respRede = row["resp_rede"].ToString();
                string tipoRede = row["tipo_rede"].ToString();
                string quadricula = row["quadricula"].ToString();
                string idLight = row["id_light"].ToString();
                string idRioluz = row["id_rioluz"].ToString();
                string alimentacao = row["alimentacao"].ToString();

                Ponto ponto = new Ponto(idT, cidade, chave, bairro, rua, casa, lum,
                    util, reat, braco, medidor, dataT, seq, barr, medido, aceso, mult,
                    cxT, cyT, cx_T, cy_T, obs, lamp, lig, lat, lon, "", cadastrador,
                    gpggastr, condicao_risco, ligacao_clandestina, esforco, material,
                    altura, fase, ativacao, estrutura, suporte, gerencia, nProjeto, officio,
                    finalidade, classePi, respRede, tipoRede, quadricula, idLight, idRioluz,
                    alimentacao);

                string key = Convert.ToString(row["sequencia"]);

                if (util.Length > 0)
                {
                    try
                    {
                        PontosList.Add(key, ponto);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        //notification1.Text = ex.Message;
                        //notification1.Visible = true;
                    }
                }
            }
        }
Example #3
0
        private void destructionLine(Ponto ponto)
        {
            System.Drawing.Graphics g =
                Graphics.FromImage(objDrawingBackGround);

                //Ponto pontoTemp = (Ponto)PontosList[ponto];

                g.DrawLine(new Pen(Color.White, penWidthLine), ponto.X + spaceX, ponto.Y + spaceY,
                    ponto.X_ + spaceX, ponto.Y_ + spaceY);
        }
Example #4
0
        //private void atualizaPontosList()
        //{
        //    PontosList.Clear();
        //    data.RefreshPontos();
        //    foreach (DataRow row in data.GetPontos().Rows)
        //    {
        //        string lat = (string)row["lat"];
        //        string lon = (string)row["lon"];
        //        int idT = (int)row["id"];
        //        string cidade = (string)row["cidade_fk"];
        //        string chave = (string)row["chave_fk"];
        //        string bairro = (string)row["bairro"];
        //        string rua = (string)row["rua"];
        //        string casa = (string)row["casa"];
        //        string lum = (string)row["luminaria"];
        //        string util = (string)row["utilizadores"];
        //        string reat = (string)row["reat_id"];
        //        string braco = (string)row["braco"];
        //        string medidor = (string)row["medidor"];
        //        DateTime dataT = (DateTime)row["data_reg"];
        //        int seq = (int)row["sequencia"];
        //        string barr = (string)row["barramento"];
        //        string medido = (string)row["medido"];
        //        string aceso = (string)row["aceso"];
        //        int mult = (int)row["multiplicador"];
        //        int cxT = (int)row["cx"];
        //        int cyT = (int)row["cy"];
        //        int cx_T = (int)row["cx_"];
        //        int cy_T = (int)row["cy_"];
        //        string obs = (string)row["observacao"];
        //        string lamp = (string)row["lamp_id"];
        //        string lig = (string)row["ligacao"];
        //        Ponto ponto = new Ponto(idT, cidade, chave, bairro, rua, casa, lum,
        //            util, reat, braco, medidor, dataT, seq, barr, medido, aceso, mult,
        //            cxT, cyT, cx_T, cy_T, obs, lamp, lig, lat, lon);
        //        string key = Convert.ToString(row["sequencia"]);
        //        try
        //        {
        //            PontosList.Add(key, ponto);
        //        }
        //        catch (Exception ex)
        //        {
        //            MessageBox.Show(ex.Message);
        //            //notification1.Text = ex.Message;
        //            //notification1.Visible = true;
        //        }
        //    }
        //}
        private void desenhaPontos()
        {
            ultimaSequencia = 0;
            foreach (Ponto p in PontosList.Values)
            {

                if (p.Utilizadores.Length > 0)
                {
                    if (ultimaSequencia < p.Seq)
                    {
                        ultimaSequencia = p.Seq;
                        ultimoPonto = p;
                    }

                    if (!editando)
                    {
                        cx = p.X;
                        cy = p.Y;
                        int cx_local = p.X_;
                        int cy_local = p.Y_;

                        buildPonto(p);

                        //Color cor;
                        if ((cx_local != 0) && (cy_local != 0))
                        {
                            if (p.Ligacao == "CO")
                                buildlines(cx, cy, cx_local, cy_local, dashedGreenPen);
                            else
                                buildlines(cx, cy, cx_local, cy_local, solidBluePen);
                        }
                    }
                }
                Application.DoEvents();
            }
            cx = ultimoPonto.X;
            cy = ultimoPonto.Y;
        }
Example #5
0
        private void buildPonto(Ponto ponto)
        {
            PictureBox p = new PictureBox();
            p.Location = new Point(ponto.X, ponto.Y);
            p.Size = new Size(17, 17);
            p.SizeMode = PictureBoxSizeMode.CenterImage;
            p.Name = Convert.ToString(ponto.Id);
            p.Parent = this;

            string seq = Convert.ToString(ponto.Seq);
            if (seq.Length < 2)
            {
                seq = "0" + seq;
            }

            Image img = null;
            //if (ponto.Auditagem == "N" && !(TemAditagem(ponto.Seq)))
            if (ponto.TemDerivacao)
            {
                if (ponto.Obs.Length > 0)
                {
                    img = new Bitmap(Library.appDir + "\\imagens\\poste_der_obs.png");
                }
                else
                {
                    img = new Bitmap(Library.appDir + "\\imagens\\poste_derivacao.png");
                }
            }
            else
            {
                if (ponto.Obs.Length > 0)
                {
                    img = new Bitmap(Library.appDir + "\\imagens\\poste_obs.png");
                }
                else
                {
                    img = new Bitmap(Library.appDir + "\\imagens\\poste.png");
                }
            }
            //else
            //    img = new Bitmap(appDir + "\\imagens\\poste_audit.jpg");
            //Bitmap bmp = new Bitmap(appDir + "\\imagens\\poste.jpg");
            Graphics g = Graphics.FromImage(img);
            g.DrawString(seq, new Font("Tahoma", 5.5f, FontStyle.Bold),
                new System.Drawing.SolidBrush(Color.Black), 4, 4);
            //Graphics g = Graphics.FromImage(img);
            //g.DrawString(seq,
            //            new Font("Tahoma", 12f, FontStyle.Regular),
            //            new SolidBrush(Color.Black),
            //            new Rectangle(12, 0, 20, 20));
            p.Image = img;
            p.MouseDown +=
                new System.Windows.Forms.MouseEventHandler(this.infoMenuPicture);
            //p.MouseMove +=
            //    new System.Windows.Forms.MouseEventHandler(this.menuMovePonto);
            //p.MouseUp +=
            //    new System.Windows.Forms.MouseEventHandler(this.soltaArrasto);

            Invalidate();
        }
Example #6
0
 //private void showLigarPontoPanel()
 //{
 //    //ligarPontoPanel.Parent = this;
 //    //ligarPontoPanel.Location = panelPoint();
 //    Cursor.Current = Cursors.WaitCursor;
 //    Application.DoEvents();
 //    this.menuItem1.Enabled = false;
 //    CircuitoLigarPonto clp = new CircuitoLigarPonto(this.PontosList);
 //    clp.ShowDialog();
 //    //ligarPontoPanel.Visible = true;
 //    //ligarPontoPanel.BringToFront();
 //}
 private String buildLinkInformation(Ponto p1)
 {
     foreach (Ponto p2 in PontosList.Values)
     {
         if (p1.X_ == p2.X && p1.Y_ == p2.Y)
             return p1.Seq + " ao " + p2.Seq;
     }
     return null;
 }
Example #7
0
 private bool isUnLinkedPoint(Ponto ponto)
 {
     foreach (Ponto p in PontosList.Values)
     {
         if (/*ponto.Auditagem.Equals("N") && */((p.X_ == ponto.X && p.Y_ == ponto.Y) || (ponto.X_ != 0 && ponto.Y_ != 0)) && (p.Seq != ponto.Seq))
         {
             return false;
         }
     }
     return true;
 }
Example #8
0
 private bool isAlonePoint(Ponto ponto)
 {
     if (ponto.X_ != 0)
         return false;
     else
         return true;
 }