Пример #1
0
        public static bool VerifyMaterialType <T>(MaterialTypes materialType)
        {
            string typeName = typeof(T).Name;
            string enumName = materialType.ToString();

            return(typeName.Equals(enumName));
        }
        public DisplayQuote(string custName, int width, int depth, int drawerCount, MaterialTypes materialsType, int orderDays, int totalCost)
        {
            InitializeComponent();

            // values will be displayed inside respective text boxes
            displayQuoteCustomer.Text    = custName;
            displayQuoteWidth.Text       = width.ToString();
            displayQuoteDepth.Text       = depth.ToString();
            displayQuoteDrawerCount.Text = drawerCount.ToString();
            displayQuoteMaterial.Text    = materialsType.ToString();
            displayQuoteTotal.Text       = totalCost.ToString();
        }
        /// <summary>
        /// 가격 조회(달러/트로이온스)
        /// </summary>
        /// <param name="materialType"></param>
        /// <returns></returns>
        public MaterialItem GetByType(MaterialTypes materialType)
        {
            MaterialItem result = new MaterialItem();
            decimal      price  = GetMaterailByCache(materialType);

            if (price == 0)
            {
                price = GetMaterailByHTML(materialType);
                SetMaterailCache(materialType, price);
            }

            result.Name  = materialType.ToString();
            result.Price = price;

            return(result);
        }
Пример #4
0
    private void getRunTimeEditsInfo()
    {
        infoMaterialType = SelectedMaterialType.ToString();

        if (SelectedMaterialType == MaterialTypes.Solid)
        {
            infoSubType = selectedSolidsMaterial.ToString();
        }
        else if (SelectedMaterialType == MaterialTypes.Liquids)
        {
            infoSubType = selectedLiquidsMaterial.ToString();
        }
        else
        {
            infoSubType = selectedGasesMaterial.ToString();
        }

        CalculatedDensity = density.ToString();;
        CalculatedMass    = mass.ToString();
        CalculatedVolume  = volume.ToString();
    }
        /// <summary>
        /// 캐시에서 가격 가져오기
        /// </summary>
        /// <param name="materialType"></param>
        /// <returns></returns>
        private decimal GetMaterailByCache(MaterialTypes materialType)
        {
            string key = "MaterialTypes/" + materialType.ToString();

            return(cache.GetCache(key));
        }
        /// <summary>
        /// 캐시에 가격 기록
        /// </summary>
        /// <param name="materialType"></param>
        /// <param name="val"></param>
        private void SetMaterailCache(MaterialTypes materialType, decimal val)
        {
            string key = "MaterialTypes/" + materialType.ToString();

            cache.Set(key, val);
        }