Пример #1
0
        public int Print(TimeSpan timeout, out string value)
        {
            double WeightValue;

            this.Print(timeout, 5, out WeightValue);
            value = WeightValue.ToString();
            return(0);
        }
Пример #2
0
 private void _clear()
 {
     HeightValue.Clear();
     WeightValue.Clear();
     lastFocused.Clear();
     BMI_Value.Clear();
     BMI_Value.BackColor = Color.White;
     progressBar2.Value  = 0;
     label2.Text         = "BODY TYPE";
     label2.BackColor    = Color.Gainsboro;
 }
Пример #3
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(Name != null ? Name.ToStepValue() : "$");
            parameters.Add(Description != null ? Description.ToStepValue() : "$");
            parameters.Add(Unit != null ? Unit.ToStepValue() : "$");
            parameters.Add(WeightValue != null ? WeightValue.ToStepValue() : "$");
            parameters.Add(Formula != null ? Formula.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
Пример #4
0
        private static List <WeightValue> ReadWeightLine(string[] lineToRead)
        {
            /*
             * Logger.Log("Reading Weight Line:");
             * foreach(string stringFromLine in lineToRead)
             * {
             *  Logger.Log("   " + stringFromLine);
             * }
             */
            List <WeightValue> weightRead = new List <WeightValue>();
            WeightValue        weight;

            for (int weightIndex = 1; weightIndex < lineToRead.Length; weightIndex += 2)
            {
                weight       = new WeightValue();
                weight.Value = int.Parse(lineToRead[weightIndex]);

                // weightIndex 1 will be our first date so don't check for intermediate date before
                if (weightIndex != 1)
                {
                    if (lineToRead[weightIndex - 1] != "")
                    {
                        if (lineToRead[weightIndex - 1].StartsWith("Jump:"))
                        {
                            weight.StartIsJumpValue = true;
                        }
                        weight.StartDate = DateTime.Parse(lineToRead[weightIndex - 1].TrimStart('J', 'u', 'm', 'p', ':'));
                        weight.HasStart  = true;
                    }
                }

                if (weightIndex != lineToRead.Length - 1)
                {
                    if (lineToRead[weightIndex + 1] != "")
                    {
                        if (lineToRead[weightIndex + 1].StartsWith("Jump:"))
                        {
                            weight.StopIsJumpValue = true;
                        }
                        weight.StopDate = DateTime.Parse(lineToRead[weightIndex + 1].TrimStart('J', 'u', 'm', 'p', ':'));
                        weight.HasStop  = true;
                    }
                }

                weightRead.Add(weight);
            }

            return(weightRead);
        }
        private void RefreshPage(IEnumerable <Weight> weights)
        {
            List <Weight> weightList  = weights.ToList();
            WeightValue   weightValue = weightList.FirstOrDefault()?.Value;

            if (weightValue != null)
            {
                double pounds = weightValue.Kilograms * KgToLbsFactor;
                LastWeightValue = pounds.ToString("N0");
                LastWeightUnit  = "lbs";
            }
            else
            {
                LastWeightValue = string.Empty;
                LastWeightUnit  = string.Empty;
            }

            HistoricWeightValues = weightList.Skip(1).Select(w => new WeightViewRow(w)).ToList();
        }
        /// <summary>
        /// Populates this <see cref="BodyCompositionValue"/> instance from the data in the XML. 
        /// </summary>
        /// 
        /// <param name="navigator">
        /// The XML to get the body composition value data from.
        /// </param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> is <b> null </b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // mass-value (t:weigth-value)
            _massValue = XPathHelper.GetOptNavValue<WeightValue>(navigator, "mass-value");

            // percent-value (t:percentage)
            XPathNavigator percentValueNav = navigator.SelectSingleNode("percent-value");
            if (percentValueNav != null)
            {
                _percentValue = percentValueNav.ValueAsDouble;
            }
        }
        /// <summary>
        /// Populates this <see cref="WeightGoal"/> instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the weight goal data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a weight-goal node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator weightGoalNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("weight-goal");

            Validator.ThrowInvalidIfNull(weightGoalNav, "WeightGoalUnexpectedNode");

            XPathNavigator initialNav =
                weightGoalNav.SelectSingleNode("initial");

            if (initialNav != null)
            {
                _initialWeight = new WeightValue();
                _initialWeight.ParseXml(initialNav);
            }

            XPathNavigator minNav =
                weightGoalNav.SelectSingleNode("minimum");

            if (minNav != null)
            {
                _minWeight = new WeightValue();
                _minWeight.ParseXml(minNav);
            }

            XPathNavigator maxNav =
                weightGoalNav.SelectSingleNode("maximum");

            if (maxNav != null)
            {
                _maxWeight = new WeightValue();
                _maxWeight.ParseXml(maxNav);
            }

            XPathNavigator goalNav =
                weightGoalNav.SelectSingleNode("goal-info");

            if (goalNav != null)
            {
                _goal = new Goal();
                _goal.ParseXml(goalNav);
            }
        }
Пример #8
0
        /// <summary>
        /// </summary>
        /// <param name="db"/>
        /// <param name="wips"/>
        /// <param name="ctx"/>
        /// <param name="handled"/>
        /// <param name="prevReturnValue"/>
        /// <returns/>
        public IList <IHandlingBatch> EVALUATE0(Mozart.SeePlan.Simulation.DispatcherBase db, IList <Mozart.SeePlan.Simulation.IHandlingBatch> wips, Mozart.SeePlan.Simulation.IDispatchContext ctx, ref bool handled, IList <Mozart.SeePlan.Simulation.IHandlingBatch> prevReturnValue)
        {
            if (db is FifoDispatcher)
            {
                return(wips);
            }

            if (db.Comparer == null)
            {
                return(wips);
            }

            var stepDic = new Dictionary <string, WeightInfo>();

            var list = new List <IHandlingBatch>(wips.Count);

            var eqp = db.Eqp.ToFabAoEquipment();

            if (eqp.Dispatcher is WeightSumDispatcher)
            {
                db.Comparer = new CompareHelper.WeightSumComparer(eqp);
            }

            foreach (IHandlingBatch hb in wips)
            {
                if (hb.Sample == null)
                {
                    continue;
                }

                var lot = hb.Sample;

                lot.WeightInfo = new WeightInfo();
                WeightInfo lotInfo = lot.WeightInfo;
                WeightInfo stepInfo;
                if (!stepDic.TryGetValue(lot.CurrentStep.StepID, out stepInfo))
                {
                    stepDic.Add(lot.CurrentStep.StepID, stepInfo = new WeightInfo());
                }


                bool hasMinusValue = false;

                if (db.FactorList != null)
                {
                    //Logger.Info(string.Format("<< {0} EVALUATE {1} >>");
                    foreach (var info in db.FactorList)
                    {
                        WeightValue     wval   = null;
                        FabWeightFactor factor = info.Factor as FabWeightFactor;

                        if (factor.Type == FactorType.FIXED)
                        {
                            wval = lotInfo.GetValueData(factor);
                            if (wval.IsMinValue)
                            {
                                wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx);
                            }
                        }
                        else if (factor.Type == FactorType.STEPTYPE)
                        {
                            wval = stepInfo.GetValueData(factor);
                            if (wval.IsMinValue)
                            {
                                wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx);
                            }

                            stepInfo.SetValueData(factor, wval);
                        }
                        else                         //LOTTYPE
                        {
                            wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx);

                            //Factor가 하나라도 음수를 가질 경우 해당 재공은 제외 (필터를 허용할 경우)
                            if (wval.Value < 0)
                            {
                                wval = new WeightValue(factor, 0, wval.Description);

                                if (factor.IsAllowFilter)
                                {
                                    lotInfo.SetValueData(factor, wval);
                                    hasMinusValue = true;

                                    db.Eqp.EqpDispatchInfo.AddFilteredWipInfo(hb, string.Format("Minus_Value:{0}, Desc:{1}", factor.Name, wval.Description));
                                }
                            }
                        }

                        lotInfo.SetValueData(factor, wval);
                    }
                }

                if (hasMinusValue == false)
                {
                    list.AddSort(hb, db.Comparer);
                }
            }

            return(list);
        }
Пример #9
0
        /// <summary>
        /// Populates the data from the specified XML.
        /// </summary>
        /// 
        /// <param name="navigator">
        /// The XML containing the baby information.
        /// </param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        /// 
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _name = XPathHelper.GetOptNavValue<Name>(navigator, "name");
            _gender = XPathHelper.GetOptNavValue<CodableValue>(navigator, "gender");
            _weight = XPathHelper.GetOptNavValue<WeightValue>(navigator, "weight");
            _length = XPathHelper.GetOptNavValue<Length>(navigator, "length");
            _head = XPathHelper.GetOptNavValue<Length>(navigator, "head-circumference");
            _note = XPathHelper.GetOptNavValue(navigator, "note");
        }
        private static void AppendWeightValue(StringBuilder result, WeightValue value, string labelStringId)
        {
            string unitsString = String.Empty;
            string valueString;

            if (value.DisplayValue != null)
            {
                valueString = value.DisplayValue.ToString();
            }
            else
            {
                valueString = (value.Value * 1000).ToString(CultureInfo.InvariantCulture);
                unitsString = ResourceRetriever.GetResourceString(
                                    "DietaryDailyIntakeToStringUnitGrams");
            }

            result.AppendFormat(
                ResourceRetriever.GetResourceString(labelStringId),
                valueString,
                unitsString);
        }
        /// <summary>
        /// Populates this <see cref="DietaryDailyIntake"/> instance from the 
        /// data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the dietary intake data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a <see cref="DietaryDailyIntake"/> node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator intakeNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode(
                    "dietary-intake-daily");

            Validator.ThrowInvalidIfNull(intakeNav, "DietaryDailyIntakeUnexpectedNode");

            _when = new HealthServiceDate();
            _when.ParseXml(intakeNav.SelectSingleNode("when"));

            XPathNavigator caloriesNav =
                intakeNav.SelectSingleNode("calories");

            if (caloriesNav != null)
            {
                _calories = caloriesNav.ValueAsInt;
            }

            XPathNavigator totalFatNav =
                intakeNav.SelectSingleNode("total-fat");

            if (totalFatNav != null)
            {
                _totalFat = new WeightValue();
                _totalFat.ParseXml(totalFatNav);
            }

            XPathNavigator satFatNav =
                intakeNav.SelectSingleNode("saturated-fat");

            if (satFatNav != null)
            {
                _saturatedFat = new WeightValue();
                _saturatedFat.ParseXml(satFatNav);
            }

            XPathNavigator transFatNav =
                intakeNav.SelectSingleNode("trans-fat");

            if (transFatNav != null)
            {
                _transFat = new WeightValue();
                _transFat.ParseXml(transFatNav);
            }

            XPathNavigator proteinNav =
                intakeNav.SelectSingleNode("protein");

            if (proteinNav != null)
            {
                _protein = new WeightValue();
                _protein.ParseXml(proteinNav);
            }

            XPathNavigator totalCarbsNav =
                intakeNav.SelectSingleNode("total-carbohydrates");

            if (totalCarbsNav != null)
            {
                _totalCarbs = new WeightValue();
                _totalCarbs.ParseXml(totalCarbsNav);
            }

            XPathNavigator fiberNav =
                intakeNav.SelectSingleNode("dietary-fiber");

            if (fiberNav != null)
            {
                _fiber = new WeightValue();
                _fiber.ParseXml(fiberNav);
            }

            XPathNavigator sugarsNav =
                intakeNav.SelectSingleNode("sugars");

            if (sugarsNav != null)
            {
                _sugars = new WeightValue();
                _sugars.ParseXml(sugarsNav);
            }

            XPathNavigator sodiumNav =
                intakeNav.SelectSingleNode("sodium");

            if (sodiumNav != null)
            {
                _sodium = new WeightValue();
                _sodium.ParseXml(sodiumNav);
            }

            XPathNavigator cholesterolNav =
                intakeNav.SelectSingleNode("cholesterol");

            if (cholesterolNav != null)
            {
                _cholesterol = new WeightValue();
                _cholesterol.ParseXml(cholesterolNav);
            }
        }
Пример #12
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet <int> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("WeightValue", WeightValue.ToString());
     setAttribute(xml, "Formula", Formula);
 }
Пример #13
0
 /// <summary>
 /// Creates a new instance of the <see cref="Weight"/> class with the 
 /// specified date/time and weight.
 /// </summary>
 /// 
 /// <param name="when">
 /// The date/time when the weight measurement occurred.
 /// </param>
 /// 
 /// <param name="weight">
 /// The person's weight.
 /// </param>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="when"/> or <paramref name="weight"/> parameter is <b>null</b>.
 /// </exception>
 /// 
 public Weight(HealthServiceDateTime when, WeightValue weight)
     : base(TypeId)
 {
     this.When = when;
     this.Value = weight;
 }
Пример #14
0
        /// <summary>
        /// Populates this <see cref="Weight"/> instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the weight data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a weight node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator weightNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("weight");

            Validator.ThrowInvalidIfNull(weightNav, "WeightUnexpectedNode");

            _when = new HealthServiceDateTime();
            _when.ParseXml(weightNav.SelectSingleNode("when"));

            _value = new WeightValue();
            _value.ParseXml(weightNav.SelectSingleNode("value"));
        }