Exemplo n.º 1
0
        private void Test2()
        {

            var repository = factory.GetRepository<Repository<ScreenResolution>>();

            var screen = repository.GetById(new Guid("63263AD5-2331-E411-A8FF-D6C8174F0792"), false);

            factory.OnTransaction(() =>
            {
                for (int c = 0; c < 3; c++)
                {
                    var screentype = new ScreenType();
                    screentype.Name = "ScreenDivision" + c;
                    screen.AddScreenType(screentype);
                }

            });
        }
Exemplo n.º 2
0
 public virtual void AddScreenType(ScreenType screenType) {
     this.ScreenType = screenType;
      
 }
Exemplo n.º 3
0
        private void CreateData()
        {
            var repository = factory.GetRepository<Repository<ScreenResolution>>();
            var query = repository.GetQueryable();


            // var result = query.Where(x => x.Orientation.Id == new Guid("7AEB6CA3-2331-E411-A8FF-D6C8174F0792")).ToList();
            var result = query.OrderBy(x => x.Orientation).ToList();
            result.ForEach(o =>
            {

                double width = o.Width;
                double height = o.Height;


                for (int c = 1; c <= 10; c++)
                {

                    factory.OnTransaction(() =>
                                  {

                                      var screentype = new ScreenType();

                                      if (o.Orientation.Id == new Guid("7AEB6CA3-2331-E411-A8FF-D6C8174F0792"))
                                          screentype.Name = "ScreenTypeH" + (c);

                                      else if (o.Orientation.Id == new Guid("7BEB6CA3-2331-E411-A8FF-D6C8174F0792"))
                                          screentype.Name = "ScreenTypeV" + (c);

                                      o.AddScreenType(screentype);

                                  });

                }



                var repScreenType = factory.GetRepository<Repository<ScreenType>>();
                var qScreenType = repScreenType.GetQueryable();
                var rScreenType = qScreenType.Where(x => x.ScreenResolution.Id == o.Id).ToList();

                int loop = 0;


                rScreenType.ForEach(o2 =>
                {

                    string type = o2.Name.Length < 13 ? o2.Name.Substring(11, 1) : o2.Name.Substring(11, 2);
                    //string orientation = o2.Name.Substring(10, 1);

                    List<double> list = null;

                    if (type == "2" || type == "3")
                        loop = 2;

                    else if (type == "4" || type == "5" || type == "10")
                        loop = 4;

                    else if (type == "6" || type == "7" || type == "8" || type == "9")
                        loop = 3;

                    else
                        loop = 1;


                    #region HORIZONTAL
                    if (o2.Name.Contains("H"))
                    {
                        for (int i = 0; i < loop; i++)
                        {

                            factory.OnTransaction(() =>
                            {
                                ScreenDivision sd = new ScreenDivision();
                                sd.Name = "ScreenDivision" + i;
                                sd.ScreenType = o2;
                                list = ScreenDivisionH(width, height, i, o2.Name);
                                if (list != null)
                                {
                                    sd.X = Convert.ToInt32(list[0]);
                                    sd.Y = Convert.ToInt32(list[1]);
                                    sd.Width = Convert.ToInt32(list[2]);
                                    sd.Height = Convert.ToInt32(list[3]);
                                }

                                o2.ScreenDivisions.Add(sd);
                            });

                        }
                    }
                    #endregion HORIZONTAL

                    #region VERTICAL
                    if (o2.Name.Contains("V"))
                    {
                        for (int i = 0; i < loop; i++)
                        {

                            factory.OnTransaction(() =>
                            {
                                ScreenDivision sd = new ScreenDivision();
                                sd.Name = "ScreenDivision" + i;
                                sd.ScreenType = o2;
                                list = ScreenDivisionV(width, height, i, o2.Name);
                                if (list != null)
                                {
                                    sd.X = Convert.ToInt32(list[0]);
                                    sd.Y = Convert.ToInt32(list[1]);
                                    sd.Width = Convert.ToInt32(list[2]);
                                    sd.Height = Convert.ToInt32(list[3]);
                                }

                                o2.ScreenDivisions.Add(sd);
                            });

                        }
                    }
                    #endregion VERTICAL


                });

            });




        }
Exemplo n.º 4
0
 public virtual void AddScreenType(ScreenType screentype)
 {
     this.ScreenTypes.Add(screentype);
     screentype.ScreenResolution = this;
      
 }