Beispiel #1
0
        public static void Main(string[] args)
        {
            Aparato    aparato = new Radio(1, "modelo", 10, "mf");
            Reparacion r1      = new Reparacion(aparato, 120);

            if (r1.tiempo <= 60)
            {
                //Console.WriteLine("hola");
                r1 = new Sustitucion(aparato, r1.tiempo);

                //Console.WriteLine("hola");
            }
            else
            {
                r1 = new Compleja(aparato, r1.tiempo);
            }
            Console.WriteLine(r1.ToString());
            //Console.WriteLine(sustitucion.ToString());



            //float a = r1.calcularPrecio(10, aparato);
            //Console.WriteLine(a);
        }
Beispiel #2
0
        void OnBtOperaClick()
        {
            /////////////////////////////////////////////////////
            //////////////////////////////////////////////////
            //////////////////////////////////////////////////
            int    op1;
            string strOp1      = this.View.EdOp1.Text;
            string aparato     = this.View.CbOperacion.Text;
            string nSerie      = this.View.var1valTexto.Text;
            string modelo      = this.View.var2valTexto.Text;
            string bandas      = this.View.bandas.Text;
            string pulgadas    = this.View.pulgadasTexto.Text;
            string blueRay     = this.View.bluerayBox.Text;
            string tiempoGraba = this.View.tiempoGrabaTexto.Text;
            bool   BRbool      = false;

            if (int.Parse(strOp1) <= 60)
            {
                Console.Write("Sustitucion");
                if (aparato.Equals("Televisor"))
                {
                    Console.Write("Tele");
                    Sustitucion Televisor = new Sustitucion(int.Parse(nSerie), modelo, 10, pulgadas, int.Parse(strOp1));
                    this.View.EdRes.Text = Televisor.Precio.ToString();
                    SaveReparacion("reparaciones.xml", new [] { Televisor });
                }
                else if (aparato.Equals("Radio"))
                {
                    Console.Write("Radio");
                    Sustitucion Radio = new Sustitucion(int.Parse(nSerie), modelo, 5, bandas, int.Parse(strOp1));
                    this.View.EdRes.Text = Radio.Precio.ToString();
                    SaveReparacion("reparaciones.xml", new [] { Radio });
                }
                else if (aparato.Equals("ReproductorDVD"))
                {
                    if (blueRay.Equals("si"))
                    {
                        BRbool = true;
                    }

                    if (int.Parse(tiempoGraba) > 0)
                    {
                        Sustitucion DVD = new Sustitucion(int.Parse(strOp1), int.Parse(nSerie), modelo, 10, BRbool, true, int.Parse(tiempoGraba));
                        this.View.EdRes.Text = DVD.Precio.ToString();
                        SaveReparacion("reparaciones.xml", new [] { DVD });
                    }
                    else
                    {
                        Sustitucion DVD = new Sustitucion(int.Parse(strOp1), int.Parse(nSerie), modelo, 10, BRbool, false);
                        this.View.EdRes.Text = DVD.Precio.ToString();
                        SaveReparacion("reparaciones.xml", new [] { DVD });
                    }
                }
                else if (aparato.Equals("AdaptadorTDT"))
                {
                    if (int.Parse(tiempoGraba) > 0)
                    {
                        Sustitucion TDT = new Sustitucion(int.Parse(strOp1), int.Parse(nSerie), modelo, 5, true, int.Parse(tiempoGraba));
                        this.View.EdRes.Text = TDT.Precio.ToString();
                        SaveReparacion("reparaciones.xml", new [] { TDT });
                    }
                    else
                    {
                        Sustitucion TDT = new Sustitucion(int.Parse(strOp1), int.Parse(nSerie), modelo, 5, false);
                        this.View.EdRes.Text = TDT.Precio.ToString();
                        SaveReparacion("reparaciones.xml", new [] { TDT });
                    }
                }
            }
            else
            {
                Console.Write("Compleja");
                if (aparato.Equals("Televisor"))
                {
                    Console.Write("Compleja televisor");
                    Compleja Televisor = new Compleja(int.Parse(nSerie), modelo, 10, pulgadas, int.Parse(strOp1));
                    this.View.EdRes.Text = Televisor.Precio.ToString();
                    SaveReparacion("reparaciones.xml", new [] { Televisor });
                }
                else if (aparato.Equals("Radio"))
                {
                    Compleja Radio = new Compleja(int.Parse(nSerie), modelo, 5, bandas, int.Parse(strOp1));
                    this.View.EdRes.Text = Radio.Precio.ToString();
                    SaveReparacion("reparaciones.xml", new [] { Radio });
                }
                else if (aparato.Equals("ReproductorDVD"))
                {
                    if (blueRay.Equals("si"))
                    {
                        BRbool = true;
                    }

                    if (int.Parse(tiempoGraba) > 0)
                    {
                        Compleja DVD = new Compleja(int.Parse(strOp1), int.Parse(nSerie), modelo, 10, BRbool, true, int.Parse(tiempoGraba));
                        this.View.EdRes.Text = DVD.Precio.ToString();
                        SaveReparacion("reparaciones.xml", new [] { DVD });
                    }
                    else
                    {
                        Compleja DVD = new Compleja(int.Parse(strOp1), int.Parse(nSerie), modelo, 10, BRbool, false);
                        this.View.EdRes.Text = DVD.Precio.ToString();
                        SaveReparacion("reparaciones.xml", new [] { DVD });
                    }
                }
                else if (aparato.Equals("AdaptadorTDT"))
                {
                    if (int.Parse(tiempoGraba) > 0)
                    {
                        Compleja TDT = new Compleja(int.Parse(strOp1), int.Parse(nSerie), modelo, 5, true, int.Parse(tiempoGraba));
                        this.View.EdRes.Text = TDT.Precio.ToString();
                        SaveReparacion("reparaciones.xml", new [] { TDT });
                    }
                    else
                    {
                        Compleja TDT = new Compleja(int.Parse(strOp1), int.Parse(nSerie), modelo, 5, false);
                        this.View.EdRes.Text = TDT.Precio.ToString();
                        SaveReparacion("reparaciones.xml", new [] { TDT });
                    }
                }
            }



            //Console.Write(op1);
        }