コード例 #1
0
        ///<summary>
        /// Converts a discount factor to a compounding zero rate.
        ///</summary>
        ///<param name="yearFraction">The year Fraction.</param>
        ///<param name="discountFactor">The discount factor.</param>
        ///<param name="frequency">The compounding frequency. Can take: Continuous, Daily, Quarterly,
        /// Semi-Annual,SemiAnnual,Semi and Annual</param>
        ///<returns>The compounded zero rate requested.</returns>
        public static double DiscountFactorToZeroRate(double discountFactor, double yearFraction, string frequency)
        {
            var    compounding = EnumParse.ToCompoundingFrequencyEnum(frequency);
            double result      = DiscountFactorToZeroRate(discountFactor, yearFraction, compounding);

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Load item's datas from Resources
        /// </summary>
        /// <param name="fileName">File's name</param>
        /// <returns>ItemData array</returns>
        static public ItemData[] LoadItemData(string fileName)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(Resources.Load <TextAsset>(fileName).text);

            XmlNode     itemMes  = xmlDoc.SelectSingleNode("ItemMes");
            XmlNodeList elements = itemMes.ChildNodes;

            ItemData[] nodes = new ItemData[elements.Count];

            for (int i = 0; i < nodes.Length; i++)
            {
                XmlElement element = (XmlElement)elements[i];
                nodes[i].id       = Convert.ToInt32(element.GetAttribute("ID"));
                nodes[i].itemType = EnumParse.ToItemType(element.GetAttribute("type"));

                XmlNodeList childList = element.ChildNodes;
                nodes[i].repeatable    = Convert.ToBoolean(childList.Item(0).InnerText);
                nodes[i].level         = EnumParse.ToItemLevel(childList.Item(1).InnerText);
                nodes[i].equipmentType = EnumParse.ToEquipmentType(childList.Item(2).InnerText);
                nodes[i].maxSum        = Convert.ToInt32(childList.Item(3).InnerText);

                nodes[i].picName = childList.Item(4).InnerText;

                nodes[i].num = 1;
            }

            return(nodes);
        }
コード例 #3
0
 public PlayerManager(int numberOfPlayers)
 {
     this.PlayerList = new List <Player>();
     for (var i = 0; i < numberOfPlayers; ++i)
     {
         this.PlayerList.Add(new Player(EnumParse <MeepleColor> .IntToEnum(i)));
     }
 }
コード例 #4
0
    /// <summary>
    /// 枚举测试
    /// </summary>
    void OnEnumParseFixCall()
    {
        Debug.Log("----- OnEnumParseFixCall Began -----");
        EnumParse colorEnum = new EnumParse();

        ShowInfo.text = colorEnum.PrintEnum();
        Debug.Log("----- OnEnumParseFixCall Ended -----");
    }
コード例 #5
0
ファイル: Form_purchase.cs プロジェクト: titimar16/KitBox
        public Form_purchase()
        {
            InitializeComponent();

            int    totalHeight = 0;
            Locker locker;

            foreach (ICupboardComponents cupCompo in ShoppingCart.cupboardComponentsList)
            {
                if (cupCompo is Locker)
                {
                    locker = (Locker)cupCompo;

                    int    currentbox = locker.ID;
                    string height     = locker.height.ToString();
                    //string depth = locker.depth.ToString();
                    string doorsColor = EnumParse.parseColorEnumToStr(locker.doorsColor);
                    string panelColor = EnumParse.parseColorEnumToStr(locker.panelColor);
                    string price      = locker.price.ToString();

                    totalHeight += locker.height + 4;

                    dataGridView1.Rows.Add(currentbox, height, doorsColor, false, panelColor, price);
                }
            }
            string          MyConString = "SERVER=db4free.net;" + "DATABASE=kitbox_kewlax;" + "UID=kewlaw;" + "PASSWORD=locomac6; old guids = true";
            MySqlConnection conn        = new MySqlConnection(MyConString);

            conn.Open();
            List <string> HeightBracketsList = QueryKitbox.SpecsBoxList(conn, "Height", "Ref = \"AngleBracket\"");

            conn.Close();
            int angleBracketHeight = 0;
            int diff;
            int minDiff = 1000;

            foreach (string heightBracket in HeightBracketsList)
            {
                diff = Int32.Parse(heightBracket) - totalHeight;
                if (diff >= 0 && diff < minDiff)
                {
                    minDiff            = diff;
                    angleBracketHeight = Int32.Parse(heightBracket);
                }
            }

            conn.Open();
            string angleBracketPrices = DbUtils.BigMoney(conn, "CustPrice", "AngleBracket", angleBracketHeight.ToString(), "0", "0", EnumParse.parseColorEnumToStr(ShoppingCart.colorAngleBracketChosen))[0];

            conn.Close();
            double angleBracketPrice = Double.Parse(angleBracketPrices);

            AngleBracket angleBrackets = new AngleBracket(angleBracketPrice, "null", "0000", new ComponentSize(0, 0, 0), true, ShoppingCart.colorAngleBracketChosen);

            ShoppingCart.addCupboardComponent(angleBrackets);

            dataGridView1.Rows.Add("Anglebrackets", angleBracketHeight, " ", null, " ", angleBracketPrice.ToString() + " x4");
        }
コード例 #6
0
 public void ENumfromAStringEmptyReturnTest()
 {
     try
     {
         int result = (int)EnumParse.ParseEnum <Test>("");
         IsTrue(false);
     }
     catch
     {
         IsTrue(true);
     }
 }
コード例 #7
0
        public void SetEquipmentData()
        {
            var unit = _unitsMenuController.Roster.ActiveUnit.UnitData;

            foreach (var equipmentData in unit.Outfit)
            {
                var equipmentKey = StringParse.GetItemKey(equipmentData);
                var equipment    = _productsController.GetProduct(equipmentKey);
                var qualityKey   = StringParse.GetItemQualityKey(equipmentData);
                var quality      = EnumParse.ParseStringToEnum <ItemQuality>(qualityKey);
                _cells.First(x => x.Group == equipment.ProductGroup).SetEquipmentData(equipment, quality);
            }
        }
コード例 #8
0
        /// <summary>
        /// populates the metadata of a photo
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns></returns>
        private static Photo GetItem(IDataRecord reader)
        {
            Photo photo = new Photo
            {
                PhotoID     = Convert.ToInt32(reader["PhotoID"]),
                Title       = Convert.ToString(reader["Title"]),
                Description = Convert.ToString(reader["Description"]),
                DateTaken   = SetDateTaken(reader),
                Profile     = EnumParse <PhotoProfile> .Parse(reader["Profile"].ToString())
            };

            return(photo);
        }
コード例 #9
0
        public static LocalizationManager.Languages GetSetPlayerLanguage()
        {
            string l = PlayerPrefs.GetString(PLAYERLANGUAGE);

            LocalizationManager.Languages lang;
            if (EnumParse.TryParseEnum <LocalizationManager.Languages>(l, out lang))
            {
                return(lang);
            }
            else
            {
                return(LocalizationManager.defaultLang);
            }
        }
コード例 #10
0
        /// <summary>
        /// populates a single photo class
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns></returns>
        private static Photo GetSingleItem(IDataReader reader)
        {
            Photo photo = new Photo();

            using (reader)
            {
                while (reader.Read())
                {
                    photo.PhotoID     = Convert.ToInt32(reader["PhotoID"]);
                    photo.Title       = Convert.ToString(reader["Title"]);
                    photo.Description = Convert.ToString(reader["Description"]);
                    photo.DateTaken   = SetDateTaken(reader);
                    photo.Profile     = EnumParse <PhotoProfile> .Parse(reader["Profile"].ToString());
                }
            }

            return(photo);
        }
コード例 #11
0
ファイル: User_Interface.cs プロジェクト: titimar16/KitBox
        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled   = false;
            comboBox1.Enabled = false;
            comboBox2.Enabled = false;
            comboBox3.Enabled = false;
            comboBox4.Enabled = false;
            bool choice_fill = false;

            if (comboBox1.SelectedItem != null && comboBox2.SelectedItem != null && comboBox3.SelectedItem != null && comboBox4.SelectedItem != null)
            {
                ComponentColor color1          = EnumParse.parseColorStrToEnum(comboBox4.SelectedItem.ToString());
                int            numberOfLockers = Int32.Parse(comboBox1.SelectedItem.ToString());
                int            width           = Int32.Parse(comboBox2.SelectedItem.ToString());
                int            depth           = Int32.Parse(comboBox3.SelectedItem.ToString());

                ShoppingCart.addCupboardUserChoices(width, depth, numberOfLockers, color1);
                choice_fill = true;
            }
            else
            {
                MessageBox.Show("Fill every choices");
                button1.Enabled   = true;
                comboBox1.Enabled = true;
                comboBox2.Enabled = true;
                comboBox3.Enabled = true;
                comboBox4.Enabled = true;
            }
            if (choice_fill)
            {
                int widthChosen = ShoppingCart.widthChosen;
                if (widthChosen < 62)
                {
                    comboBox6.Items.Clear();
                    comboBox6.Items.Add("none");
                }
                comboBox5.Enabled = true;
                comboBox6.Enabled = true;
                comboBox7.Enabled = true;
                comboBox8.Enabled = true;
                comboBox9.Enabled = true;
                button2.Enabled   = true;
            }
        }
コード例 #12
0
        public void Load(XmlElement items)
        {
            if (items.Name != "inventory_items")
            {
                print(items.Name);
                return;
            }

            List <ItemData> data  = new List <ItemData>();
            ItemData        temp  = new ItemData();
            XmlNodeList     nodes = items.ChildNodes;

            foreach (XmlNode item in nodes)
            {
                temp.dataID = XmlConvert.ToInt32(item.Attributes["dataID"].InnerText);
                print(temp.dataID);
                temp.id = XmlConvert.ToInt32(item.Attributes["id"].InnerText);
                print(temp.id);
                temp.itemType = EnumParse.ToItemType(item.ChildNodes[0].InnerText);
                print(temp.itemType);
                temp.picName = item.ChildNodes[1].InnerText;
                print(temp.picName);

                temp.repeatable = XmlConvert.ToBoolean(item.ChildNodes[2].InnerText.ToLower());

                if (temp.repeatable)
                {
                    temp.num    = XmlConvert.ToInt32(item.ChildNodes[3].InnerText);
                    temp.maxSum = XmlConvert.ToInt32(item.ChildNodes[4].InnerText);
                }
                else
                {
                    if (temp.itemType == ItemType.Equipment)
                    {
                        temp.level         = EnumParse.ToItemLevel(item.ChildNodes[3].InnerText);
                        temp.equipmentType = EnumParse.ToEquipmentType(item.ChildNodes[4].InnerText);
                    }
                }
                data.Add(temp);
            }

            Load(data);
        }
コード例 #13
0
        public void LoadStoreData(ProductionsLoadObject data, MonoBehaviour monoBehaviour)
        {
            _monoBehaviour = monoBehaviour;
            Production.InitCells(data.count);

            foreach (var prodObj in data.production)
            {
                //TODO сделать билдер для продакшн объекта
                var production = new ProductionObject
                {
                    Key     = prodObj.key,
                    Quality = EnumParse.ParseStringToEnum <ItemQuality>(prodObj.quality),
                    Index   = prodObj.index,
                    TimeEnd = prodObj.timeEnd,
                    IsLoad  = true
                };

                StartProduction(production);
            }
        }
コード例 #14
0
        public static Languages[] GetAvailableLanguages()
        {
            if (avariableLanguages == null)
            {
                List <Languages> listAvariableLang = new List <Languages>();
                Languages        selectedLanguage;
#if UNITY_ANDROID || UNITY_IOS
                TextAsset[] languageFiles = Resources.LoadAll <TextAsset>(resourceLanguagesFiles);
                int         ilang         = languageFiles.Length;
                for (int i = 0; i < ilang; i++)
                {
                    if (EnumParse.TryParseEnum <Languages>(Path.GetFileNameWithoutExtension(languageFiles[i].name), out selectedLanguage))
                    {
                        listAvariableLang.Add(selectedLanguage);
                    }
                }
                listAvariableLang.Sort();
                avariableLanguages = listAvariableLang.ToArray();
#else
                string[] languageFiles = Directory.GetFiles(GetPoPath());
                int      ilang         = languageFiles.Length;
                for (int i = 0; i < ilang; i++)
                {
                    if (Path.GetExtension(languageFiles[i]) != ".po")
                    {
                        continue;
                    }
                    if (EnumParse.TryParseEnum <Languages>(Path.GetFileNameWithoutExtension(languageFiles[i]), out selectedLanguage))
                    {
                        listAvariableLang.Add(selectedLanguage);
                    }
                }
                listAvariableLang.Sort();
                avariableLanguages = listAvariableLang.ToArray();
#endif
            }
            return(avariableLanguages);
        }
コード例 #15
0
        /// <summary>
        /// Handles the Click event of the saveButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void saveButton_Click(object sender, EventArgs e)
        {
            GallerySettings settings = new GallerySettings();

            try
            {
                settings.GalleryTitle = galleryTitle.Text.Trim();

                //set thumbnail height and Width
                settings.ThumbnailDimensions.Height = Convert.ToInt32(thumbnailHeight.Text.Trim());
                settings.ThumbnailDimensions.Width  = Convert.ToInt32(thumbnailWidth.Text.Trim());

                //Set method of storage
                settings.DataStorage = EnumParse <DataStorage> .Parse(storageSelection.SelectedValue);

                //Set presentation mode
                settings.PresentationMode = EnumParse <PresentationMode> .Parse(presentationModeRadioButtonList.SelectedItem.Text);

                //Set current theme
                settings.Theme = themeDropdown.SelectedValue;

                //set fullsize height and Width
                settings.FullsizeDimensions.Height = Convert.ToInt32(fullsizeHeight.Text.Trim());
                settings.FullsizeDimensions.Width  = Convert.ToInt32(fullsizeWidth.Text.Trim());

                //Sets the crossdomain file to the correct hosts.
                SaveCrossDomainXml();

                settings.Save();
                message.Text = AdminResources.SettingsSaved;
            }
            catch (Exception ex)
            {
                message.Text = ex.Message;
            }
        }
コード例 #16
0
 ///<summary>
 ///</summary>
 ///<param name="zeroRate"></param>
 ///<param name="yearFraction"></param>
 ///<param name="compoundingFrequency"></param>
 ///<returns></returns>
 ///<exception cref="NotImplementedException"></exception>
 public static double ZeroRateToDiscountFactor(double zeroRate, double yearFraction, string compoundingFrequency)
 {
     return(ZeroRateToDiscountFactor(zeroRate, yearFraction, EnumParse.ToCompoundingFrequencyEnum(compoundingFrequency)));
 }
コード例 #17
0
 /// <summary>
 /// Converts from the zero rate to a terminal wealth.
 /// </summary>
 /// <param name="rate"></param>
 /// <param name="yearFraction"></param>
 /// <param name="compoundingFrequency"></param>
 /// <returns></returns>
 public static decimal TerminalWealthFromZeroRate(decimal rate, decimal yearFraction,
                                                  string compoundingFrequency)
 {
     return(TerminalWealthFromZeroRate(rate, yearFraction,
                                       EnumParse.ToCompoundingFrequencyEnum(compoundingFrequency)));
 }
コード例 #18
0
 /// <summary>
 /// Anns the yield.
 /// </summary>
 /// <param name="baseDate">The base date.</param>
 /// <param name="targetDate">The target date.</param>
 /// <param name="divCurve">The div curve.</param>
 /// <param name="ratetimes">The rate times.</param>
 /// <param name="rateamts">The rate amounts.</param>
 /// <param name="im">the im?</param>
 /// <param name="cf">The cf?</param>
 /// <returns></returns>
 public static double GetPVDivs(DateTime baseDate, DateTime targetDate, DiscreteCurve divCurve, double[] ratetimes, double[] rateamts, string im, string cf)
 {
     return(GetPVDivs(baseDate, targetDate, divCurve, ratetimes, rateamts, im,
                      EnumParse.ToCompoundingFrequencyEnum(cf)));
 }
コード例 #19
0
ファイル: User_Interface.cs プロジェクト: titimar16/KitBox
        private void button2_Click(object sender, EventArgs e)
        {
            int width          = ShoppingCart.widthChosen;
            int depth          = ShoppingCart.depthChosen;
            int numberOfLocker = ShoppingCart.boxNumberChosen;

            //TODO check if cups are checked
            // check that the object fields are filled
            if (comboBox5.SelectedItem != null && comboBox6.SelectedItem != null && comboBox7.SelectedItem != null)
            {
                int    height     = Int32.Parse(comboBox5.SelectedItem.ToString());
                string doorsColor = comboBox6.SelectedItem.ToString();
                string panelColor = comboBox7.SelectedItem.ToString();
                int    doorWidth  = 0;
                bool   doorCup    = false;
                if (doorsColor != "none")
                {
                    if (width >= 62)
                    {
                        if (width == 62)
                        {
                            doorWidth = 31;
                        }
                        else
                        {
                            doorWidth = width / 2 + 2;
                        }
                    }
                    if (doorsColor != "Glass" && comboBox9.SelectedItem != null)
                    {
                        if (comboBox9.SelectedItem.ToString() == "yes")
                        {
                            doorCup = true;
                        }
                    }
                }

                Locker locker = new Locker();

                CatalogueDB cb = new CatalogueDB();

                Cleat cleat1 = (Cleat)cb.createComponents(height, 0, 0, "Cleat");
                if (doorsColor != "none")
                {
                    Door door1 = (Door)cb.createComponents(height, doorWidth, 0, EnumParse.parseColorStrToEnum(doorsColor), doorCup, "Door");
                    locker.addComponent(new List <CatalogueComponents>()
                    {
                        door1, door1
                    });
                }
                Panels panelsHL = (Panels)cb.createComponents(0, width, depth, EnumParse.parseColorStrToEnum(panelColor), PanelsType.HL, "Panel");
                Panels panelsLR = (Panels)cb.createComponents(height, 0, depth, EnumParse.parseColorStrToEnum(panelColor), PanelsType.LR, "Panel");
                Panels panelsB  = (Panels)cb.createComponents(height, width, 0, EnumParse.parseColorStrToEnum(panelColor), PanelsType.B, "Panel");

                CrossBar crossBarF  = (CrossBar)cb.createComponents(0, width, 0, CrossBarType.F, "CrossBar");
                CrossBar crossBarB  = (CrossBar)cb.createComponents(0, width, 0, CrossBarType.B, "CrossBar");
                CrossBar crossBarLR = (CrossBar)cb.createComponents(0, 0, depth, CrossBarType.LR, "CrossBar");



                // numéro du casier sur lequel on travail
                int currentbox = locker.ID;


                locker.panelColor = EnumParse.parseColorStrToEnum(panelColor);
                locker.height     = height;
                locker.depth      = depth;
                locker.width      = width;
                if (doorsColor != "none")
                {
                    locker.doorsColor = EnumParse.parseColorStrToEnum(doorsColor);
                }



                locker.addComponent(new List <CatalogueComponents>()
                {
                    cleat1, cleat1, cleat1, cleat1,
                    panelsHL, panelsHL, panelsLR, panelsLR, panelsB,
                    crossBarF, crossBarF, crossBarB, crossBarB,
                    crossBarLR, crossBarLR, crossBarLR, crossBarLR
                });

                ShoppingCart.addCupboardComponent(locker);

                //premier essai de calcul de prix
                double prixTotal = locker.price;


                // met dans le order preview
                dataGridView1.Rows.Add(currentbox, height, doorsColor, doorCup, panelColor, prixTotal.ToString());

                //TODO remplacer total height par la somme des hauteurs
                int totalHeight = Int32.Parse(textBox12.Text);
                totalHeight   += height + 4;
                textBox12.Text = totalHeight.ToString();
                if (currentbox == numberOfLocker)
                {
                    button2.Enabled = false;
                }
                else
                {
                    currentbox++;
                    textBox8.Text = currentbox.ToString();
                }

                //TODO remplacer cupboardPrice par var globale
                double cupboardPrice = Double.Parse(textBox16.Text);
                textBox16.Text = (cupboardPrice + prixTotal).ToString();

                /*
                 * height choices gestion
                 */
                int           maxHeight    = Int32.Parse(textBox14.Text);
                List <string> choiceRemove = new List <string>();
                foreach (string heightChoice in comboBox5.Items)
                {
                    int boxHeight = Int32.Parse(heightChoice);
                    if (maxHeight - boxHeight - 4 < totalHeight)
                    {
                        choiceRemove.Add(heightChoice);
                    }
                }
                foreach (string heightChoice in choiceRemove)
                {
                    comboBox5.Items.Remove(heightChoice);
                }
            }
            else
            {
                MessageBox.Show("Fill every choices");
            }
            if (!button2.Enabled)
            {
                button3.Visible = true;
                button3.Enabled = true;
                button5.Visible = true;
                button5.Enabled = true;
            }
        }
コード例 #20
0
 public void getPriceOnDoorTest()
 {
     door1       = new Door();
     door1.price = catalogueDB.getPrice(42, 52, 0, EnumParse.parseColorEnumToStr(ComponentColor.brown), "Door");
     Assert.AreEqual(10.92, door1.price);
 }
コード例 #21
0
            public GameRunner(List <TileComponent> tileComponents, int numberOfPlayers, int difficutly = 3)
            {
                var structureManager = new StructureManager(); // initializing structure manager to set min id's for structures to 10

                this.PlayerManager = new PlayerManager(numberOfPlayers);

                this.AI = new AI(difficulty: difficutly, gameRunner: this, meepleColor: EnumParse <MeepleColor> .IntToEnum(numberOfPlayers));
                // initializes AI player, as the last player with the last color, and speciffied difficulty

                System.Console.WriteLine("GameRunner start");
                this.GameBoard     = new GameBoard();
                this.UnplayedTiles = new List <Tile>();

                var tileComponentsArray = tileComponents.ToArray();
                var shuffler            = new Utils <TileComponent>();
                var randomWithSeed      = new Random();

                this.Random = randomWithSeed;

                shuffler.Shuffle(randomWithSeed, tileComponentsArray);
                tileComponents = tileComponentsArray.ToList();

                //tileComponents = tileComponents.OrderBy(i => Guid.NewGuid()).ToList(); // random is not the same for each session
                foreach (var tileComponent in tileComponents)
                {
                    this.UnplayedTiles.Add(new Tile(GameBoard, tileComponent, (-1, -1)));
                }
            }
コード例 #22
0
 public void ENumfromAStringTest()
 {
     AreEqual(Test.one, EnumParse.ParseEnum <Test>("one"));
 }
コード例 #23
0
        public void ENumfromAIntegerEmptyReturnTest()
        {
            string str = EnumParse.ParseEnum <Test>(20);

            IsTrue(str.IsEmpty());
        }
コード例 #24
0
        public void ENumfromAIntegerTest()
        {
            string str = EnumParse.ParseEnum <Test>(2);

            IsTrue(str.Match("two"));
        }
コード例 #25
0
ファイル: User_Interface.cs プロジェクト: titimar16/KitBox
        private void button4_Click(object sender, EventArgs e)
        {
            //assign currentLocker
            if (ShoppingCart.currentLocker == 0)
            {
                ShoppingCart.currentLocker = ShoppingCart.cupboardComponentsList.Count;
            }

            //get former and cupboard values
            int    width         = ShoppingCart.getLockerByID(ShoppingCart.currentLocker).width;
            int    formerHeight  = Int32.Parse(dataGridView1[1, ShoppingCart.currentLocker - 1].Value.ToString());
            int    totalHeight   = Int32.Parse(textBox12.Text);
            int    maxHeight     = Int32.Parse(textBox14.Text);
            double formerPrice   = Double.Parse(dataGridView1[5, ShoppingCart.currentLocker - 1].Value.ToString());
            double cupboardPrice = Double.Parse(textBox16.Text);

            //verify every box filled
            if (comboBox5.SelectedItem != null && comboBox6.SelectedItem != null && comboBox7.SelectedItem != null)
            {
                //get new values
                int    height     = Int32.Parse(comboBox5.SelectedItem.ToString());
                string doorsColor = comboBox6.SelectedItem.ToString();
                string panelColor = comboBox7.SelectedItem.ToString();
                bool   doorCup    = false;

                //assign doorcup
                if (doorsColor != "Glass" && doorsColor != "none")
                {
                    //TODO check if combobox9 filled
                    if (comboBox9.SelectedItem.ToString() == "yes")
                    {
                        doorCup = true;
                    }
                }

                //compute totalHeight and verify max height not reached
                if (totalHeight - formerHeight - 4 + height < maxHeight)
                {
                    //save changes
                    totalHeight   -= formerHeight;
                    totalHeight   += height;
                    textBox12.Text = totalHeight.ToString();

                    //save locker new variables
                    ShoppingCart.getLockerByID(ShoppingCart.currentLocker).height     = height;
                    ShoppingCart.getLockerByID(ShoppingCart.currentLocker).panelColor = EnumParse.parseColorStrToEnum(panelColor);
                    ShoppingCart.getLockerByID(ShoppingCart.currentLocker).setCupOfDoor(doorCup);
                    if (doorsColor != "none")
                    {
                        ShoppingCart.getLockerByID(ShoppingCart.currentLocker).doorsColor = EnumParse.parseColorStrToEnum(doorsColor);
                    }

                    /*
                     * if doorsColor were none then add new doors
                     * if doorsColor were not none then new doors not added (locker definition)
                     */
                    CatalogueDB catalogueDB = new CatalogueDB();
                    int         doorWidth   = 0;
                    if (width >= 62)
                    {
                        if (width == 62)
                        {
                            doorWidth = 31;
                        }
                        else
                        {
                            doorWidth = width / 2 + 2;
                        }
                    }
                    Door door1 = (Door)catalogueDB.createComponents(height, doorWidth, 0, EnumParse.parseColorStrToEnum(doorsColor), doorCup, "Door");
                    ShoppingCart.getLockerByID(ShoppingCart.currentLocker).addComponent(new List <CatalogueComponents>()
                    {
                        door1, door1
                    });


                    //compute newPrice
                    foreach (CatalogueComponents compo in ShoppingCart.getLockerByID(ShoppingCart.currentLocker).componentsList)
                    {
                        compo.price = catalogueDB.newPrice(height, doorsColor, panelColor, compo);
                    }
                    double newPrice = ShoppingCart.getLockerByID(ShoppingCart.currentLocker).price;

                    //display new informations
                    dataGridView1.Rows[ShoppingCart.currentLocker - 1].SetValues(ShoppingCart.currentLocker, height, doorsColor, doorCup, panelColor, newPrice);

                    //TODO mettre yes no plutôt que true false dans l'afficheur

                    //display total lockers price
                    cupboardPrice -= formerPrice;
                    cupboardPrice += newPrice;
                    textBox16.Text = cupboardPrice.ToString();
                }
                else
                {
                    MessageBox.Show("Maximal height reached");
                }
            }
            else
            {
                MessageBox.Show("Fill every choices");
            }
        }
コード例 #26
0
        public void GetDefaultStringPositiveTest()
        {
            string result = EnumParse.GetDescription(Statuses.Queued);

            IsTrue(result.Match("Queued"));
        }
コード例 #27
0
        /// <summary>
        /// Parses the specified day counter as string.
        /// </summary>
        /// <param name="dayCounterAsString">The day counter as string.</param>
        /// <returns></returns>
        public static IDayCounter Parse(string dayCounterAsString)
        {
            DayCountFractionEnum dayCountFractionEnum = EnumParse.ToDayCountFractionEnum(dayCounterAsString);

            return(ToDayCounter(dayCountFractionEnum));
        }
コード例 #28
0
 public void LoadSettingsData(SettingsLoadObject data)
 {
     Language = EnumParse.ParseStringToEnum <LanguageType>(data.language);
     Graphics = EnumParse.ParseStringToEnum <GraphicsType>(data.graphics);
 }
コード例 #29
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public CompoundingFrequencyEnum ToEnum()
 {
     return(EnumParse.ToCompoundingFrequencyEnum(Value));
 }
コード例 #30
0
        public void GetDescriptionStringPositiveTest()
        {
            string result = EnumParse.GetDescription(Statuses.MarkForDeleted);

            IsTrue(result.Match("Marked for Deletion"));
        }