示例#1
0
 public RentalApplicant(string firstName, string lastName, string contactTel, string contactEmail,
                        string contactSms, string contactOthers, int?annualIncome, int numberOfOccupant, bool withChildren,
                        LegalStatus status, string creditRating, string creditSource, string empoyedStatus, int rentalApplicationId, string reasonToMove,
                        bool withCoApplicant, bool withPets, bool isSmoking, IList <CoApplicant> coApplicants,
                        /*IList<ApplicantAddress> applicantAddresses, */ ICollection <RentalReference> rentalReference, IList <ApplicantChild> applicantChildren, DateTime created, DateTime updated)
 {
     FirstName           = firstName;
     LastName            = lastName;
     ContactTel          = contactTel;
     ContactEmail        = contactEmail;
     ContactSms          = contactSms;
     ContactOthers       = contactOthers;
     AnnualIncome        = annualIncome;
     NumberOfOccupant    = numberOfOccupant;
     WithChildren        = withChildren;
     Status              = status;
     CreditRating        = creditRating;
     CreditSource        = creditSource;
     EmpoyedStatus       = empoyedStatus;
     RentalApplicationId = rentalApplicationId;
     ReasonToMove        = reasonToMove;
     WithCoApplicant     = withCoApplicant;
     WithPets            = withPets;
     IsSmoking           = isSmoking;
     /*OwnedVehicle = ownedVehicle*/;
     CoApplicants = coApplicants;
     //ApplicantAddresses = applicantAddresses;
     ApplicantChildren = applicantChildren;
     RentalReference   = rentalReference;
     Created           = created;
     Modified          = updated;
 }
示例#2
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomTransparencySoftwareSerializer">A delegate to serialize custom transparency software JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <TransparencySoftware> CustomTransparencySoftwareSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("name", Name),
                new JProperty("version", Version),
                new JProperty("legal_status", LegalStatus.ToString()),
                new JProperty("open_source_license", OpenSourceLicense.ToString()),
                new JProperty("vendor", Vendor),

                Logo.HasValue
                               ? new JProperty("logo", Logo.ToString())
                               : null,

                HowToUse.HasValue
                               ? new JProperty("how_to_use", HowToUse.ToString())
                               : null,

                MoreInformation.HasValue
                               ? new JProperty("more_information", MoreInformation.ToString())
                               : null,

                SourceCodeRepository.HasValue
                               ? new JProperty("source_code_repository", SourceCodeRepository.ToString())
                               : null

                );

            return(CustomTransparencySoftwareSerializer != null
                       ? CustomTransparencySoftwareSerializer(this, JSON)
                       : JSON);
        }
示例#3
0
        public Company(string name = null, LegalStatus legalStatus = LegalStatus.SAS, List <IProduct> products = null, double salesRevenue = 0.0)
        {
            Id     = Count++;
            Name   = name ?? RandomCompanyNameGenerator.Generate();
            Status = legalStatus;

            if (products == null)
            {
                Products = new List <IProduct>();
            }

            SalesRevenue = salesRevenue;
        }
示例#4
0
 public ShipTargetedEvent(DateTime timestamp, bool targetlocked, string ship, int?scanstage, string name, CombatRating rank, string faction, LegalStatus legalstatus, int?bounty, decimal?shieldhealth, decimal?hullhealth, string subsystem, decimal?subsystemhealth) : base(timestamp, NAME)
 {
     this.targetlocked    = targetlocked;
     this.ship            = ship;
     this.scanstage       = scanstage;
     this.name            = name;
     this.combatrankDef   = rank;
     this.faction         = faction;
     this.legalstatusDef  = legalstatus;
     this.bounty          = bounty;
     this.shieldhealth    = shieldhealth;
     this.hullhealth      = hullhealth;
     this.subsystem       = subsystem;
     this.subsystemhealth = subsystemhealth;
 }
        internal static string ToSerializedValue(this LegalStatus value)
        {
            switch (value)
            {
            case LegalStatus.Legal:
                return("legal");

            case LegalStatus.NotLegal:
                return("not_legal");

            case LegalStatus.Restricted:
                return("restricted");

            case LegalStatus.Banned:
                return("banned");
            }
            return(null);
        }
示例#6
0
 public RentalApplicant(string firstName, string lastName, string contactTel,
                        string contactEmail, string contactSms, string contactOthers, int?annualIncome, int numberOfOccupant,
                        bool?withChildren, LegalStatus legalStatus, string empoyedStatus, string credditRating, string reasonToMove, DateTime created, DateTime updated)
 {
     FirstName        = firstName;
     LastName         = lastName;
     ContactTel       = contactTel;
     ContactEmail     = contactEmail;
     ContactSms       = contactSms;
     ContactOthers    = contactOthers;
     AnnualIncome     = annualIncome;
     NumberOfOccupant = numberOfOccupant;
     WithChildren     = withChildren;
     Status           = legalStatus;
     CreditRating     = credditRating;
     EmpoyedStatus    = empoyedStatus;
     ReasonToMove     = reasonToMove;
     Created          = created;
     Modified         = updated;
 }
示例#7
0
        /// <summary>
        /// Create new transparency software.
        /// </summary>
        /// <param name="Name">The name of the transparency software.</param>
        /// <param name="Version">The version of the transparency software.</param>
        /// <param name="LegalStatus">The legal status of the transparency software.</param>
        /// <param name="OpenSourceLicense">The Open Source license of the transparency software.</param>
        /// <param name="Vendor">The vendor of the transparency software.</param>
        ///
        /// <param name="Logo">An optional URL where to find a small logo of the transparency software.</param>
        /// <param name="HowToUse">An optional URL where to find a manual how to use the transparency software.</param>
        /// <param name="MoreInformation">An optional URL where to find more information about the transparency software.</param>
        /// <param name="SourceCodeRepository">An optional URL where to find the source code of the transparency software.</param>
        public TransparencySoftware(String Name,
                                    String Version,
                                    LegalStatus LegalStatus,
                                    OpenSourceLicenses OpenSourceLicense,
                                    String Vendor,

                                    URL?Logo                 = null,
                                    URL?HowToUse             = null,
                                    URL?MoreInformation      = null,
                                    URL?SourceCodeRepository = null)
        {
            this.Name              = Name;
            this.Version           = Version;
            this.LegalStatus       = LegalStatus;
            this.OpenSourceLicense = OpenSourceLicense;
            this.Vendor            = Vendor;

            this.Logo                 = Logo;
            this.HowToUse             = HowToUse;
            this.MoreInformation      = MoreInformation;
            this.SourceCodeRepository = SourceCodeRepository;
        }
示例#8
0
        public Status ParseStatusEntry(string line)
        {
            Status status = new Status();

            try
            {
                Match match = JsonRegex.Match(line);
                if (match.Success)
                {
                    IDictionary <string, object> data = Deserializtion.DeserializeData(line);

                    // Every status event has a timestamp field
                    status.timestamp = DateTime.UtcNow;
                    try
                    {
                        status.timestamp = JsonParsing.getDateTime("timestamp", data);
                    }
                    catch
                    {
                        Logging.Warn("Status without timestamp; using current time");
                    }

                    status.flags = (Status.Flags)(JsonParsing.getOptionalLong(data, "Flags") ?? 0);
                    if (status.flags == Status.Flags.None)
                    {
                        // No flags are set. We aren't in game.
                        return(status);
                    }

                    data.TryGetValue("Pips", out object val);
                    List <long> pips = ((List <object>)val)?.Cast <long>()?.ToList(); // The 'TryGetValue' function returns these values as type 'object<long>'
                    status.pips_sys = pips != null ? ((decimal?)pips[0] / 2) : null;  // Set system pips (converting from half pips)
                    status.pips_eng = pips != null ? ((decimal?)pips[1] / 2) : null;  // Set engine pips (converting from half pips)
                    status.pips_wea = pips != null ? ((decimal?)pips[2] / 2) : null;  // Set weapon pips (converting from half pips)

                    status.firegroup = JsonParsing.getOptionalInt(data, "FireGroup");
                    int?gui_focus = JsonParsing.getOptionalInt(data, "GuiFocus");
                    switch (gui_focus)
                    {
                    case 0:     // No focus
                    {
                        status.gui_focus = "none";
                        break;
                    }

                    case 1:     // InternalPanel (right hand side)
                    {
                        status.gui_focus = "internal panel";
                        break;
                    }

                    case 2:     // ExternalPanel (left hand side)
                    {
                        status.gui_focus = "external panel";
                        break;
                    }

                    case 3:     // CommsPanel (top)
                    {
                        status.gui_focus = "communications panel";
                        break;
                    }

                    case 4:     // RolePanel (bottom)
                    {
                        status.gui_focus = "role panel";
                        break;
                    }

                    case 5:     // StationServices
                    {
                        status.gui_focus = "station services";
                        break;
                    }

                    case 6:     // GalaxyMap
                    {
                        status.gui_focus = "galaxy map";
                        break;
                    }

                    case 7:     // SystemMap
                    {
                        status.gui_focus = "system map";
                        break;
                    }

                    case 8:     // Orrery
                    {
                        status.gui_focus = "orrery";
                        break;
                    }

                    case 9:     // FSS mode
                    {
                        status.gui_focus = "fss mode";
                        break;
                    }

                    case 10:     // SAA mode
                    {
                        status.gui_focus = "saa mode";
                        break;
                    }

                    case 11:     // Codex
                    {
                        status.gui_focus = "codex";
                        break;
                    }
                    }
                    status.latitude  = JsonParsing.getOptionalDecimal(data, "Latitude");
                    status.longitude = JsonParsing.getOptionalDecimal(data, "Longitude");
                    status.altitude  = JsonParsing.getOptionalDecimal(data, "Altitude");
                    status.heading   = JsonParsing.getOptionalDecimal(data, "Heading");
                    if (data.TryGetValue("Fuel", out object fuelData))
                    {
                        if (fuelData is IDictionary <string, object> fuelInfo)
                        {
                            status.fuelInTanks     = JsonParsing.getOptionalDecimal(fuelInfo, "FuelMain");
                            status.fuelInReservoir = JsonParsing.getOptionalDecimal(fuelInfo, "FuelReservoir");
                        }
                    }
                    status.cargo_carried = (int?)JsonParsing.getOptionalDecimal(data, "Cargo");
                    status.legalStatus   = LegalStatus.FromEDName(JsonParsing.getString(data, "LegalState")) ?? LegalStatus.Clean;
                    status.bodyname      = JsonParsing.getString(data, "BodyName");
                    status.planetradius  = JsonParsing.getOptionalDecimal(data, "PlanetRadius");

                    // Calculated data
                    SetFuelExtras(status);
                    SetSlope(status);

                    return(status);
                }
            }
            catch (Exception ex)
            {
                Logging.Warn("Failed to parse Status.json line: " + ex.ToString());
                Logging.Error("", ex);
            }
            return(null);
        }
        /// <summary>
        /// Updates Organization General.
        /// LegalStatus: If exists then update, if no then insert.
        /// </summary>
        /// <param name="gen"></param>
        /// <returns></returns>
        public bool UpdateOrganizationGeneral(General gen)
        {
            bool            result = true;
            BOTADataContext db     = new BOTADataContext(connectString);

            try
            {
                db.Generals.Attach(gen);
                db.Refresh(RefreshMode.KeepCurrentValues, gen);

                //db.ExecuteCommand("DELETE FROM addresses WHERE ContactID={0} and AddressTypeID={1}", contactID, addressTypeID);
                // gen.Organization.LegalStatus.Detach();

                //check if legalstaus exists.

                /* var legstat = (from l in db.LegalStatus
                 *              where l.OrgID == gen.OrgID
                 *              select l).FirstOrDefault(); */


                //if (legstat == null) //if it does not exist.
                if (!db.LegalStatus.Any(l => l.OrgID == gen.OrgID)) // !if exists.
                {
                    //Insert
                    LegalStatus lstat = new LegalStatus();
                    lstat.OrgID        = gen.OrgID;
                    lstat.LegSListID   = gen.Organization.LegalStatus.LegSListID;
                    lstat.SelectedDate = gen.Organization.LegalStatus.SelectedDate;
                    db.LegalStatus.InsertOnSubmit(lstat);
                }
                else
                {  //try to update.
                   // legstat.Detach();
                   // legstat.LegSListID = gen.Organization.LegalStatus.LegSListID;
                   // db.LegalStatus.Attach(legstat);
                    db.Refresh(RefreshMode.KeepCurrentValues, gen.Organization.LegalStatus);
                }

                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                Log.EnsureInitialized();
                Log.Error(typeof(OrganizationRepository), "----------------------------------------------", ex);
                result = false;
            }

            return(result);

/*
 *         try
 *         {
 *
 *             BOTADataContext db = new BOTADataContext(connectString);
 *
 *             { General genitem = (from organization in db.Organizations
 *                                    join general in db.Generals
 *                                    on organization.OrgID equals general.OrgID
 *                                    where general.OrgID == gen.Organization.OrgID
 *                                    select general).First();
 *
 *                 genitem.Name = gen.Name;
 *                 genitem.Organization.LegalStatus.LegSListID = gen.Organization.LegalStatus.LegSListID;
 *                 genitem.FiscalYearEnd = gen.FiscalYearEnd;
 *                 genitem.Notes = gen.Notes;
 *                 db.SubmitChanges();
 *
 *             }
 *         }
 *         catch (Exception ex)
 *         {
 *             result = false;
 *         }
 *
 *         return result; */
        }