Ejemplo n.º 1
0
        public bool AssignRegistrationDates()
        {
            var facade = new SystemFactory().System;

            var(_, token) = facade.LogIn(new Dictionary <string, string>
            {
                ["login"]    = "******",
                ["password"] = "******",
            });

            facade.AssignRegistrationDate(new Dictionary <string, string>
            {
                ["dateStart"] = DateStart,
                ["dateEnd"]   = DateEnd,
            }, token);

            facade.LogOut(token);
            int counter = 0;

            DateTime.TryParse(DateStart, out DateTime dateStart);
            DateTime.TryParse(DateEnd, out DateTime dateEnd);
            var studentDatas = new RepositoryFactory().GetRepository <StudentData>().GetOverview();

            foreach (var student in studentDatas)
            {
                var registrationDate = student.RegistrationDate;
                if (dateStart <= registrationDate && registrationDate <= dateEnd)
                {
                    counter++;
                }
            }

            return(counter == studentDatas.ToList().Count);
        }
Ejemplo n.º 2
0
        protected Agent(SystemType systemType, IEnumerable <string> agentComments, string revision = "")
        {
            AgentCommentsList = agentComments.ToList();
            var systemFactory = new SystemFactory();

            SystemDescription = systemFactory.CreateSystem(systemType, revision);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Loading...");

            SystemFactory systemFactory = new SystemFactory(true);

            StellarSystem stellarSystem = systemFactory.GetStellarSystem();

            foreach (APhysicalObject star in stellarSystem.Bodies)
            {
                Console.WriteLine(star);
            }

            /*
             * TimeSpan timeOffset = new TimeSpan(365, 0, 0, 0, 0);
             * //Printer<Orbit>.PrintHeader("orbitRecord.csv", stellarSystem.Orbits[0]);
             *
             * List<Orbit> orbitalStates = new List<Orbit>();
             *
             * int max = 3000;
             * for (int i = 0; i < max; i++)
             * {
             *  stellarSystem.Orbits[0].UpdateTime(timeOffset);
             *  orbitalStates.Add((Orbit)stellarSystem.Orbits[0].Clone());
             *  Console.WriteLine($"{i}/{max}");
             * }
             * Printer<Orbit>.PrintTable("orbitRecord.csv", orbitalStates);
             * Console.WriteLine($"{stellarSystem.Orbits[0].OrbitalPeriod / (24 * 60 * 60 * 365)} years");
             */
            Console.WriteLine("Finished...");

            Console.ReadLine();
        }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_SystemFactory = new SystemFactory();
        m_AuthFactory   = new AuthFactory();
        m_LogService    = m_SystemFactory.GetLogService();
        m_AuthSevice    = m_AuthFactory.GetAuthService();

        if (!Page.IsPostBack)
        {
            InitData();
            fillGridView();
        }
    }
Ejemplo n.º 5
0
        public bool LoginUser()
        {
            var system = new SystemFactory().System;

            var(passed, ms) = system.LogIn(new Dictionary <string, string>
            {
                ["login"]    = Login,
                ["password"] = Password,
            });

            lastMessage = ms;
            return(passed);
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            //створення об'єків систем
            SystemFactory factory = new SystemFactory();

            ISystem system2 = factory.CreateLinearSystem2();
            ISystem system3 = factory.CreateLinearSystem3();

            Console.WriteLine("\nSystem 1 (2 rows 2 vars): ");
            system2.Show();    //вивід через перевантажений метод
            Console.WriteLine("\nSystem 1 (3 rows 3 vars): ");
            system3.Show();    //вивід системи в консоль


            Console.WriteLine("Enter x1 x2");
            var x = Console.ReadLine()
                    .Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(f => double.Parse(f)).ToArray();

            Console.WriteLine("X is " + (
                                  // notify wrapper   -> comparison  -  system   -> method
                                  new ComparableNotifier(new Comparable(system2)).IsEqualTo(x)
                ? "the root" : "not root") + " of equatation");

            Console.WriteLine("Enter x1 x2 x3");
            x = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(f => double.Parse(f)).ToArray();
            Console.WriteLine("X is " + (new Comparable(system3).IsEqualTo(x) ? "the root" : "not root") + " of equatation");

            system2 = new LSystem2();

            //ввід вручну
            //для правильної системи
            // 5*1+5+1=10
            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    Console.Write("Enter line[" + (i + 1) + "] coef[" + (j + 1) + "]: ");
                    system2.SetCoef(i, j, double.Parse(Console.ReadLine()));
                }
                Console.Write("Enter line[" + (i + 1) + "] -> B: ");
                system2.SetB(i, double.Parse(Console.ReadLine()));
            }

            Console.WriteLine("Enter x1 x2");
            x = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(f => double.Parse(f)).ToArray();
            Console.WriteLine("X is " + (new Comparable(system2).IsEqualTo(x) ? "the root" : "not root") + " of equatation");

            Console.ReadLine();
        }
Ejemplo n.º 7
0
    /// <summary>
    /// 取的分類中的代碼
    /// </summary>
    /// <param name="classify">分類名稱</param>
    /// <param name="isDefalut">是否要預設加入一筆未選</param>
    /// <returns></returns>
    public static IList <ListItem> GetSystemItemList(string classify, bool isDefalut)
    {
        SystemFactory  systemFactory = new SystemFactory();
        ISystemService sysemSerivce  = systemFactory.GetSystemService();

        IList <ListItem> result = SystemItemToListItem(sysemSerivce.GetAllItemParamByNoDel(classify));

        if (isDefalut)
        {
            result.Insert(0, new ListItem("未選", ""));
        }

        return(result);
    }
        static void Main(string[] args)
        {
            Console.WriteLine("---- Xml Interface ----");
            ISystem xmlSystem = SystemFactory.GetSystemXML();

            Execute(xmlSystem, "xml_input.txt");
            Console.WriteLine();

            Console.WriteLine("---- KeyValue Interface ----");
            Console.WriteLine("---- Xml Interface ----");
            ISystem keyValueSystem = SystemFactory.GetSystemKeyValue();

            Execute(keyValueSystem, "key_value_input.txt");
            Console.WriteLine();
        }
Ejemplo n.º 9
0
 public void TestCaseInit()
 {
     m_AuthFactory        = new AuthFactory();
     m_PostFactory        = new PostFactory();
     m_SystemFactory      = new SystemFactory();
     m_StorageFactory     = new StorageFactory();
     m_MemberFactory      = new MemberFactory();
     m_AccountingFactory  = new AccountingFactory();
     m_AuthService        = m_AuthFactory.GetAuthService();
     m_PostService        = m_PostFactory.GetPostService();
     m_TemplateService    = m_SystemFactory.GetTemplateService();
     m_SystemService      = m_SystemFactory.GetSystemService();
     m_MessageService     = m_PostFactory.GetMessageService();
     m_StorageFileService = m_StorageFactory.GetStorageFileService();
     m_MemberService      = m_MemberFactory.GetMemberService();
     m_AccountingService  = m_AccountingFactory.GetAccountingService();
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Tries to add the block, but skips the CanAddBlock test.
        /// </summary>
        private bool AddBlock(BlockPosition position, BlockInfo info, byte rotation)
        {
            if (info is SingleBlockInfo single)
            {
                _blocks.Add(position, BlockFactory.MakeSinglePlaced(transform, single, rotation, position));
            }
            else
            {
                PlacedMultiBlockParent parent = BlockFactory.MakeMultiPlaced(transform, (MultiBlockInfo)info,
                                                                             rotation, position, out PlacedMultiBlockPart[] parts);
                if (parent == null)
                {
                    return(false);
                }

                _blocks.Add(position, parent);
                foreach (PlacedMultiBlockPart part in parts)
                {
                    _blocks.Add(part.Position, part);
                }
            }

            RealBlockCount++;
            if (info.Type == BlockType.Mainframe)
            {
                _mainframePosition = position;
            }
            else if (SystemFactory.IsAnySystem(info.Type))
            {
                if (SystemFactory.IsActiveSystem(info.Type))
                {
                    _activeSystemPresent = true;
                }
                else
                {
                    WeaponSystem.Type weaponType = SystemFactory.GetWeaponType(info.Type);
                    if (weaponType != WeaponSystem.Type.None)
                    {
                        _weaponType = weaponType;                         //may or may not be first time set
                        _weaponCount++;
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 11
0
        public bool EditCourseGroup()
        {
            var system = new SystemFactory().System;

            var(passed, err) = system.EditCoursesGroup(new Dictionary <string, string>
            {
                ["id"]       = Id,
                ["ects"]     = Ects,
                ["semester"] = Semester,
                ["fieldId"]  = FieldId,
                ["code"]     = Code,
                ["name"]     = Name,
            }, token);

            LastMessage = err;

            return(passed);
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            List <Component> components = new List <Component>();

            while (input != "System Split")
            {
                try
                {
                    Component component = SystemFactory.CreateSystem(input);
                    components.Add(component);
                }
                catch (Exception)
                {
                }

                if (input == "Analyze()")
                {
                    Analyze analyze = new Analyze();
                    foreach (var component in components)
                    {
                        if (component.Type == "Power" || component.Type == "Heavy")
                        {
                            analyze.hardware.Add((Hardware)component);
                        }

                        if (component.Type == "Express" || component.Type == "Light")
                        {
                            analyze.software.Add((Software)component);
                        }
                    }

                    Console.WriteLine(analyze);
                }

                input = Console.ReadLine();
            }

            if (input == "System Split")
            {
                Console.WriteLine(components.Count);
            }
        }
Ejemplo n.º 13
0
        private void RemoveBlock(IPlacedBlock block)
        {
            RealBlockCount--;
            if (block.Position.Equals(_mainframePosition))
            {
                _mainframePosition = null;
            }
            else if (SystemFactory.IsActiveSystem(block.Type))
            {
                _activeSystemPresent = false;
            }
            else if (SystemFactory.GetWeaponType(block.Type) != WeaponSystem.Type.None)
            {
                if (--_weaponCount == 0)
                {
                    _weaponType = WeaponSystem.Type.None;
                }
            }

            PlacedSingleBlock single = block as PlacedSingleBlock;

            if (single != null)
            {
                Destroy(single.gameObject);
                _blocks.Remove(single.Position);
                return;
            }

            PlacedMultiBlockParent parent = block as PlacedMultiBlockParent;

            if (parent == null)
            {
                parent = ((PlacedMultiBlockPart)block).Parent;
            }

            Destroy(parent.gameObject);
            Assert.IsTrue(_blocks.Remove(parent.Position), "The parent of the multi block is not present.");
            foreach (PlacedMultiBlockPart part in parent.Parts)
            {
                Assert.IsTrue(_blocks.Remove(part.Position), "A part of the multi block is not present.");
            }
        }
Ejemplo n.º 14
0
        public static void Main(string[] args)
        {
            var facade = new SystemFactory().System;

            var(loggedInAdmin, tokenAdmin) = facade.LogIn(new Dictionary <string, string>
            {
                ["login"]    = "******",
                ["password"] = "******",
            });

            facade.AssignRegistrationDate(new Dictionary <string, string>
            {
                ["dateStart"] = "2020-01-08 10:00",
                ["dateEnd"]   = "2020-01-08 11:00",
            }, tokenAdmin);

            var(loggedInStudent, tokenStudent) = facade.LogIn(new Dictionary <string, string>
            {
                ["login"]    = "******",
                ["password"] = "******",
            });

            var(signedIn, message) = facade.SignToLesson(new Dictionary <string, string>
            {
                ["lessonId"] = "4",
            }, tokenStudent);

            var(edited, err4) = facade.EditCoursesGroup(new Dictionary <string, string>
            {
                ["id"]       = "1",
                ["ects"]     = "29",
                ["semester"] = "6",
                ["fieldId"]  = "2",
                ["code"]     = "INEK000420",
                ["name"]     = "Analiza matematyczna 4",
            }, tokenAdmin);

            var(field, message2) = facade.ShowField(new Dictionary <string, string>
            {
                ["id"] = "1",
            }, tokenAdmin);
        }
Ejemplo n.º 15
0
        public bool AddAccountAdmin()
        {
            var facade = new SystemFactory().System;

            var(_, token) = facade.LogIn(new Dictionary <string, string>
            {
                ["login"]    = "******",
                ["password"] = "******",
            });

            var(added, _) = facade.AddAccount(new Dictionary <string, string>
            {
                ["login"] = Login,
                ["rank"]  = Rank
            }, token);

            facade.LogOut(token);

            return(added);
        }
Ejemplo n.º 16
0
        private bool InitializeLocal()
        {
            // Create sound device.
            if (!device.Create())
            {
                return(false);
            }

            // Create timer.
            timer = SystemFactory.CreateTimer();

            if (!timer.Initialize())
            {
                //Engine.Error("Sound system timer failed to initialize");

                return(false);
            }

            return(true);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Determines whether the block can be added checking whether a block is already
        /// present at the position and whether this new block can connect to another block.
        /// </summary>
        public bool CanAddBlock(BlockPosition position, BlockInfo info, byte rotation)
        {
            if (info.Type == BlockType.Mainframe)
            {
                if (_mainframePosition != null)
                {
                    return(false);
                }
            }
            else if (SystemFactory.IsAnySystem(info.Type))
            {
                if (SystemFactory.IsActiveSystem(info.Type))
                {
                    if (_activeSystemPresent)
                    {
                        return(false);
                    }
                }
                else
                {
                    WeaponSystem.Type weaponType = SystemFactory.GetWeaponType(info.Type);
                    if (weaponType != WeaponSystem.Type.None && weaponType != _weaponType && _weaponType != WeaponSystem.Type.None)
                    {
                        return(false);
                    }
                }
            }

            if (info is SingleBlockInfo single)
            {
                return(!_blocks.ContainsKey(position) &&
                       CanConnect(position, Rotation.RotateSides(single.ConnectSides, rotation)));
            }
            else
            {
                return(((MultiBlockInfo)info).GetRotatedPositions(position, rotation,
                                                                  out KeyValuePair <BlockPosition, BlockSides>[] positions) &&
                       !positions.Any(pair => _blocks.ContainsKey(pair.Key)) &&
                       positions.Any(pair => CanConnect(pair.Key, pair.Value)));
            }
        }
Ejemplo n.º 18
0
        private void Deserialize(BitBuffer buffer)
        {
            while (buffer.TotalBitsLeft >= RealPlacedBlock.SerializedBitsSize)
            {
                ushort        type     = (ushort)buffer.ReadBits(BlockFactory.BlockTypeSerializedBitsSize);
                BlockPosition position = BlockPosition.Deserialize(buffer);

                BlockInfo info = BlockFactory.GetInfo(BlockFactory.GetType(type));
                if (info.Type == BlockType.Mainframe)
                {
                    _mainframePosition = position;
                }

                byte          rotation = Rotation.Deserialize(buffer);
                RealLiveBlock block;
                if (info is SingleBlockInfo single)
                {
                    block = BlockFactory.MakeSingleLive(transform, single, rotation, position);
                }
                else
                {
                    block = BlockFactory.MakeMultiLive(transform, (MultiBlockInfo)info, rotation,
                                                       position, out LiveMultiBlockPart[] parts);
                    foreach (LiveMultiBlockPart part in parts)
                    {
                        _blocks.Add(part.Position, part);
                    }
                }

                Health += info.Health;
                Mass   += info.Mass;
                _blocks.Add(position, block);
                if (SystemFactory.Create(this, block, out BotSystem system))
                {
                    _systems.Add(position, system);
                }
            }
        }
Ejemplo n.º 19
0
    public WebMailService()
    {
        m_ConfigHelper  = new ConfigHelper();
        m_SystemFactory = new SystemFactory();
        m_SystemService = m_SystemFactory.GetSystemService();

        m_MailVO = m_SystemService.GetSystemParamByRoot();

        bool enableSSL = m_MailVO.EnableSSL;
        int  port      = 25;

        if (m_MailVO.MailSmtp.IndexOf("gmail") != -1)
        {
            enableSSL = true;
            port      = 587;
        }
        else if (!string.IsNullOrEmpty(m_MailVO.MailPort))
        {
            port = int.Parse(m_MailVO.MailPort);
        }

        m_MailService = new MailService(m_MailVO.MailSmtp, port, enableSSL, m_MailVO.Account, m_MailVO.Password);
    }
Ejemplo n.º 20
0
        public bool AddAccountStudent()
        {
            var facade = new SystemFactory().System;

            var(_, token) = facade.LogIn(new Dictionary <string, string>
            {
                ["login"]    = "******",
                ["password"] = "******",
            });
            var(added, _) = facade.AddAccount(new Dictionary <string, string>
            {
                ["login"]     = Login,
                ["rank"]      = Rank,
                ["firstName"] = FirstName,
                ["lastName"]  = LastName,
                ["index"]     = Index,
                ["fieldId"]   = FieldId,
                ["semester"]  = Semester
            }, token);

            facade.LogOut(token);

            return(added);
        }
Ejemplo n.º 21
0
        public DisplayOutput Run()
        {
            List <Default> systems = null;
            DisplayOutput  dispOut = new DisplayOutput();

            systems = SystemFactory.GetAllSystems();

            foreach (Default system in systems)
            {
                foreach (Job jb in system.Jobs)
                {
                    jb.JobAction();

                    foreach (string display in jb.GetDisplayOutput().Events)
                    {
                        dispOut.Events.Add(display);
                    }
                }
            }

            EmailResults(dispOut);

            return(dispOut);
        }
Ejemplo n.º 22
0
 public IOutputFileHelper CreateOutputFileHelper(string outputDirectory)
 {
     return(new OutputFileHelper(outputDirectory, SystemFactory.CreateSystem()));
 }
Ejemplo n.º 23
0
 protected override void Awake() {
     base.Awake();
     _gameMgr = GameManager.Instance;
     _systemFactory = SystemFactory.Instance;
     _generalFactory = GeneralFactory.Instance;
     SetStaticValues();
     Subscribe();
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Lists all registered systems
 /// </summary>
 /// <returns></returns>
 public async Task <IEnumerable <R3M_UserManagement_Domain.System> > ListSystems()
 {
     return(SystemFactory.Build(await Collection.Find(i => i.DeletedDate == null).ToListAsync()));
 }
Ejemplo n.º 25
0
 public VotesController()
 {
     VoteValidator = SystemFactory.GetVoteValidatorInstance();
 }
 private void InitializeValuesAndReferences() {
     _gameMgr = GameManager.Instance;
     _nameFactory = SystemNameFactory.Instance;
     _systemFactory = SystemFactory.Instance;
     _availablePassiveCountermeasureStats = MakeAvailablePassiveCountermeasureStats(9);
 }
Ejemplo n.º 27
0
 public UsersController()
 {
     userValidator = SystemFactory.GetUserValidatorInstance();
 }
Ejemplo n.º 28
0
 public void TestCaseInit()
 {
     m_SystemFactory = new SystemFactory();
     m_LogService = m_SystemFactory.GetLogService();
 }
Ejemplo n.º 29
0
 public AccountStatesController()
 {
     AccountStateValidator = SystemFactory.GetAccountStateValidatorInstance();
 }
Ejemplo n.º 30
0
        public void LogOut()
        {
            var system = new SystemFactory().System;

            system.LogOut(token);
        }
Ejemplo n.º 31
0
 public ServicesController()
 {
     serviceValidator = SystemFactory.GetServiceValidatorInstance();
 }
Ejemplo n.º 32
0
        /// <summary>
        /// Registers a new System in the database
        /// </summary>
        /// <param name="system"></param>
        /// <returns></returns>
        public async Task <R3M_UserManagement_Domain.System> AddSystem(R3M_UserManagement_Domain.System system)
        {
            SystemModel systemModel = SystemFactory.Build(system);

            return(SystemFactory.Build(await AddAsync(systemModel)));
        }
Ejemplo n.º 33
0
 public MeetingsController()
 {
     MeetingValidator = SystemFactory.GetMeetingValidatorInstance();
 }
Ejemplo n.º 34
0
 private void InitializeValuesAndReferences() {
     _gameMgr = GameManager.Instance;
     _systemFactory = SystemFactory.Instance;
 }