public Cooperation(CooperationType type, Airline airline, DateTime built)
 {
     BuiltDate = built;
     Airline = airline;
     Type = type;
 }
 public static void AddCooperationType(CooperationType type)
 {
     Types.Add(type);
 }
示例#3
0
        private static void LoadCooperations()
        {
            var doc = new XmlDocument();
            doc.Load(AppSettings.GetDataPath() + "\\airlinecooperations.xml");
            XmlElement root = doc.DocumentElement;

            XmlNodeList cooperationsList = root?.SelectNodes("//cooperation");

            if (cooperationsList != null)
                foreach (XmlElement element in cooperationsList)
                {
                    string section = root.Name;
                    string uid = element.Attributes["uid"].Value;
                    double price = Convert.ToDouble(
                        element.Attributes["price"].Value,
                        CultureInfo.GetCultureInfo("en-US").NumberFormat);
                    int fromyear = Convert.ToInt16(element.Attributes["fromyear"].Value);
                    double monthlyprice = Convert.ToDouble(
                        element.Attributes["monthlyprice"].Value,
                        CultureInfo.GetCultureInfo("en-US").NumberFormat);
                    int servicelevel = Convert.ToInt16(element.Attributes["servicelevel"].Value);
                    double incomeperpax = Convert.ToDouble(
                        element.Attributes["incomeperpax"].Value,
                        CultureInfo.GetCultureInfo("en-US").NumberFormat);
                    var minsize =
                        (GeneralHelpers.Size) Enum.Parse(typeof (GeneralHelpers.Size), element.Attributes["minsize"].Value);

                    var type = new CooperationType(
                        section,
                        uid,
                        minsize,
                        fromyear,
                        price,
                        monthlyprice,
                        servicelevel,
                        incomeperpax);
                    CooperationTypes.AddCooperationType(type);
                    /*uid="101" price="250000" fromyear="1980" monthlyprice="10000" servicelevel="50" incomepercent="3"*/

                    if (element.SelectSingleNode("translations") != null)
                    {
                        Translator.GetInstance()
                            .AddTranslation(
                                root.Name,
                                element.Attributes["uid"].Value,
                                element.SelectSingleNode("translations"));
                    }
                }
        }