Esempio n. 1
0
        public override bool Load()
        {
            bool        ret    = true;
            List <long> idlist = new List <long>();

            if (Common.Conn == null)
            {
                Common.Conn = new SQLiteConnection(Common.ConnectionString);
                Common.Conn.Open();
            }
            SQLiteDataReader myReader  = null;
            SQLiteCommand    myCommand = new SQLiteCommand();


            try
            {
                myReader = null;

                myCommand.CommandText = @"SELECT * FROM [tblRect]  WHERE [DisplayID]= " + m_DisplayID_tblDisplay.DisplayID + " order by oIndex;";

                myCommand.Connection = Common.Conn;
                myReader             = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    idlist.Add(myReader.GetInt64(myReader.GetOrdinal("ID")));
                }

                myReader.Close();
                myCommand.Dispose();


                foreach (long id in idlist)// (int i = 0; i < count ; i++)
                {
                    tblRect tblrect = new tblRect();
                    tblrect.ID = id;
                    tblrect.m_DisplayID_tblDisplay = this.m_DisplayID_tblDisplay;
                    tblrect.Select();

                    Add(tblrect);
                }
            }
            catch (SQLiteException ae)
            {
                System.Windows.Forms.MessageBox.Show(ae.Message);
                return(false);
            }



            return(ret);
        }
        public bool SaveDisplay()
        {
            bool   ret = true;
            string str = "";


            //m_tblLineCollection.Clear();
            //m_tblBitmapCollection.Clear();
            //m_tblRectCollection.Clear();
            //m_tblPolylineCollection.Clear();
            //m_tblADTextCollection.Clear();
            int i = 0;

            // this.Update();
            foreach (DrawObject o in Pages.GraphicPagesList[0].List)
            {
                i++;
                if (o.Dirty)
                {
                    str = o.GetType().ToString();
                    switch (str)
                    {
                    case "DCS.Draw.Curve":
                        o.Save(this.DisplayID, Pages.ActivePageNo);
                        break;

                    case "DCS.Draw.DrawEllipse":
                        o.Save(this.DisplayID, i);
                        break;

                    case "DCS.Draw.DrawImage":
                        o.Save(this.DisplayID, i);
                        break;

                    case "DCS.Draw.DrawLine":
                        o.Save(this.DisplayID, i);
                        break;

                    case "DCS.Draw.DrawPolyLine":
                        o.Save(this.DisplayID, i);
                        break;

                    case "DCS.Draw.DrawPolygon":
                        o.Save(this.DisplayID, i);
                        break;

                    case "DCS.Draw.DrawCurve":
                        o.Save(this.DisplayID, i);
                        break;

                    case "DCS.Draw.DrawRectangle":
                        o.Save(this.DisplayID, i);
                        break;

                    case "DCS.Draw.DrawText":
                        o.Save(this.DisplayID, i);
                        break;
                    }
                }
            }

            foreach (DeleteListStruc deleteliststruc in Pages.Parenttabgraphicpagecontrol.DeleteList)
            {
                if (deleteliststruc.ID != -1)
                {
                    switch ((STATIC_OBJ_TYPE)deleteliststruc.Type)
                    {
                    case STATIC_OBJ_TYPE.ID_BITMAP:
                        tblBitmap tblbitmap = new tblBitmap();
                        tblbitmap.ID = deleteliststruc.ID;
                        tblbitmap.Delete();
                        break;

                    case STATIC_OBJ_TYPE.ID_ANATEXT:
                    case STATIC_OBJ_TYPE.ID_TEXT:
                        tblADText tbladtext = new tblADText();
                        tbladtext.ID = deleteliststruc.ID;
                        tbladtext.Delete();
                        break;

                    case STATIC_OBJ_TYPE.ID_LINE:
                        tblLine tblline = new tblLine();
                        tblline.ID = deleteliststruc.ID;
                        tblline.Delete();
                        break;

                    case STATIC_OBJ_TYPE.ID_ELLIPS:
                    case STATIC_OBJ_TYPE.ID_ROUNDRECT:
                    case STATIC_OBJ_TYPE.ID_RECT:
                        tblRect tblRect = new tblRect();
                        tblRect.ID = deleteliststruc.ID;
                        tblRect.Delete();
                        break;

                    case STATIC_OBJ_TYPE.ID_POLYLINE:
                        tblPolyline tblpolyline = new tblPolyline();
                        tblpolyline.ID = deleteliststruc.ID;
                        tblpolyline.Delete();
                        break;

                    case STATIC_OBJ_TYPE.ID_POLYGON:
                        tblPolygon tblpolygon = new tblPolygon();
                        tblpolygon.ID = deleteliststruc.ID;
                        tblpolygon.Delete();
                        break;

                    case STATIC_OBJ_TYPE.ID_CURVE:
                        tblCurve tblcurve = new tblCurve();
                        tblcurve.ID = deleteliststruc.ID;
                        tblcurve.Delete();
                        break;
                    }
                }
            }
            Pages.Parenttabgraphicpagecontrol.DeleteList.Clear();

            return(ret);
        }
Esempio n. 3
0
 public bool Contains(tblRect item)
 {
     return(List.Contains(item));
 }
Esempio n. 4
0
 public int IndexOf(tblRect item)
 {
     return(List.IndexOf(item));
 }
Esempio n. 5
0
 public void Insert(int index, tblRect item)
 {
     List.Insert(index, item);
     this.OntblRectChanged(EventArgs.Empty);
 }
Esempio n. 6
0
 public void Remove(tblRect item)
 {
     List.Remove(item);
     this.OntblRectChanged(EventArgs.Empty);
 }
Esempio n. 7
0
 public void Add(tblRect item)
 {
     List.Add(item);
     this.OntblRectChanged(EventArgs.Empty);
 }