private void checkCriteria(int itemID)
        {
            DateCriteria dateCriteria = DateCriteria.GetDateCriteria(itemID);

            if (dateCriteria != null)
            {
                expireLabel.Text = "Expiry Date: " + dateCriteria.ExpiryDate.ToShortDateString() + "\n";
            }
            TemperatureCriteria tempCriteria = TemperatureCriteria.GetTemperatureCriteria(itemID);

            if (tempCriteria != null)
            {
                expireLabel.Text += "Best Temp: from " + tempCriteria.MinTemperature + "Cْ  to  " + tempCriteria.MaxTemperature + "Cْ";
            }
        }
Beispiel #2
0
        private void checkCriteria(int itemID)
        {
            string       toolTipText  = "";
            DateCriteria dateCriteria = DateCriteria.GetDateCriteria(itemID);

            if (dateCriteria != null)
            {
                expireLabel.Text = "Expiry Date: " + dateCriteria.ExpiryDate.ToShortDateString() + "\n";
                TimeSpan time = dateCriteria.ExpiryDate - DateTime.Now;
                if (time.Days > 0 && time.Days < 8)
                {
                    itemToolTip.ToolTipIcon = ToolTipIcon.Warning;
                    toolTipText             = "Expiry Date after " + (time.Days).ToString() + " day(s).";
                }
                else if (time.Days < 0)
                {
                    itemToolTip.ToolTipIcon = ToolTipIcon.Error;
                    toolTipText             = "Item has been expired" + (time.Days).ToString() + " day(s)ago.";
                }
            }
            TemperatureCriteria tempCriteria = TemperatureCriteria.GetTemperatureCriteria(itemID);

            if (tempCriteria != null)
            {
                expireLabel.Text += "Temp: from " + tempCriteria.MinTemperature + " Cْ  to  " + tempCriteria.MaxTemperature + " Cْ ْ";
                int refTemp = Properties.Settings.Default.refrigeratorInternalTemperature;
                if (refTemp < tempCriteria.MinTemperature || refTemp > tempCriteria.MaxTemperature)
                {
                    if (toolTipText != "")
                    {
                        toolTipText += "\n";
                    }
                    if (refTemp < tempCriteria.MinTemperature)
                    {
                        toolTipText += "Temperature's too low for this item.";
                    }
                    else
                    {
                        toolTipText += "Temperature's too high for this item.";
                    }
                }
            }
            if (toolTipText != "")
            {
                itemToolTip.SetToolTip(this, toolTipText);
            }
        }