Example #1
0
        public static Rhomb SetRhomb(out string name, out string type, out double a, out double h,
                                     out double area, out double perim, out int tops, out int edges)
        {
            Console.Write("Set Name of Rhomb: ");
            name = Console.ReadLine();

            Console.Write("Set Type of Rhomb: ");
            type = Console.ReadLine();

            Console.Write("Enter a side of Rhomb:\n");
            Console.Write("a: ");
            a = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
            Console.Write("Enter h:\n");
            Console.Write("h: ");
            h = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            Rhomb rhomb = new Rhomb(a, h);

            rhomb.A    = a;
            rhomb.H    = h;
            rhomb.Name = name;
            rhomb.Type = type;
            area       = rhomb.Area();
            perim      = rhomb.Perimeter();
            tops       = rhomb.QuantityOfTops();
            edges      = rhomb.QuantityOfEdges();

            return(rhomb);
        }
Example #2
0
        public override void Prepare()
        {
            TArrowLine Line, Lnb;
            Point P1 = new Point(), P2 = new Point(), VP = new Point();
            int tmp_x;
            TTfeRectShape Rct;
            TTfeRhombShape Rhomb;

            Rct = (TTfeRectShape)(GetWorkShape(0));
            Rhomb = (TTfeRhombShape)(GetWorkShape(1));
            Rct.GetTailPoint(0, ref P1);
            Rhomb.GetTailPoint(0, ref P2);
            VP.X = P1.X - 4 * F_Step;
            VP.Y = P2.Y;

            //1
            Line = (TArrowLine)(GetWorkLine(0));
            Line.xStart = StartPoint.X;
            Line.yStart = StartPoint.Y;
            Line.xEnd = VP.X;
            Line.yEnd = VP.Y;
            Line.Bend = CalcBend(Line.xStart, Line.xEnd);
            Lnb = Line;

            //2
            Line = (TArrowLine)(GetWorkLine(1));
            Line.xStart = Lnb.xEnd;
            Line.yStart = Lnb.yEnd;
            Line.xEnd = P1.X;
            Line.yEnd = P1.Y;
            Line.Bend = 2;

            Rct.GetTailPoint(1, ref P1);
            Rhomb.GetTailPoint(1, ref P2);
            //3
            Line = (TArrowLine)(GetWorkLine(2));
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd = P2.X;
            Line.yEnd = P2.Y;
            Line.Bend = 1;

            Rhomb.GetTailPoint(0, ref P1);
            //4
            Line = (TArrowLine)(GetWorkLine(3));
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd = Lnb.xEnd;
            Line.yEnd = Lnb.yEnd;

            //5
            Rhomb.GetTailPoint(2, ref P1);
            Line = (TArrowLine)(GetWorkLine(4));
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd = P1.X + 2 * F_Step;
            Line.yEnd = P1.Y;

            base.Prepare();
        }
Example #3
0
    static void Main(string[] args)
    {
        Triangle triangle1 = new Triangle(1, 1, 3, 2, 2, 4);

        triangle1.Area();
        triangle1.TypeOfTriangle();
        Parallelogram par1 = new Parallelogram(-1, 1, -3, 2, -2, 4, -4, 5);

        par1.Perimeter();
        par1.Heigth();
        Rhomb rhomb = new Rhomb(2, 2, 4, 3, 3, 4, 5, 5);

        rhomb.Area();
        rhomb.Heigth();
        rhomb.InRadius();
        Console.ReadKey();
    }
Example #4
0
    static void Main(string[] args)
    {
        Triangle       triangle1 = new Triangle(1, 1, 3, 2, 2, 4);
        Parallelogram  par1      = new Parallelogram(-1, 1, -3, 2, -2, 4, -4, 5);
        Rhomb          rhomb     = new Rhomb(2, 2, 4, 3, 3, 4, 5, 5);
        List <Polygon> col       = new List <Polygon>();

        col.Add(triangle1);
        col.Add(par1);
        col.Add(rhomb);
        col.Sort();
        Console.WriteLine("Объекты отсортированы по возрастанию поля Ax");
        foreach (Polygon o in col)
        {
            Console.WriteLine(o + " " + o.Ax);
        }
        Console.ReadKey();
    }
Example #5
0
        public static void DrawRhomb(Rhomb figure, PaintEventArgs e)
        {
            Graphics l = e.Graphics;

            using (GraphicsPath myPath = new GraphicsPath())
            {
                myPath.AddLines(new[]
                {
                    new Point((int)figure.X, (int)figure.Y + ((int)figure.Height / 2)),
                    new Point((int)figure.X + ((int)figure.Width / 2), (int)figure.Y),
                    new Point((int)figure.X + (int)figure.Width, (int)figure.Y + ((int)figure.Height / 2)),
                    new Point((int)figure.X + ((int)figure.Width / 2), (int)figure.Y + (int)figure.Height),
                    new Point((int)figure.X, (int)figure.Y + ((int)figure.Height / 2))
                });
                using (Pen pen = new Pen(Color.Black, 4))
                    l.DrawPath(pen, myPath);
            }
        }
        public static List <Rhomb> ReadAllRhombs(string connectionString)
        {
            List <Rhomb> rhm = new List <Rhomb>();

            try
            {
                using (conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    using (cmd = new SqlCommand("select * from Rhombs", conn))
                    {
                        dReader = cmd.ExecuteReader();

                        while (dReader.Read())
                        {
                            Rhomb rhomb = new Rhomb();
                            rhomb.Id    = int.Parse(dReader["Id"].ToString());
                            rhomb.Name  = dReader["Name"].ToString();
                            rhomb.Type  = dReader["Type"].ToString();
                            rhomb.A     = double.Parse(dReader["A"].ToString());
                            rhomb.H     = double.Parse(dReader["H"].ToString());
                            rhomb.Areaa = double.Parse(dReader["Area"].ToString());
                            rhomb.Perim = double.Parse(dReader["Perimeter"].ToString());
                            rhomb.Tops  = int.Parse(dReader["Tops"].ToString());
                            rhomb.Edges = int.Parse(dReader["Edges"].ToString());

                            rhm.Add(rhomb);
                        }
                    }
                }
            }
            catch { }
            finally
            {
                dReader.Close();
                conn.Close();
            }
            return(rhm);
        }
Example #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("Write down 2 sides and angle for figures splitting them with spaces:");
            var line = Console.ReadLine();
            var vals = line.Split(' ');

            if (vals.Length != 3)
            {
                Console.WriteLine("Wrong count of arguments.");
                Console.ReadKey();
                return;
            }

            double side1   = double.Parse(vals[0]),
                   side2   = double.Parse(vals[1]),
                   angle   = double.Parse(vals[2]);
            double minSide = side1 <side2?side1 : side2,
                                    maxSide = side1> side2 ? side1 : side2;
            Figure fig;

            Console.WriteLine("Creating Parallelogram:");
            fig = new Parallelogram(minSide, maxSide, angle);
            Console.WriteLine($"Area = {fig.Area():F3}\tPerimeter = {fig.Perimeter():F3}\n");

            Console.WriteLine("Creating Rectangle:");
            fig = new Rectangle(minSide, maxSide);
            Console.WriteLine($"Area = {fig.Area():F3}\tPerimeter = {fig.Perimeter():F3}\n");

            Console.WriteLine("Creating Square:");
            fig = new Square(maxSide);
            Console.WriteLine($"Area = {fig.Area():F3}\tPerimeter = {fig.Perimeter():F3}\n");

            Console.WriteLine("Creating Rhomb:");
            fig = new Rhomb(maxSide, angle);
            Console.WriteLine($"Area = {fig.Area():F3}\tPerimeter = {fig.Perimeter():F3}\n");

            Console.ReadKey();
        }
Example #8
0
        static void Main(string[] args)
        {
            Triangles triangle1 = new Triangles("Triangle1", 5, 6);

            triangle1.Display();

            IShape triangle2 = new CornersTriangle("Triange2", 7, 8.7, 45);

            triangle2.Display();


            CornersTriangle triangle3 = (CornersTriangle)triangle2;

            triangle3.Name   = "Triangle3";
            triangle3.Corner = 63;
            triangle3.Display();

            HeronaTriangle htr = new HeronaTriangle("Triangle4", 8, 9, 4);

            htr.Display();

            Circle circle = new Circle("Circle", 6);

            circle.Display();

            Rhomb rm = new Rhomb("Rhomb", 23, 34);

            rm.Display();

            IShape rm2 = new Rhomb {
                Name = "Rhomb1", FirstSide = 12, SecondSide = 12
            };


            Console.Read();
        }
Example #9
0
        void CreateLines()
        {
            TArrowLine     Line, Lnb, Lnb3;
            Point          P1 = new Point(), P2 = new Point();
            int            tmp_x;
            TTfeRectShape  Rct;
            TTfeRhombShape Rhomb;

            FreeWorkLines();
            F_LastLineId = F_NumberLineId;

            Rhomb = (TTfeRhombShape)(GetWorkShape(0));
            Rct   = (TTfeRectShape)(GetWorkShape(1));
            Rhomb.GetTailPoint(0, ref P1);
            F_LastLineId++;
            //1
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = StartPoint.X;
            Line.yStart = StartPoint.Y;
            Line.xEnd   = P1.X;
            Line.yEnd   = P1.Y;
            Line.Bend   = CalcBend(Line.xStart, Line.xEnd);
            AddLine(Line);
            Lnb = Line;

            Rhomb.GetTailPoint(1, ref P1);
            Rct.GetTailPoint(0, ref P2);

            F_LastLineId++;
            //2
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd   = P2.X;
            Line.yEnd   = P2.Y;
            AddLine(Line);


            Rct.GetTailPoint(1, ref P1);
            F_LastLineId++;
            //3
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd   = P1.X + 4 * F_Step;
            Line.yEnd   = Lnb.yEnd;
            Line.Bend   = CalcBend(Line.xStart, Line.xEnd);
            AddLine(Line);
            Lnb3 = Line;

            Rhomb.GetTailPoint(2, ref P1);
            F_LastLineId++;
            //4
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd   = Lnb3.xEnd;
            Line.yEnd   = Lnb3.yEnd;
            Line.Bend   = CalcBend(Line.xStart, Line.xEnd);
            AddLine(Line);


            //5
            F_LastLineId++;
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = Lnb3.xEnd;
            Line.yStart = Lnb3.yEnd;
            Line.xEnd   = Lnb3.xEnd + 2 * F_Step;
            Line.yEnd   = Lnb3.yEnd;
            AddLine(Line);
        }
Example #10
0
        private void createCurrentShape()
        {
            switch (drawing)
            {
            case CurrentDrawing.Ellipse:
                Ellipse ellipse = new Ellipse();
                ellipse.setFillColor(this.currentFillColor);
                ellipse.setBorderColor(this.currentBorderColor);
                this.shape = ellipse;
                break;

            case CurrentDrawing.Circle:
                Circle circle = new Circle();
                circle.setFillColor(this.currentFillColor);
                circle.setBorderColor(this.currentBorderColor);
                this.shape = circle;
                break;

            case CurrentDrawing.Line:
                Shape line = new Line();
                line.setBorderColor(this.currentBorderColor);
                this.shape = line;
                break;

            case CurrentDrawing.Ray:
                Shape ray = new Ray();
                ray.setBorderColor(this.currentBorderColor);
                this.shape = ray;
                break;

            case CurrentDrawing.LineSegment:
                Shape lineSegment = new LineSegment();
                lineSegment.setBorderColor(this.currentBorderColor);
                this.shape = lineSegment;
                break;

            case CurrentDrawing.Poligon:
                Poligon poligon = new Poligon();
                poligon.setFillColor(this.currentFillColor);
                poligon.setBorderColor(this.currentBorderColor);
                this.shape = poligon;
                break;

            case CurrentDrawing.RegularPolygon:
                RegularPolygon regularPoligon = new RegularPolygon((int)this.numericUpDown1.Value);
                regularPoligon.setFillColor(this.currentFillColor);
                regularPoligon.setBorderColor(this.currentBorderColor);
                this.shape = regularPoligon;
                break;

            case CurrentDrawing.RightTriangle:
                RightTriangle rightTriangle = new RightTriangle();
                rightTriangle.setFillColor(this.currentFillColor);
                rightTriangle.setBorderColor(this.currentBorderColor);
                this.shape = rightTriangle;
                break;

            case CurrentDrawing.IsoscelesTriangle:
                IsoscelesTriangle isoscelesTriangle = new IsoscelesTriangle();
                isoscelesTriangle.setFillColor(this.currentFillColor);
                isoscelesTriangle.setBorderColor(this.currentBorderColor);
                this.shape = isoscelesTriangle;
                break;

            case CurrentDrawing.Parallelogram:
                Parallelogram parallelogram = new Parallelogram();
                parallelogram.setFillColor(this.currentFillColor);
                parallelogram.setBorderColor(this.currentBorderColor);
                this.shape = parallelogram;
                break;

            case CurrentDrawing.Rectangle:
                Rectangle rectangle = new Rectangle();
                rectangle.setFillColor(this.currentFillColor);
                rectangle.setBorderColor(this.currentBorderColor);
                this.shape = rectangle;
                break;

            case CurrentDrawing.Rhomb:
                Rhomb rhomb = new Rhomb();
                rhomb.setFillColor(this.currentFillColor);
                rhomb.setBorderColor(this.currentBorderColor);
                this.shape = rhomb;
                break;
            }
        }
 public void Visit(Rhomb figure)
 {
     FigureDrawer.DrawRhomb(figure, Event);
 }
Example #12
0
        override public void Prepare()
        {
            TArrowLine     Line, Lnb;
            Point          P1 = new Point(), P2 = new Point();
            int            tmp_x;
            TTfeRectShape  Rct;
            TTfeRhombShape Rhomb;

            Rhomb = (TTfeRhombShape)(GetWorkShape(0));
            Rct   = (TTfeRectShape)(GetWorkShape(1));
            Rhomb.GetTailPoint(0, ref P1);
            //1
            Line        = (TArrowLine)(GetWorkLine(0));
            Line.xStart = StartPoint.X;
            Line.yStart = StartPoint.Y;
            Line.xEnd   = P1.X;
            Line.yEnd   = P1.Y;
            Line.Bend   = CalcBend(Line.xStart, Line.xEnd);
            Lnb         = Line;

            Rhomb.GetTailPoint(1, ref P1);
            Rct.GetTailPoint(0, ref P2);

            //2
            Line        = (TArrowLine)(GetWorkLine(1));
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd   = P2.X;
            Line.yEnd   = P2.Y;
            //Line.Bend = CalcBend(Line.xStart, Line.xEnd);

            Rct.GetTailPoint(1, ref P1);
            Rct = (TTfeRectShape)(GetWorkShape(2));
            Rct.GetTailPoint(1, ref P2);

            tmp_x = P1.X;
            if (tmp_x < P2.X)
            {
                tmp_x = P2.X;
            }
            tmp_x = tmp_x + 3 * F_Step;

            //3
            Line        = (TArrowLine)(GetWorkLine(2));
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd   = tmp_x;
            Line.yEnd   = Lnb.yEnd;
            Line.Bend   = CalcBend(Line.xStart, Line.xEnd);


            //4
            Line        = (TArrowLine)(GetWorkLine(3));
            Line.xStart = P2.X;
            Line.yStart = P2.Y;
            Line.xEnd   = tmp_x;
            Line.yEnd   = Lnb.yEnd;
            Line.Bend   = CalcBend(Line.xStart, Line.xEnd);

            Rct = (TTfeRectShape)(GetWorkShape(2));
            Rhomb.GetTailPoint(3, ref P1);
            Rct.GetTailPoint(0, ref P2);
            //5
            Line        = (TArrowLine)(GetWorkLine(4));
            Line.xStart = P2.X;
            Line.yStart = P2.Y;
            Line.xEnd   = P1.X;
            Line.yEnd   = P1.Y;

            //6
            Lnb = (TArrowLine)(GetWorkLine(2));

            Line            = (TArrowLine)(GetWorkLine(5));
            Line.PointStart = Lnb.PointEnd;
            Line.xEnd       = Lnb.PointEnd.X + 2 * F_Step;
            Line.yEnd       = Lnb.PointEnd.Y;
            base.Prepare();
        }
Example #13
0
        void CreateLines()
        {
            TArrowLine     Line, Lnb;
            Point          P1 = new Point(), P2 = new Point();
            int            tmp_x;
            TTfeRectShape  Rct;
            TTfeRhombShape Rhomb;

            FreeWorkLines();
            F_LastLineId = F_NumberLineId;

            Rhomb = (TTfeRhombShape)(GetWorkShape(0));
            Rct   = (TTfeRectShape)(GetWorkShape(1));
            Rhomb.GetTailPoint(0, ref P1);
            F_LastLineId++;
            //1
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = StartPoint.X;
            Line.yStart = StartPoint.Y;
            Line.xEnd   = P1.X;
            Line.yEnd   = P1.Y;
            Line.Bend   = CalcBend(Line.xStart, Line.xEnd);
            AddLine(Line);
            Lnb = Line;

            Rhomb.GetTailPoint(1, ref P1);
            Rct.GetTailPoint(0, ref P2);

            F_LastLineId++;
            //2
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd   = P2.X;
            Line.yEnd   = P2.Y;
            AddLine(Line);

            Rct.GetTailPoint(1, ref P1);
            Rct = (TTfeRectShape)(GetWorkShape(2));
            Rct.GetTailPoint(1, ref P2);

            tmp_x = P1.X;
            if (tmp_x < P2.X)
            {
                tmp_x = P2.X;
            }
            tmp_x = tmp_x + 3 * F_Step;

            F_LastLineId++;
            //3
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = P1.X;
            Line.yStart = P1.Y;
            Line.xEnd   = tmp_x;
            Line.yEnd   = Lnb.yEnd;
            AddLine(Line);

            F_LastLineId++;
            //4
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = P2.X;
            Line.yStart = P2.Y;
            Line.xEnd   = tmp_x;
            Line.yEnd   = Lnb.yEnd;
            AddLine(Line);

            Rhomb.GetTailPoint(3, ref P1);
            Rct.GetTailPoint(0, ref P2);
            F_LastLineId++;
            //5
            Line        = new TArrowLine(F_Step, F_LastLineId);
            Line.xStart = P2.X;
            Line.yStart = P2.Y;
            Line.xEnd   = P1.X;
            Line.yEnd   = P1.Y;
            AddLine(Line);

            F_LastLineId++;
            //6
            Lnb             = (TArrowLine)(GetWorkLine(2));
            Line            = new TArrowLine(F_Step, F_LastLineId);
            Line.PointStart = Lnb.PointEnd;
            Line.xEnd       = Lnb.PointEnd.X + 2 * F_Step;
            Line.yEnd       = Lnb.PointEnd.Y;
            AddLine(Line);
        }
Example #14
0
        private void rhomb_Click(object sender, EventArgs e)
        {
            Figure figure = new Rhomb(10, 180, 50, 50);

            DrawFigure(GenerateMove(figure));
        }
Example #15
0
        public static void SelectFigure(DataBase db, int figure)
        {
            switch (figure)
            {
            case 1:
                string name, type;
                double a, area, perim;
                int    tops, edges;

                Console.Clear();
                Console.WriteLine("1 - Add new square in the table:");
                Console.WriteLine("2 - Show all squares from the table");
                Console.WriteLine("3 - Edit square by Id");
                Console.WriteLine("4 - Delete square by Id");
                Console.WriteLine("5 - Return back");
                Console.Write("\nPlease make your choice..");
                int choice1 = int.Parse(Console.ReadLine());
                switch (choice1)
                {
                case 1:
                    Console.Clear();
                    Square sq = SetSquare(out name, out type, out a, out area, out perim, out tops, out edges);
                    try
                    {
                        result = db.Add($"Insert into Squares([Name],[Type],[A],[Area],[Perimeter],[Tops],[Edges])" +
                                        $"values('{name}','{type}','{a}','{area}','{perim}','{tops}','{edges}')");

                        Console.ForegroundColor = (result == "Insert was Successfull!Congratulations!!!") ? ConsoleColor.Green : ConsoleColor.Red;
                        Console.WriteLine(result);
                        Console.ResetColor();
                        Pause();
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 2:
                    Console.Clear();
                    string        conn = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
                    List <Square> list = ReadFiguresFromDB.ReadAllSquares(conn);
                    for (int i = 0; i < list.Count; i++)
                    {
                        Console.WriteLine(new string('-', 120));
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine($"\n{i + 1} Square:\n");
                        Console.ForegroundColor = RandColors()[rand.Next(0, 5)];
                        Console.WriteLine(list[i]);
                        Console.ResetColor();
                        Console.WriteLine("\n" + new string('-', 120));
                    }
                    Pause();
                    break;

                case 3:
                    Console.Write("Enter any id of square to Update: ");
                    int editId = int.Parse(Console.ReadLine());

                    Square editSq = SetSquare(out name, out type, out a, out area, out perim, out tops, out edges);

                    string editQuery = $"Update Squares SET Name='{name}',Type='{type}',A='{a}', Area='{area}', Perimeter='{perim}' where Id={editId}";
                    try
                    {
                        resultInt = db.Update(editQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nSquare has updated successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Update() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 4:
                    Console.Write("Enter any id of square to Delete from the table: ");
                    int    deleteId = int.Parse(Console.ReadLine());
                    string delQuery = $"Delete from Squares where Id={deleteId}";
                    try
                    {
                        resultInt = db.Delete(delQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nSquare has deleted successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Delete() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 5: break;
                }
                break;

            case 2:
                Console.Clear();
                Console.WriteLine("1 - Add new parallelogram into the table:");
                Console.WriteLine("2 - Show all parallelograms from the table");
                Console.WriteLine("3 - Edit parallelogram by Id");
                Console.WriteLine("4 - Delete parallelogram by Id");
                Console.WriteLine("5 - Return back");
                Console.Write("\nPlease make your choice..");
                choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    Console.Clear();
                    Parallelogram pr = SetParallelogram(out name, out type, out a, out b, out h, out area, out perim, out tops, out edges);
                    try
                    {
                        result = db.Add($"Insert into Parallelograms([Name], [Type], [A], [B], [H], [Area], [Perimeter], [Tops], [Edges]) " +
                                        $"values('{name}', '{type}', '{a}', '{b}', '{h}', '{area}', '{perim}', '{tops}', '{edges}')");

                        Console.WriteLine("Insert was Successful!Congratulations!!!");
                        Console.WriteLine(result);
                        Console.ResetColor();
                        Pause();
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 2:
                    Console.Clear();
                    string conn = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
                    List <Parallelogram> list = ReadFiguresFromDB.ReadAllParallelograms(conn);
                    for (int i = 0; i < list.Count; i++)
                    {
                        Console.WriteLine(new string('-', 120));
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine($"\n{i + 1} Parallelogram:\n");
                        Console.ForegroundColor = RandColors()[rand.Next(0, 5)];
                        Console.WriteLine(list[i]);
                        Console.ResetColor();
                        Console.WriteLine("\n" + new string('-', 120));
                    }
                    Pause();
                    break;

                case 3:
                    Console.Write("Enter any id of parallelogram to Update: ");
                    int editId = int.Parse(Console.ReadLine());

                    Parallelogram editPar   = SetParallelogram(out name, out type, out a, out b, out h, out area, out perim, out tops, out edges);
                    string        editQuery = $"Update Parallelograms SET Name='{name}',Type='{type}', A='{a}', B='{b}', H='{h}', Area='{area}', Perimeter='{perim}' where Id={editId}";
                    try
                    {
                        resultInt = db.Update(editQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }

                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nParallelogram has updated successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Update() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 4:
                    Console.Write("Enter any id of parallelogram to Delete from the table: ");
                    int    deleteId = int.Parse(Console.ReadLine());
                    string delQuery = $"Delete from Parallelograms where Id={deleteId}";
                    try
                    {
                        resultInt = db.Delete(delQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nParallelogram has deleted successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Delete() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;
                }
                break;

            case 3:
                Console.Clear();
                Console.WriteLine("1 - Add new rectangle into the table:");
                Console.WriteLine("2 - Show all rectangles from the table");
                Console.WriteLine("3 - Edit rectangle by Id");
                Console.WriteLine("4 - Delete rectangle by Id");
                Console.WriteLine("5 - Return back");
                Console.Write("\nPlease make your choice..");
                choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    Console.Clear();
                    Rectangle rct = SetRectangle(out name, out type, out a, out b, out area, out perim, out tops, out edges);
                    try
                    {
                        result = db.Add($"Insert into Rectangles([Name],[Type],[A],[B],[Area],[Perimeter],[Tops],[Edges])" +
                                        $"values('{name}','{type}','{a}','{b}','{area}','{perim}','{tops}','{edges}')");

                        Console.ForegroundColor = (result == "Insert was Successful!Congratulations!!!") ? ConsoleColor.Green : ConsoleColor.Red;
                        Console.WriteLine(result);
                        Console.ResetColor();
                        Pause();
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 2:
                    Console.Clear();
                    string           conn = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
                    List <Rectangle> list = ReadFiguresFromDB.ReadAllRectangles(conn);
                    for (int i = 0; i < list.Count; i++)
                    {
                        Console.WriteLine(new string('-', 120));
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine($"\n{i + 1} Rectangle:\n");
                        Console.ForegroundColor = RandColors()[rand.Next(0, 5)];
                        Console.WriteLine(list[i]);
                        Console.ResetColor();
                        Console.WriteLine("\n" + new string('-', 120));
                    }
                    Pause();
                    break;

                case 3:
                    Console.Write("Enter any id of rectangle to Update: ");
                    int editId = int.Parse(Console.ReadLine());

                    Rectangle editRct   = SetRectangle(out name, out type, out a, out b, out area, out perim, out tops, out edges);
                    string    editQuery = $"Update Rectangles SET Name='{name}',Type='{type}',A='{a}', B='{b}',Area='{area}', Perimeter='{perim}' where Id={editId}";
                    try
                    {
                        resultInt = db.Update(editQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nRectangles has updated successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Update() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 4:
                    Console.Write("Enter any id of rectangle to Delete from the table: ");
                    int    deleteId = int.Parse(Console.ReadLine());
                    string delQuery = $"Delete from Rectangles where Id={deleteId}";
                    try
                    {
                        resultInt = db.Delete(delQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nRectangle has deleted successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Delete() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;
                }
                break;

            case 4:
                Console.Clear();
                Console.WriteLine("1 - Add new rhomb into the table:");
                Console.WriteLine("2 - Show all rhombs from the table");
                Console.WriteLine("3 - Edit rhomb by Id");
                Console.WriteLine("4 - Delete rhomb by Id");
                Console.WriteLine("5 - Return back");
                Console.Write("\nPlease make your choice..");
                choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    Console.Clear();
                    Rhomb rhmb = SetRhomb(out name, out type, out a, out h, out area, out perim, out tops, out edges);
                    try
                    {
                        result = db.Add($"Insert into Rhombs([Name],[Type],[A],[H],[Area],[Perimeter],[Tops],[Edges])" +
                                        $"values('{name}','{type}','{a}','{h}','{area}','{perim}','{tops}','{edges}')");

                        Console.ForegroundColor = (result == "Insert was Successful!Congratulations!!!") ? ConsoleColor.Green : ConsoleColor.Red;
                        Console.WriteLine(result);
                        Console.ResetColor();
                        Pause();
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 2:
                    Console.Clear();
                    List <Rhomb> list = ReadFiguresFromDB.ReadAllRhombs(AllFigures_Storage.connect);
                    for (int i = 0; i < list.Count; i++)
                    {
                        Console.WriteLine(new string('-', 120));
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine($"\n{i + 1} Rhomb:\n");
                        Console.ForegroundColor = RandColors()[rand.Next(0, 5)];
                        Console.WriteLine(list[i]);
                        Console.ResetColor();
                        Console.WriteLine("\n" + new string('-', 120));
                    }
                    Pause();
                    break;

                case 3:
                    Console.Write("Enter any id of rhomb to Update: ");
                    int editId = int.Parse(Console.ReadLine());

                    Rhomb  editRhmb  = SetRhomb(out name, out type, out a, out h, out area, out perim, out tops, out edges);
                    string editQuery = $"Update Rhombs SET Name='{name}',Type='{type}',A='{a}', H='{h}',Area='{area}', Perimeter='{perim}' where Id={editId}";
                    try
                    {
                        resultInt = db.Update(editQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nRhombs has updated successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Update() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 4:
                    Console.Write("Enter any id of rhomb to Delete from the table: ");
                    int    deleteId = int.Parse(Console.ReadLine());
                    string delQuery = $"Delete from Rhombs where Id={deleteId}";
                    try
                    {
                        resultInt = db.Delete(delQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nRhomb has deleted successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Delete() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;
                }
                break;

            case 5:
                Console.Clear();
                Console.WriteLine("1 - Add new trapeze into the table:");
                Console.WriteLine("2 - Show all trapezes from the table");
                Console.WriteLine("3 - Edit trapeze by Id");
                Console.WriteLine("4 - Delete trapeze by Id");
                Console.WriteLine("5 - Return back");
                Console.Write("\nPlease make your choice..");
                choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    Console.Clear();
                    Trapeze trpz = SetTrapeze(out name, out type, out a, out b, out c, out d, out h, out area, out perim, out tops, out edges);
                    try
                    {
                        result = db.Add($"Insert into Trapezes([Name],[Type],[A],[B],[C],[D],[H],[Area],[Perimeter],[Tops],[Edges])" +
                                        $"values('{name}','{type}','{a}','{b}','{c}','{d}','{h}','{area}','{perim}','{tops}','{edges}')");

                        Console.ForegroundColor = (result == "Insert was Successful!Congratulations!!!") ? ConsoleColor.Green : ConsoleColor.Red;
                        Console.WriteLine(result);
                        Console.ResetColor();
                        Pause();
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 2:
                    Console.Clear();
                    string         conn = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
                    List <Trapeze> list = ReadFiguresFromDB.ReadAllTrapezes(conn);
                    for (int i = 0; i < list.Count; i++)
                    {
                        Console.WriteLine(new string('-', 120));
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine($"\n{i + 1} Trapeze:\n");
                        Console.ForegroundColor = RandColors()[rand.Next(0, 5)];
                        Console.WriteLine(list[i]);
                        Console.ResetColor();
                        Console.WriteLine("\n" + new string('-', 120));
                    }
                    Pause();
                    break;

                case 3:
                    Console.Write("Enter any id of trapeze to Update: ");
                    int editId = int.Parse(Console.ReadLine());

                    Trapeze editTrpz  = SetTrapeze(out name, out type, out a, out b, out c, out d, out h, out area, out perim, out tops, out edges);
                    string  editQuery = $"Update Trapezes SET Name='{name}',Type='{type}',A='{a}', B='{b}', C='{c}', D='{d}', H='{h}', Area='{area}', Perimeter='{perim}' where Id={editId}";
                    try
                    {
                        resultInt = db.Update(editQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nTrapezes has updated successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Update() return {resultInt}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;

                case 4:
                    Console.Write("Enter any id of trapeze to Delete from the table: ");
                    int    deleteId = int.Parse(Console.ReadLine());
                    string delQuery = $"Delete from Trapezes where Id={deleteId}";
                    try
                    {
                        resultInt = db.Delete(delQuery);
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ResetColor();
                        Pause();
                    }
                    if (resultInt == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\nTrapeze has deleted successfully!!!");
                        Console.ResetColor();
                        Pause();
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"\nThe method of Delete() return {result}\nSomething went wrong...Try to fix this!");
                        Console.ResetColor();
                        Pause();
                    }
                    break;
                }
                break;
            }
        }