public void GetLog(IBookModule bookOp)
        {
            Console.Clear();
            Console.Write(StringLiterals.ChooseLogOptionPrompt);
            LogChoice logOption = (LogChoice)Enum.Parse(typeof(LogChoice), Console.ReadLine());

            switch (logOption)
            {
            case LogChoice.AllLog:
                Console.Clear();
                Console.WriteLine(StringLiterals.DisplayLogTillNowMsg);
                foreach (DataRow row in bookOp.GetLog().Rows)
                {
                    if (row["ReturnedAt"].ToString() == default(DateTime).ToString())
                    {
                        Console.WriteLine("BookID: {0}\nTaken by: {1}\nIssued by: {2}\nIssued at: {3}\nReturned at: Need to be returned\nRemarks: {4}\n", row["BookID"].ToString(), row["UserID"].ToString(), row["PerformedByID"].ToString(), row["OperationPerformedAt"].ToString(), row["Remarks"].ToString());
                    }
                    else
                    {
                        Console.WriteLine("BookID: {0}\nTaken by: {1}\nIssued by: {2}\nIssued at: {3}\nReturned at: {4}\nRemarks: {5}\n", row["BookID"].ToString(), row["UserID"].ToString(), row["PerformedByID"].ToString(), row["OperationPerformedAt"].ToString(), row["ReturnedAt"].ToString(), row["Remarks"].ToString());
                    }
                }
                break;

            case LogChoice.DateLog:
                Console.Clear();
                Console.Write(StringLiterals.EnterDatePrompt);
                DateTime dtlog = DateTime.Parse(Console.ReadLine());
                Console.WriteLine(StringLiterals.DisplayingLogTillDate + dtlog);
                Console.WriteLine(StringLiterals.IssuesMsg);
                foreach (DataRow row in bookOp.GetIssueLogByDate(dtlog).Rows)
                {
                    Console.WriteLine("BookID: {0}\nTaken by: {1}\nIssued by: {2}\nIssued at: {3}\nRemarks: {4}\n", row["BookID"].ToString(), row["UserID"].ToString(), row["PerformedByID"].ToString(), row["OperationPerformedAt"].ToString(), row["Remarks"].ToString());
                }
                Console.WriteLine(StringLiterals.ReturnsMsg);
                foreach (DataRow row in bookOp.GetReturnLogByDate(dtlog).Rows)
                {
                    Console.WriteLine("BookID: {0}\nTaken by: {1}\nIssued by: {2}\nReturned at: {3}\nRemarks: {4}\n", row["BookID"].ToString(), row["UserID"].ToString(), row["PerformedByID"].ToString(), row["OperationPerformedAt"].ToString(), row["Remarks"].ToString());
                }
                break;

            default:
                Console.WriteLine(StringLiterals.Error);
                break;
            }
            Console.WriteLine(StringLiterals.PressAnyKeyPrompt);
            Console.ReadKey();
        }
Example #2
0
    public SatelliteSP0031(int satelliteid, int satellitenum, int orbitnumber, Transform earth_transform_,
                           GameObject orbit_, double orbitalangle, int maxlasercount, int maxsatcount, int phase1_satcount_,
                           double sat_phase_stagger_, int sats_per_orbit_, int orbital_planes_,
                           float altitude_, int beam_angle_, float beam_radius_, GameObject sat_prefab, GameObject beam_prefab1_,
                           GameObject beam_prefab2_, GameObject laser_prefab_, GameObject thin_laser_prefab_,
                           System.IO.StreamWriter logfile_, LogChoice log_choice_)
    {
        orbit             = orbit_;
        satid             = satelliteid;  /* globally unique satellite ID */
        satnum            = satellitenum; /* satellite's position in its orbit */
        orbitnum          = orbitnumber;
        altitude          = altitude_;
        beam_angle        = beam_angle_;
        beam_radius       = beam_radius_;
        beam_prefab1      = beam_prefab1_;
        beam_prefab2      = beam_prefab2_;
        laser_prefab      = laser_prefab_;
        thin_laser_prefab = thin_laser_prefab_;
        earth_transform   = earth_transform_;
        logfile           = logfile_;
        log_choice        = log_choice_;

        maxsats         = maxsatcount;      /* total number of satellites */
        phase1_satcount = phase1_satcount_; // number of satellites in phase 1
                                            // (will equal maxsats if only simulating phase 1)
        maxlasers         = maxlasercount;
        sat_phase_stagger = sat_phase_stagger_;
        sats_per_orbit    = sats_per_orbit_;
        orbital_planes    = orbital_planes_;

        nearestsats  = new SatelliteSP0031[maxsats];
        nearestcount = 0;

        assignedsats  = new SatelliteSP0031[LASERS_PER_SAT];
        assignedcount = 0;

        prevassignedsats  = new SatelliteSP0031[LASERS_PER_SAT];
        prevassignedcount = 0;

        preassignedsats  = new SatelliteSP0031[LASERS_PER_SAT];
        preassignedcount = 0;

        Vector3 pos = earth_transform.position;

        pos.x     += 1f;
        gameobject = GameObject.Instantiate(sat_prefab, pos, earth_transform.rotation);
        gameobject.transform.RotateAround(Vector3.zero, Vector3.up, (float)orbitalangle);
        gameobject.transform.SetParent(orbit.transform, false);

        links = new GameObject[2];

        lasers     = new GameObject[LASERS_PER_SAT];
        laserdsts  = new SatelliteSP0031[LASERS_PER_SAT];
        lasertimes = new double[LASERS_PER_SAT];
        laseron    = new bool[LASERS_PER_SAT];
        for (int lc = 0; lc < maxlasers; lc++)
        {
            lasers [lc] = GameObject.Instantiate(laser_prefab, position(),
                                                 gameobject.transform.rotation);
            lasers [lc].transform.SetParent(gameobject.transform, true);
            lasertimes [lc] = Time.time;
            laseron[lc]     = false;
        }

        for (int linknum = 0; linknum < 2; linknum++)
        {
            links [linknum] = GameObject.Instantiate(laser_prefab, position(),
                                                     gameobject.transform.rotation);
            links [linknum].transform.SetParent(gameobject.transform, true);
        }
    }