Exemple #1
0
        /// <summary>
        /// 返回品质对应的色值
        /// </summary>
        /// <returns>The quality color string.</returns>
        /// <param name="type">Type.</param>
        public static string GetQualityColorString(QualityType type)
        {
            switch (type)
            {
            case QualityType.White:
            default:
                return("#AAAAAA");

            case QualityType.Green:
                return("#52CC33");

            case QualityType.Blue:
                return("#1A94E6");

            case QualityType.Purple:
                return("#BB44BB");

            case QualityType.Gold:
                return("#DDDD22");

            case QualityType.Orange:
                return("#FF9900");

            case QualityType.Red:
                return("#EE1111");
            }
        }
Exemple #2
0
 public Weapon(int id, string name, ItemType type, QualityType qualityType, string description, int capacity, int buyPrice, int sellPrice, string sprite,
               int damage, WeaponType wpType)
     : base(id, name, type, qualityType, description, capacity, buyPrice, sellPrice, sprite)
 {
     this.Damage = damage;
     this.WpType = wpType;
 }
Exemple #3
0
        static public string ParseToString(QualityType type)
        {
            switch (type)
            {
            case QualityType.None:
                return("无阶");

            case QualityType.D:
                return("普通");

            case QualityType.C:
                return("卓越");

            case QualityType.B:
                return("稀有");

            case QualityType.A:
                return("完美");

            case QualityType.S:
                return("???");

            default:
                return("");
            }
        }
Exemple #4
0
        internal IDictionary <string, IList <Quality> > GetQualities(QualityType qualityType)
        {
            IList <Quality> list;

            switch (qualityType)
            {
            case QualityType.All:
                list = _repos.GetQualityCodes(null, null);
                break;

            case QualityType.QualityOrderByDesc:
                list = _repos.GetQualityCodes("D", null);
                break;

            case QualityType.Order:
                list = _repos.GetQualityCodes("O", null);
                break;

            case QualityType.Received:
                list = _repos.GetQualityCodes("R", null);
                break;

            default:
                throw new NotImplementedException();
            }
            return(new Dictionary <string, IList <Quality> >(1)
            {
                { "", list }
            });
        }
Exemple #5
0
        /// <summary>
        /// 装备对应品质
        /// </summary>
        /// <param name="qualityType"></param>
        /// <returns></returns>
        public static PriorityQuality UserEquPriorityQuality(QualityType qualityType)
        {
            PriorityQuality quality = new PriorityQuality();

            switch (qualityType)
            {
            case QualityType.BaiSe:
                quality = PriorityQuality.First;
                break;

            case QualityType.LanSe:
                quality = PriorityQuality.Three;
                break;

            case QualityType.ZiSe:
                quality = PriorityQuality.Four;
                break;

            case QualityType.HuangSe:
                quality = PriorityQuality.Five;
                break;

            case QualityType.HongSe:
                quality = PriorityQuality.Six;
                break;
            }
            return(quality);
        }
        /// <summary>
        /// Create a LifestyleQuality from an XmlNode.
        /// </summary>
        /// <param name="objXmlLifestyleQuality">XmlNode to create the object from.</param>
        /// <param name="objCharacter">Character object the LifestyleQuality will be added to.</param>
        /// <param name="objLifestyleQualitySource">Source of the LifestyleQuality.</param
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        public void Create(XmlNode objXmlLifestyleQuality, Lifestyle objParentLifestyle, Character objCharacter, QualitySource objLifestyleQualitySource, string strExtra = "")
        {
            _objParentLifestyle = objParentLifestyle;
            _SourceGuid         = Guid.Parse(objXmlLifestyleQuality["id"].InnerText);
            if (objXmlLifestyleQuality.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("lp", ref _intLP);
            objXmlLifestyleQuality.TryGetStringFieldQuickly("cost", ref _strCost);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("multiplier", ref _intMultiplier);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("multiplierbaseonly", ref _intBaseMultiplier);
            if (objXmlLifestyleQuality["category"] != null)
            {
                _objLifestyleQualityType = ConvertToLifestyleQualityType(objXmlLifestyleQuality["category"].InnerText);
            }
            _objLifestyleQualitySource = objLifestyleQualitySource;
            if (objXmlLifestyleQuality["print"]?.InnerText == "no")
            {
                _blnPrint = false;
            }
            if (objXmlLifestyleQuality["contributetolimit"]?.InnerText == "no")
            {
                _blnContributeToLimit = false;
            }
            objXmlLifestyleQuality.TryGetStringFieldQuickly("notes", ref _strNotes);
            objXmlLifestyleQuality.TryGetStringFieldQuickly("source", ref _strSource);
            objXmlLifestyleQuality.TryGetStringFieldQuickly("page", ref _strPage);
            string strAllowedFreeLifestyles = string.Empty;

            if (objXmlLifestyleQuality.TryGetStringFieldQuickly("allowed", ref strAllowedFreeLifestyles))
            {
                _lstAllowedFreeLifestyles = strAllowedFreeLifestyles.Split(',').ToList();
            }
            if (strExtra.Contains('('))
            {
                _strExtra = strExtra.Split('(')[1].TrimEnd(')');
            }

            // If the item grants a bonus, pass the information to the Improvement Manager.
            if (objXmlLifestyleQuality.InnerXml.Contains("<bonus>"))
            {
                if (!ImprovementManager.CreateImprovements(objCharacter, Improvement.ImprovementSource.Quality, _guiID.ToString(), objXmlLifestyleQuality["bonus"], false, 1, DisplayNameShort(GlobalOptions.Language)))
                {
                    _guiID = Guid.Empty;
                    return;
                }
                if (!string.IsNullOrEmpty(ImprovementManager.SelectedValue))
                {
                    _strExtra = ImprovementManager.SelectedValue;
                    //objNode.Text += " (" + objImprovementManager.SelectedValue + ")";
                }
            }

            // Built-In Qualities appear as grey text to show that they cannot be removed.
            if (objLifestyleQualitySource == QualitySource.BuiltIn)
            {
                Free = true;
            }
        }
Exemple #7
0
 ///<summary>Used in reporting, and only for certain types.</summary>
 public static string GetPQRIMeasureNumber(QualityType qtype)
 {
     switch(qtype) {
         case QualityType.WeightOver65:
             return "128";//"0421";
         case QualityType.Hypertension:
             return "0013";
         case QualityType.TobaccoUse:
             return "114";//"0028";
         case QualityType.InfluenzaAdult:
             return "110";//"0041";
         case QualityType.WeightChild_1_1:
             return "0024";
         case QualityType.ImmunizeChild_1:
             return "0038";
         case QualityType.Pneumonia:
             return "111";//"0043";
         case QualityType.DiabetesBloodPressure:
             return "3";//"0061";
         case QualityType.BloodPressureManage:
             return "0018";
         default:
             throw new ApplicationException("Type not found: "+qtype.ToString());
     }
 }
Exemple #8
0
        /*
         * 0 通道ID BYTE >0
        1 拍摄命令 WORD
        0 表示停止拍摄;0xFFFF 表示录像;其它表示拍
        照张数
        3 拍照间隔/录像时间 WORD 秒,0 表示按最小间隔拍照或一直录像
        5 保存标志 BYTE
        1:保存;
        0:实时上传
        6 分辨率a BYTE
        0x01:320*240;
        0x02:640*480;
        0x03:800*600;
        0x04:1024*768;
        0x05:176*144;[Qcif];
        0x06:352*288;[Cif];
        0x07:704*288;[HALF D1];
        0x08:704*576;[D1];
        7 图像/视频质量 BYTE 1-10,1 代表质量损失最小,10 表示压缩比最大
        8 亮度 BYTE 0-255
        9 对比度 BYTE 0-127
        10 饱和度 BYTE 0-127
        11 色度 BYTE 0-255
         *
         * */
        /// <summary>
        /// 中心抓拍图片
        /// </summary>
        /// <param name="ordinal"></param>
        /// <param name="size"></param>
        /// <param name="quality"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public override byte[] Capture(uint ordinal, SizeType size, QualityType quality, byte count)
        {
            var mes = Message.Create(0x8801, this.terminalid + "", 0, null);
            var ms = new MemoryStream();
            BitWriter bw = new BitWriter(ms);
            bw.Write((byte)1);//通道一
            bw.Write((UInt16)count);//拍一张
            bw.Write((UInt16)0);//拍照间隔
            bw.Write((byte)0);//0实时上传 1保存
            byte pixel = 0x01;
            switch (size) //分辨率 图片大小
            {
                case SizeType.Big: pixel = 0x04; break;   //
                case SizeType.Normal: pixel = 0x08; break; //
                case SizeType.Small: pixel = 0x01; break;  //
            }
            bw.Write(pixel);//分辨率

            byte level = 1;
            switch (quality) //图片质量
            {
                case QualityType.Height: level = 1; break;
                case QualityType.Normal: level = 5; break;
                case QualityType.Low: level = 10; break;
            }
            bw.Write(level);//图片质量
            bw.Write((byte)127);//亮度
            bw.Write((byte)64);//对比度
            bw.Write((byte)64);//饱和度
            bw.Write((byte)127);//色度
            mes.BodyBytes = ms.ToArray();
            return mes.ToBytes();
        }
Exemple #9
0
 public PassengerCar(double weightNative, string name, int allSeatsNumber, int occupiedSeatsNumber, QualityType quality)
 {
     WeightNative        = weightNative;
     AllSeatsNumber      = allSeatsNumber;
     OccupiedSeatsNumber = occupiedSeatsNumber;
     Quality             = quality;
     Name = name;
 }
 /// <summary>
 /// Simple constructor
 /// </summary>
 private Configuration()
 {
     _playbackQualityMode    = VIDEOENCODER_BITRATE_MODE.ConstantBitRate;
     _recordQualityMode      = VIDEOENCODER_BITRATE_MODE.ConstantBitRate;
     _playbackQualityType    = QualityType.Default;
     _recordQualityType      = QualityType.Default;
     _customQualityValue     = 50;
     _customPeakQualityValue = 75;
 }
 /// <summary>
 /// Simple constructor
 /// </summary>
 private Configuration()
 {
   _playbackQualityMode = VIDEOENCODER_BITRATE_MODE.ConstantBitRate;
   _recordQualityMode = VIDEOENCODER_BITRATE_MODE.ConstantBitRate;
   _playbackQualityType = QualityType.Default;
   _recordQualityType = QualityType.Default;
   _customQualityValue = 50;
   _customPeakQualityValue = 75;
 }
Exemple #12
0
 public Equipment(int id, string name, ItemType type, QualityType qualityType, string description, int capacity, int buyPrice, int sellPrice, string sprite,
                  int strength, int intelligent, int agility, int stamina, EquipmentType equipType)
     : base(id, name, type, qualityType, description, capacity, buyPrice, sellPrice, sprite)
 {
     this.Strength    = strength;
     this.Intelligent = intelligent;
     this.Agility     = agility;
     this.Stamina     = stamina;
     this.EquipType   = equipType;
 }
Exemple #13
0
        public override void OnSingleClick(Mobile from)
        {
            LabelTo(from, SoilItemName);
            LabelTo(from, "(" + QualityType.ToString().ToLower() + " quality soil enhancer)");

            if (MaxCharges > 1)
            {
                LabelTo(from, "[" + Charges.ToString() + " charges remaining]");
            }
        }
Exemple #14
0
 static public QualityType GetNextQuality(QualityType type)
 {
     if (type != QualityType.Z)
     {
         return(++type);
     }
     else
     {
         return(type);
     }
 }
Exemple #15
0
 public void SetDistance(QualityType type)
 {
     foreach (var distanceByQuality in DisableAnimalDistance)
     {
         if (distanceByQuality.Type == type)
         {
             HideAnimalDistance = distanceByQuality.Distance;
             break;
         }
     }
 }
        /// <summary>
        /// Load the CharacterAttribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode, Lifestyle objParentLifestyle)
        {
            ParentLifestyle = objParentLifestyle;
            objNode.TryGetField("guid", Guid.TryParse, out _guiID);
            if (objNode.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            if (!objNode.TryGetField("id", Guid.TryParse, out _SourceGuid))
            {
                MyXmlNode?.TryGetField("id", Guid.TryParse, out _SourceGuid);
            }
            objNode.TryGetStringFieldQuickly("extra", ref _strExtra);
            objNode.TryGetInt32FieldQuickly("lp", ref _intLP);
            objNode.TryGetStringFieldQuickly("cost", ref _strCost);
            objNode.TryGetInt32FieldQuickly("multiplier", ref _intMultiplier);
            objNode.TryGetInt32FieldQuickly("basemultiplier", ref _intBaseMultiplier);
            objNode.TryGetBoolFieldQuickly("contributetolimit", ref _blnContributeToLimit);
            objNode.TryGetBoolFieldQuickly("print", ref _blnPrint);
            if (objNode["lifestylequalitytype"] != null)
            {
                _objLifestyleQualityType = ConvertToLifestyleQualityType(objNode["lifestylequalitytype"].InnerText);
            }
#if DEBUG
            if (objNode["lifestylequalitysource"] != null)
            {
                _objLifestyleQualitySource = ConvertToLifestyleQualitySource(objNode["lifestylequalitysource"].InnerText);
            }
#else
            _objLifestyleQualitySource = QualitySource.Selected;
#endif
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            string strAllowedFreeLifestyles = string.Empty;
            if (!objNode.TryGetStringFieldQuickly("allowed", ref strAllowedFreeLifestyles))
            {
                strAllowedFreeLifestyles = MyXmlNode?["allowed"]?.InnerText ?? string.Empty;
            }
            _lstAllowedFreeLifestyles = strAllowedFreeLifestyles.Split(',').ToList();
            _nodBonus = objNode["bonus"];
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);

            if (GlobalOptions.Language != GlobalOptions.DefaultLanguage)
            {
                XmlNode objLifestyleQualityNode = MyXmlNode;
                if (objLifestyleQualityNode != null)
                {
                    objLifestyleQualityNode.TryGetStringFieldQuickly("translate", ref _strAltName);
                    objLifestyleQualityNode.TryGetStringFieldQuickly("altpage", ref _strAltPage);
                }
            }
            LegacyShim();
        }
Exemple #17
0
 public Item(int id, string name, ItemType type, QualityType qualityType, string description, int capacity, int buyPrice, int sellPrice, string sprite)
 {
     this.ID          = id;
     this.Name        = name;
     this.Type        = type;
     this.Qualitytype = qualityType;
     this.Description = description;
     this.Capacity    = capacity;
     this.BuyPrice    = buyPrice;
     this.SellPrice   = sellPrice;
     this.Sprite      = sprite;
 }
        /// <summary>
        /// 低配
        /// </summary>
        public void LowQuality()
        {
            mQuality = QualityType.Low;
            LightFaceEffect lfe = GameObject.FindObjectOfType <LightFaceEffect>() as LightFaceEffect;

            if (lfe != null)
            {
                lfe.LightEffectEnable = false;
                lfe.GlowEnable        = false;
                lfe.TerrainXQulity    = TerrainXQualityLevel.Low;
            }
        }
Exemple #19
0
        /// <summary>
        /// Load the CharacterAttribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode, Lifestyle objParentLifestyle)
        {
            ParentLifestyle = objParentLifestyle;
            objNode.TryGetField("guid", Guid.TryParse, out _guiID);
            objNode.TryGetStringFieldQuickly("name", ref _strName);
            if (!objNode.TryGetField("id", Guid.TryParse, out _SourceGuid))
            {
                var doc = XmlManager.Instance.Load("lifestyles.xml");
                var q   = doc.SelectSingleNode("/chummer/qualities/quality[name = \"" + Name + "\"]");
                q.TryGetField("id", Guid.TryParse, out _SourceGuid);
            }
            objNode.TryGetStringFieldQuickly("extra", ref _strExtra);
            objNode.TryGetInt32FieldQuickly("lp", ref _intLP);
            objNode.TryGetInt32FieldQuickly("cost", ref _intCost);
            objNode.TryGetInt32FieldQuickly("multiplier", ref _intMultiplier);
            objNode.TryGetInt32FieldQuickly("basemultiplier", ref _intBaseMultiplier);
            objNode.TryGetBoolFieldQuickly("contributetolimit", ref _blnContributeToLimit);
            objNode.TryGetBoolFieldQuickly("print", ref _blnPrint);
            if (objNode["lifestylequalitytype"] != null)
            {
                _objLifestyleQualityType = ConvertToLifestyleQualityType(objNode["lifestylequalitytype"].InnerText);
            }
            if (objNode["lifestylequalitysource"] != null)
            {
                _objLifestyleQualitySource = ConvertToLifestyleQualitySource(objNode["lifestylequalitysource"].InnerText);
            }
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            string strAllowedFreeLifestyles = string.Empty;

            if (!objNode.TryGetStringFieldQuickly("allowed", ref strAllowedFreeLifestyles))
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");
                XmlNode     objXmlQuality  = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + Name + "\"]");
                strAllowedFreeLifestyles = objXmlQuality?["allowed"]?.InnerText ?? string.Empty;
            }
            _lstAllowedFreeLifestyles = strAllowedFreeLifestyles.Split(',').ToList();
            _nodBonus = objNode["bonus"];
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument          = XmlManager.Instance.Load("lifestyles.xml");
                XmlNode     objLifestyleQualityNode = objXmlDocument.SelectSingleNode("/chummer/lifestylequalities/lifestylequality[name = \"" + _strName + "\"]");
                if (objLifestyleQualityNode != null)
                {
                    objLifestyleQualityNode.TryGetStringFieldQuickly("translate", ref _strAltName);
                    objLifestyleQualityNode.TryGetStringFieldQuickly("altpage", ref _strAltPage);
                }
            }
            LegacyShim();
        }
        internal Judgement()
        {
            _approachForm  = new ApproachForm();
            _existaneForm  = new ExistanceForm();
            _subjectForm   = new SubjectForm();
            _predicateForm = new PredicateForm();
            _subjectPredicateRelationForm = new SubjectPredicateRelationForm();

            _modalityType = new ModalityType();
            _quantityType = new QuantityType();
            _qualityType  = new QualityType();
            _relationType = new RelationType();
        }
Exemple #21
0
        public Action <Equipment, AffixManager, CurrencyModifiers> SetQualityType(QualityType qualityType)
        {
            return((item, affixManager, currencyModifier) =>
            {
                if (item.QualityType == qualityType)
                {
                    return;
                }

                item.QualityType = qualityType;
                item.Quality = 0;
            });
        }
Exemple #22
0
 /// <summary>
 /// Called when record starts
 /// </summary>
 public void StartRecord()
 {
     if (_configuration != null)
     {
         _bitRateMode = _configuration.RecordQualityMode;
         _qualityType = _configuration.RecordQualityType;
     }
     else
     {
         _bitRateMode = VIDEOENCODER_BITRATE_MODE.ConstantBitRate;
         _qualityType = QualityType.Default;
     }
     ApplyQuality();
 }
Exemple #23
0
 /// <summary>
 /// Called when playback starts
 /// </summary>
 public void StartPlayback()
 {
     if (_configuration != null)
     {
         _bitRateMode = _configuration.PlaybackQualityMode;
         _qualityType = _configuration.PlaybackQualityType;
     }
     else
     {
         _bitRateMode = VIDEOENCODER_BITRATE_MODE.NotSet;
         _qualityType = QualityType.Default;
     }
     ApplyQuality();
 }
Exemple #24
0
        /// <summary>
        /// Load the CharacterAttribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            objNode.TryGetField("guid", Guid.TryParse, out _guiID);
            objNode.TryGetStringFieldQuickly("name", ref _strName);
            if (!objNode.TryGetField("id", Guid.TryParse, out _guiQualityId))
            {
                XmlNode objNewNode = XmlManager.Load("qualities.xml").SelectSingleNode("/chummer/qualities/quality[name = \"" + Name + "\"]");
                if (objNewNode?.TryGetField("id", Guid.TryParse, out _guiQualityId) == true)
                {
                    _objCachedMyXmlNode = null;
                }
            }
            else
            {
                _objCachedMyXmlNode = null;
            }
            objNode.TryGetStringFieldQuickly("extra", ref _strExtra);
            objNode.TryGetInt32FieldQuickly("bp", ref _intBP);
            objNode.TryGetBoolFieldQuickly("implemented", ref _blnImplemented);
            objNode.TryGetBoolFieldQuickly("contributetolimit", ref _blnContributeToLimit);
            objNode.TryGetBoolFieldQuickly("print", ref _blnPrint);
            objNode.TryGetBoolFieldQuickly("doublecareer", ref _blnDoubleCostCareer);
            objNode.TryGetBoolFieldQuickly("canbuywithspellpoints", ref _blnCanBuyWithSpellPoints);
            _eQualityType   = ConvertToQualityType(objNode["qualitytype"]?.InnerText);
            _eQualitySource = ConvertToQualitySource(objNode["qualitysource"]?.InnerText);
            string strTemp = string.Empty;

            if (objNode.TryGetStringFieldQuickly("metagenetic", ref strTemp))
            {
                _blnMetagenetic = strTemp == bool.TrueString || strTemp == "yes";
            }
            if (objNode.TryGetStringFieldQuickly("mutant", ref strTemp))
            {
                _blnMutant = strTemp == bool.TrueString || strTemp == "yes";
            }
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            objNode.TryGetStringFieldQuickly("sourcename", ref _strSourceName);
            _nodBonus           = objNode["bonus"];
            _nodFirstLevelBonus = objNode["firstlevelbonus"] ?? GetNode()?["firstlevelbonus"];
            _nodDiscounts       = objNode["costdiscount"];
            objNode.TryGetField("weaponguid", Guid.TryParse, out _guiWeaponID);
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);

            if (_eQualityType == QualityType.LifeModule)
            {
                objNode.TryGetStringFieldQuickly("stage", ref _strStage);
            }
            SourceDetail = new SourceString(_strSource, _strPage);
        }
Exemple #25
0
        /// <summary>
        /// Load the CharacterAttribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        /// <param name="objParentLifestyle">Lifestyle object to which this LifestyleQuality belongs.</param>
        public void Load(XmlNode objNode, Lifestyle objParentLifestyle)
        {
            ParentLifestyle = objParentLifestyle;
            objNode.TryGetField("guid", Guid.TryParse, out _guiID);
            if (objNode.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            if (!objNode.TryGetField("id", Guid.TryParse, out _SourceGuid))
            {
                XmlManager.Load("lifestyles.xml").SelectSingleNode("/chummer/qualities/quality[name = \"" + _strName + "\"]")?.TryGetField("id", Guid.TryParse, out _SourceGuid);
            }
            objNode.TryGetStringFieldQuickly("extra", ref _strExtra);
            objNode.TryGetInt32FieldQuickly("lp", ref _intLP);
            objNode.TryGetStringFieldQuickly("cost", ref _strCost);
            objNode.TryGetInt32FieldQuickly("multiplier", ref _intMultiplier);
            objNode.TryGetInt32FieldQuickly("basemultiplier", ref _intBaseMultiplier);
            objNode.TryGetBoolFieldQuickly("contributetolimit", ref _blnContributeToLP);
            objNode.TryGetBoolFieldQuickly("print", ref _blnPrint);
            if (objNode["lifestylequalitytype"] != null)
            {
                _objLifestyleQualityType = ConvertToLifestyleQualityType(objNode["lifestylequalitytype"].InnerText);
            }
#if DEBUG
            if (objNode["lifestylequalitysource"] != null)
            {
                _objLifestyleQualitySource = ConvertToLifestyleQualitySource(objNode["lifestylequalitysource"].InnerText);
            }
#else
            _objLifestyleQualitySource = QualitySource.Selected;
#endif
            if (!objNode.TryGetStringFieldQuickly("category", ref _strCategory))
            {
                _strCategory = GetNode()?["category"]?.InnerText ?? string.Empty;
            }
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            string strAllowedFreeLifestyles = string.Empty;
            if (!objNode.TryGetStringFieldQuickly("allowed", ref strAllowedFreeLifestyles))
            {
                strAllowedFreeLifestyles = GetNode()?["allowed"]?.InnerText ?? string.Empty;
            }
            _lstAllowedFreeLifestyles = strAllowedFreeLifestyles.Split(',').ToList();
            _nodBonus = objNode["bonus"];
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);

            SourceDetail = new SourceString(_strSource, _strPage);
            LegacyShim();
        }
        /// <summary>
        /// Set Quality
        /// </summary>
        /// <param name="qualityType"></param>
        public override void SetQuality(QualityType qualityType)
        {
            switch (qualityType)
            {
            case QualityType.Low:
                PressButton("LOW");
                break;

            case QualityType.High:
                PressButton("HIGH");
                break;

            default:
                break;
            }
        }
Exemple #27
0
        /// <summary>
        /// Load the CharacterAttribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            _guiID    = Guid.Parse(objNode["guid"].InnerText);
            _strName  = objNode["name"].InnerText;
            _strExtra = objNode["extra"].InnerText;
            _intLP    = Convert.ToInt32(objNode["lp"].InnerText);
            if (objNode["cost"].InnerText != "")
            {
                _intCost = Convert.ToInt32(objNode["cost"].InnerText);
            }
            if (objNode["multiplier"] != null)
            {
                _intMultiplier = Convert.ToInt32(objNode["multiplier"].InnerText);
            }
            _blnContributeToLimit      = Convert.ToBoolean(objNode["contributetolimit"].InnerText);
            _blnPrint                  = Convert.ToBoolean(objNode["print"].InnerText);
            _objLifestyleQualityType   = ConvertToLifestyleQualityType(objNode["lifestylequalitytype"].InnerText);
            _objLifestyleQualitySource = ConvertToLifestyleQualitySource(objNode["lifestylequalitysource"].InnerText);
            _strSource                 = objNode["source"].InnerText;
            _strPage  = objNode["page"].InnerText;
            _nodBonus = objNode["bonus"];
            try
            {
                _strNotes = objNode["notes"].InnerText;
            }
            catch
            {
            }

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument          = XmlManager.Instance.Load("lifestyles.xml");
                XmlNode     objLifestyleQualityNode = objXmlDocument.SelectSingleNode("/chummer/lifestylequalities/lifestylequality[name = \"" + _strName + "\"]");
                if (objLifestyleQualityNode != null)
                {
                    if (objLifestyleQualityNode["translate"] != null)
                    {
                        _strAltName = objLifestyleQualityNode["translate"].InnerText;
                    }
                    if (objLifestyleQualityNode["altpage"] != null)
                    {
                        _strAltPage = objLifestyleQualityNode["altpage"].InnerText;
                    }
                }
            }
        }
        public async void AddMovieToWishlist()
        {
            var options = CreateNewContextOptions();

            using (var context = new MediaCollectionContext(options))
            {
                var         omdbClient     = new OmdbClient();
                var         _service       = new WishlistService(context, omdbClient);
                string      imdbId         = "tt1211837"; //Doctor Strange
                QualityType desiredQuality = QualityType.HD;

                Movie movie = await _service.AddMovie(imdbId, desiredQuality);

                Assert.Equal(movie.Title, "Doctor Strange");
                Assert.Equal(movie.Year, 2016);
            }
        }
Exemple #29
0
        public void Setup()
        {
            parseResultMulti = new EpisodeParseResult
            {
                SeriesTitle    = "Title",
                Language       = LanguageType.English,
                Quality        = new QualityModel(QualityTypes.SDTV, true),
                EpisodeNumbers = new List <int> {
                    3, 4
                },
                SeasonNumber = 12,
                AirDate      = DateTime.Now.AddDays(-12).Date
            };

            parseResultSingle = new EpisodeParseResult
            {
                SeriesTitle    = "Title",
                Language       = LanguageType.English,
                Quality        = new QualityModel(QualityTypes.SDTV, true),
                EpisodeNumbers = new List <int> {
                    3
                },
                SeasonNumber = 12,
                AirDate      = DateTime.Now.AddDays(-12).Date
            };

            series30minutes = Builder <Series> .CreateNew()
                              .With(c => c.Monitored  = true)
                              .With(d => d.CleanTitle = parseResultMulti.CleanTitle)
                              .With(c => c.Runtime    = 30)
                              .Build();

            series60minutes = Builder <Series> .CreateNew()
                              .With(c => c.Monitored  = true)
                              .With(d => d.CleanTitle = parseResultMulti.CleanTitle)
                              .With(c => c.Runtime    = 60)
                              .Build();

            qualityType = Builder <QualityType> .CreateNew()
                          .With(q => q.MinSize       = 0)
                          .With(q => q.MaxSize       = 10)
                          .With(q => q.QualityTypeId = 1)
                          .Build();
        }
        /// <summary>
        /// 高配
        /// </summary>
        public void HeightQuality()
        {
            mQuality = QualityType.Height;
            LightFaceEffect lfe = GameObject.FindObjectOfType <LightFaceEffect>() as LightFaceEffect;

            if (lfe != null)
            {
                try
                {
                    lfe.LightEffectEnable = true;
                    lfe.GlowEnable        = true;
                    lfe.TerrainXQulity    = TerrainXQualityLevel.High;
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex.ToString());
                }
            }
        }
Exemple #31
0
 //[MethodImplAttribute(MethodImplOptions.Synchronized)]//Синхронизировать метод
 public Tag getOrUpdate(Tag tag)
 {
     if (tag != null)
     {
         //Сохраним новые значения
         this.Service      = tag.Service;
         this._oldvalue    = tag.OldValue;
         this.Quality      = tag.Quality;
         this.Timestamp    = tag.Timestamp;
         this._value       = tag.Value;
         this.cnt          = tag.cnt;
         this.Delta        = tag.Delta;
         this.Step         = tag.Step;
         this.DtChange     = tag.DtChange;
         this.ErrorCode    = tag.ErrorCode;
         this.ErrorMessage = tag.ErrorMessage;
         this.IsChange     = tag.IsChange;
         this.Default      = tag.Default;
         this.LogMode      = tag.LogMode;
     }
     return(Clone());
 }
Exemple #32
0
        public async Task <Movie> AddMovie(string imdbId, QualityType desiredQuality)
        {
            Movie movie = _mediaCollectionContext.Movies.FirstOrDefault(m => m.ImdbId == imdbId);

            if (movie != null)
            {
                movie.DesiredQuality = desiredQuality;
            }
            else
            {
                try
                {
                    var metadata = await _omdbClient.GetMetadataByImdbId(imdbId);

                    movie = new Movie()
                    {
                        Title          = metadata.Title,
                        Plot           = metadata.Plot,
                        ImdbId         = imdbId,
                        Year           = Convert.ToInt32(metadata.Year),
                        Poster         = metadata.Poster,
                        Rating         = metadata.imdbRating,
                        inLibrary      = false,
                        DesiredQuality = desiredQuality
                    };

                    await _mediaCollectionContext.AddAsync(movie);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            await _mediaCollectionContext.SaveChangesAsync();

            return(movie);
        }
Exemple #33
0
        internal Quality GetQuality(QualityType qualityType)
        {
            IList <Quality> list;

            switch (qualityType)
            {
            case QualityType.All:
                list = _repos.GetQualityCodes(null, 1);
                break;

            case QualityType.Order:
                list = _repos.GetQualityCodes("O", 1);
                break;

            case QualityType.Received:
                list = _repos.GetQualityCodes("R", 1);
                break;

            default:
                throw new NotImplementedException();
            }
            return(list.FirstOrDefault());
        }
        /// <summary>
        /// Load the Attribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            _guiID = Guid.Parse(objNode["guid"].InnerText);
            _strName = objNode["name"].InnerText;
            _strExtra = objNode["extra"].InnerText;
            _intLP = Convert.ToInt32(objNode["lp"].InnerText);
            _intCost = Convert.ToInt32(objNode["cost"].InnerText);
            _blnContributeToLimit = Convert.ToBoolean(objNode["contributetolimit"].InnerText);
            _blnPrint = Convert.ToBoolean(objNode["print"].InnerText);
            _objLifestyleQualityType = ConvertToLifestyleQualityType(objNode["LifestyleQualitytype"].InnerText);
            _objLifestyleQualitySource = ConvertToLifestyleQualitySource(objNode["LifestyleQualitysource"].InnerText);
            _strSource = objNode["source"].InnerText;
            _strPage = objNode["page"].InnerText;
            _nodBonus = objNode["bonus"];
            try
            {
                _strNotes = objNode["notes"].InnerText;
            }
            catch
            {
            }

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");
                XmlNode objLifestyleQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/LifestyleQuality[name = \"" + _strName + "\"]");
                if (objLifestyleQualityNode != null)
                {
                    if (objLifestyleQualityNode["translate"] != null)
                        _strAltName = objLifestyleQualityNode["translate"].InnerText;
                    if (objLifestyleQualityNode["altpage"] != null)
                        _strAltPage = objLifestyleQualityNode["altpage"].InnerText;
                }
            }
        }
        /// <summary>
        /// Create a LifestyleQuality from an XmlNode and return the TreeNodes for it.
        /// </summary>
        /// <param name="objXmlLifestyleQuality">XmlNode to create the object from.</param>
        /// <param name="objCharacter">Character object the LifestyleQuality will be added to.</param>
        /// <param name="objLifestyleQualitySource">Source of the LifestyleQuality.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="objWeapons">List of Weapons that should be added to the Character.</param>
        /// <param name="objWeaponNodes">List of TreeNodes to represent the Weapons added.</param>
        /// <param name="strForceValue">Force a value to be selected for the LifestyleQuality.</param>
        public void Create(XmlNode objXmlLifestyleQuality, Character objCharacter, QualitySource objLifestyleQualitySource, TreeNode objNode)
        {
            _strName = objXmlLifestyleQuality["name"].InnerText;
            _intLP = Convert.ToInt32(objXmlLifestyleQuality["lp"].InnerText);
            try
            {
                _intCost = Convert.ToInt32(objXmlLifestyleQuality["cost"].InnerText);
            }
            catch
            {}
            _objLifestyleQualityType = ConvertToLifestyleQualityType(objXmlLifestyleQuality["category"].InnerText);
            _objLifestyleQualitySource = objLifestyleQualitySource;
            if (objXmlLifestyleQuality["print"] != null)
            {
                if (objXmlLifestyleQuality["print"].InnerText == "no")
                    _blnPrint = false;
            }
            if (objXmlLifestyleQuality["contributetolimit"] != null)
            {
                if (objXmlLifestyleQuality["contributetolimit"].InnerText == "no")
                    _blnContributeToLimit = false;
            }
            _strSource = objXmlLifestyleQuality["source"].InnerText;
            _strPage = objXmlLifestyleQuality["page"].InnerText;
            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");
                XmlNode objLifestyleQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/LifestyleQuality[name = \"" + _strName + "\"]");
                if (objLifestyleQualityNode != null)
                {
                    if (objLifestyleQualityNode["translate"] != null)
                        _strAltName = objLifestyleQualityNode["translate"].InnerText;
                    if (objLifestyleQualityNode["altpage"] != null)
                        _strAltPage = objLifestyleQualityNode["altpage"].InnerText;
                }
            }

            // If the item grants a bonus, pass the information to the Improvement Manager.
            if (objXmlLifestyleQuality.InnerXml.Contains("<bonus>"))
            {
                ImprovementManager objImprovementManager = new ImprovementManager(objCharacter);
                if (!objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Quality, _guiID.ToString(), objXmlLifestyleQuality["bonus"], false, 1, DisplayNameShort))
                {
                    _guiID = Guid.Empty;
                    return;
                }
                if (objImprovementManager.SelectedValue != "")
                {
                    _strExtra = objImprovementManager.SelectedValue;
                    objNode.Text += " (" + objImprovementManager.SelectedValue + ")";
                }
            }
            objNode.Text = DisplayName;
            objNode.Tag = InternalId;
        }
		private static string GetExclusionsExplain(QualityType qtype) {
			//No need to check RemotingRole; no call to db.
			switch(qtype) {
				case QualityType.WeightOver65:
					return "Marked ineligible within 6 months prior to the last visit.";
				case QualityType.WeightAdult:
					return "Terminal ineligible within 6 months prior to the last visit.";
				case QualityType.Hypertension:
					return "N/A";
				case QualityType.TobaccoUse:
					return "N/A";
				case QualityType.TobaccoCessation:
					return "N/A";
				case QualityType.InfluenzaAdult:
					return "A valid reason was entered for medication not given.";
				case QualityType.WeightChild_1_1:
				case QualityType.WeightChild_1_2:
				case QualityType.WeightChild_1_3:
				case QualityType.WeightChild_2_1:
				case QualityType.WeightChild_2_2:
				case QualityType.WeightChild_2_3:
				case QualityType.WeightChild_3_1:
				case QualityType.WeightChild_3_2:
				case QualityType.WeightChild_3_3:
					return "N/A";
				case QualityType.ImmunizeChild_1:
				case QualityType.ImmunizeChild_2:
				case QualityType.ImmunizeChild_3:
				case QualityType.ImmunizeChild_4:
				case QualityType.ImmunizeChild_5:
				case QualityType.ImmunizeChild_6:
				case QualityType.ImmunizeChild_7:
				case QualityType.ImmunizeChild_8:
				case QualityType.ImmunizeChild_9:
				case QualityType.ImmunizeChild_10:
				case QualityType.ImmunizeChild_11:
				case QualityType.ImmunizeChild_12:
					return "Contraindicated due to specific allergy or disease.";
				case QualityType.Pneumonia:
					return "N/A";
				case QualityType.DiabetesBloodPressure:
					return "1. Diagnosis polycystic ovaries and not active diagnosis of diabetes.\r\n"
						+"or 2. Medication was due to an accute episode, and not active diagnosis of diabetes.";
				case QualityType.BloodPressureManage:
					return "N/A";
				default:
					throw new ApplicationException("Type not found: "+qtype.ToString());
			}
		}
		private static string GetNumeratorExplain(QualityType qtype) {
			//No need to check RemotingRole; no call to db.
			switch(qtype) {
				case QualityType.WeightOver65:
					return @"BMI < 22 or >= 30 with Followup documented.
BMI 22-30.";
				case QualityType.WeightAdult:
					return @"BMI < 18.5 or >= 25 with Followup documented.
BMI 18.5-25.";
				case QualityType.Hypertension:
					return "Blood pressure entered during measurement period.";
				case QualityType.TobaccoUse:
					return "Tobacco use recorded within the 24 months prior to the last visit.";
				case QualityType.TobaccoCessation:
					return "Tobacco cessation entry within the 24 months prior to the last visit.";
				case QualityType.InfluenzaAdult:
					return "Influenza vaccine administered.";
				case QualityType.WeightChild_1_1:
					return "BMI recorded during measurement period.";
				case QualityType.WeightChild_1_2:
					return "Counseling for nutrition during measurement period.";
				case QualityType.WeightChild_1_3:
					return "Counseling for physical activity during measurement period.";
				case QualityType.WeightChild_2_1:
					return "BMI recorded during measurement period.";
				case QualityType.WeightChild_2_2:
					return "Counseling for nutrition during measurement period.";
				case QualityType.WeightChild_2_3:
					return "Counseling for physical activity during measurement period.";
				case QualityType.WeightChild_3_1:
					return "BMI recorded during measurement period.";
				case QualityType.WeightChild_3_2:
					return "Counseling for nutrition during measurement period.";
				case QualityType.WeightChild_3_3:
					return "Counseling for physical activity during measurement period.";
				case QualityType.ImmunizeChild_1:
					return "4 DTaP vaccinations between 42 days and 2 years of age. CVX=110,120,20,50";
				case QualityType.ImmunizeChild_2:
					return "3 IPV vaccinations between 42 days and 2 years of age. CVX=10,120";
				case QualityType.ImmunizeChild_3:
					return "1 MMR vaccination before 2 years of age. CVX=03,94\r\n"
						+"OR 1 measles(05), 1 mumps(07), and 1 rubella(06).";
				case QualityType.ImmunizeChild_4:
					//the intro paragraph states 4 HiB.  They have a typo someplace.
					return "2 HiB vaccinations between 42 days and 2 years of age. CVX=120,46,47,48,49,50,51";
				case QualityType.ImmunizeChild_5:
					return "3 hepatitis B vaccinations before 2 years of age. CVX=08,110,44,51";
				case QualityType.ImmunizeChild_6:
					return "1 VZV vaccination before 2 years of age. CVX=21,94";
				case QualityType.ImmunizeChild_7:
					return "4 pneumococcal vaccinations between 42 days and 2 years of age. CVX=100,133";
				case QualityType.ImmunizeChild_8:
					return "2 hepatitis A vaccinations before 2 years of age. CVX=83";
				case QualityType.ImmunizeChild_9:
					return "2 rotavirus vaccinations between 42 days and 2 years of age. CVX=116,119";
				case QualityType.ImmunizeChild_10:
					return "2 influenza vaccinations between 180 days and 2 years of age. CVX=135,15";
				case QualityType.ImmunizeChild_11:
					return "All vaccinations 1-6.";
				case QualityType.ImmunizeChild_12:
					return "All vaccinations 1-7.";
				case QualityType.Pneumonia:
					return "Pneumococcal vaccine before measurement end date. CVX=33,100,133";
				case QualityType.DiabetesBloodPressure:
					return "Diastolic < 90 and systolic < 140 at most recent encounter.";
				case QualityType.BloodPressureManage:
					return "Diastolic < 90 and systolic < 140 at most recent encounter.";
				default:
					throw new ApplicationException("Type not found: "+qtype.ToString());
			}
		}
		private static string GetDenominatorExplain(QualityType qtype) {
			//No need to check RemotingRole; no call to db.
			switch(qtype) {
				case QualityType.WeightOver65:
					return "All patients 65+ with at least one visit during the measurement period.";
				case QualityType.WeightAdult:
					return "All patients 18 to 64 with at least one visit during the measurement period.";
				case QualityType.Hypertension:
					return "All patients 18+ with ICD9 hypertension(401-404) and at least two visits, one during the measurement period.";
				case QualityType.TobaccoUse:
					//The original manual that these specs came from stated ALL patients seen during the period, and did not say anything about needing two visits.
					return "All patients 18+ with at least one visit during the measurement period.";
				case QualityType.TobaccoCessation:
					//It's inconsistent.  Sometimes it says 24 months from now (which doesn't make sense).  
					//Other times it says 24 months from last visit.  We're going with that.
					//Again, we will ignore the part about needing two visits.
					return "All patients 18+ with at least one visit during the measurement period; and identified as tobacco users within the 24 months prior to the last visit.";
				case QualityType.InfluenzaAdult:
					//the documentation is very sloppy.  It's including a flu season daterange in the denominator that is completely illogical.
					return "All patients 50+ with a visit during the measurement period.";
				case QualityType.WeightChild_1_1:
				case QualityType.WeightChild_1_2:
				case QualityType.WeightChild_1_3:
					return "All patients 2-16 with a visit during the measurement period, unless pregnant.";
				case QualityType.WeightChild_2_1:
				case QualityType.WeightChild_2_2:
				case QualityType.WeightChild_2_3:
					return "All patients 2-10 with a visit during the measurement period, unless pregnant.";
				case QualityType.WeightChild_3_1:
				case QualityType.WeightChild_3_2:
				case QualityType.WeightChild_3_3:
					return "All patients 11-16 with a visit during the measurement period, unless pregnant.";
				case QualityType.ImmunizeChild_1:
				case QualityType.ImmunizeChild_2:
				case QualityType.ImmunizeChild_3:
				case QualityType.ImmunizeChild_4:
				case QualityType.ImmunizeChild_5:
				case QualityType.ImmunizeChild_6:
				case QualityType.ImmunizeChild_7:
				case QualityType.ImmunizeChild_8:
				case QualityType.ImmunizeChild_9:
				case QualityType.ImmunizeChild_10:
				case QualityType.ImmunizeChild_11:
				case QualityType.ImmunizeChild_12:
					return "All patients with a visit during the measurement period who turned 2 during the measurement period.";
				case QualityType.Pneumonia:
					return "All patients 65+ during the measurement period with a visit within 1 year before the measurement end date.";
				case QualityType.DiabetesBloodPressure:
					return "All patients 17-74 before the measurement period, who either have a diabetes-related medication dispensed, or who have an active diagnosis of diabetes.";
				case QualityType.BloodPressureManage:
					return "All patients 17-74 before the measurement period who have an active diagnosis of hypertension and who are not pregnant or have ESRD.";
				default:
					throw new ApplicationException("Type not found: "+qtype.ToString());
			}
		}
		public static DataTable GetTable(QualityType qtype,DateTime dateStart,DateTime dateEnd,long provNum) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetTable(MethodBase.GetCurrentMethod(),qtype,dateStart,dateEnd,provNum);
			}
			//these queries only work for mysql
			string command="";
			DataTable tableRaw=new DataTable();
			switch(qtype) {
				#region WeightOver65
				case QualityType.WeightOver65:
					//WeightOver65-------------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						DateVisit date NOT NULL DEFAULT '0001-01-01',
						Height float NOT NULL,
						Weight float NOT NULL,
						HasFollowupPlan tinyint NOT NULL,
						IsIneligible tinyint NOT NULL,
						Documentation varchar(255) NOT NULL
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName,DateVisit) SELECT patient.PatNum,LName,FName,"
						+"MAX(ProcDate) "//on the first pass, all we can obtain is the date of the visit
						+"FROM patient "
						+"INNER JOIN procedurelog "//because we want to restrict to only results with procedurelog
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate > '1880-01-01' AND Birthdate <= "+POut.Date(DateTime.Today.AddYears(-65))+" "//65 or older
						+"GROUP BY patient.PatNum";//there will frequently be multiple procedurelog events
					Db.NonQ(command);
					//now, find BMIs within 6 months of each visit date. No logic for picking one of multiple BMIs.
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.Height=vitalsign.Height, "
						+"tempehrquality.Weight=vitalsign.Weight, "//we could also easily get the BMI date if we wanted.
						+"tempehrquality.HasFollowupPlan=vitalsign.HasFollowupPlan, "
						+"tempehrquality.IsIneligible=vitalsign.IsIneligible, "
						+"tempehrquality.Documentation=vitalsign.Documentation "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken <= tempehrquality.DateVisit "
						+"AND vitalsign.DateTaken >= DATE_SUB(tempehrquality.DateVisit,INTERVAL 6 MONTH)";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region WeightAdult
				case QualityType.WeightAdult:
					//WeightAdult---------------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						DateVisit date NOT NULL DEFAULT '0001-01-01',
						Height float NOT NULL,
						Weight float NOT NULL,
						HasFollowupPlan tinyint NOT NULL,
						IsIneligible tinyint NOT NULL,
						Documentation varchar(255) NOT NULL
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName,DateVisit) SELECT patient.PatNum,LName,FName,"
						+"MAX(ProcDate) "//on the first pass, all we can obtain is the date of the visit
						+"FROM patient "
						+"INNER JOIN procedurelog "//because we want to restrict to only results with procedurelog
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate <= "+POut.Date(DateTime.Today.AddYears(-18))+" "//18+
						+"AND Birthdate > "+POut.Date(DateTime.Today.AddYears(-65))+" "//less than 65
						+"GROUP BY patient.PatNum";//there will frequently be multiple procedurelog events
					Db.NonQ(command);
					//now, find BMIs within 6 months of each visit date. No logic for picking one of multiple BMIs.
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.Height=vitalsign.Height, "
						+"tempehrquality.Weight=vitalsign.Weight, "
						+"tempehrquality.HasFollowupPlan=vitalsign.HasFollowupPlan, "
						+"tempehrquality.IsIneligible=vitalsign.IsIneligible, "
						+"tempehrquality.Documentation=vitalsign.Documentation "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken <= tempehrquality.DateVisit "
						+"AND vitalsign.DateTaken >= DATE_SUB(tempehrquality.DateVisit,INTERVAL 6 MONTH)";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region Hypertension
				case QualityType.Hypertension:
					//Hypertension---------------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						DateVisit date NOT NULL DEFAULT '0001-01-01',
						VisitCount int NOT NULL,
						Icd9Code varchar(255) NOT NULL,
						DateBpEntered date NOT NULL DEFAULT '0001-01-01'
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName,DateVisit,VisitCount,Icd9Code) "
						+"SELECT patient.PatNum,LName,FName,"
						+"MAX(ProcDate), "// most recent visit
						+"COUNT(DISTINCT ProcDate),diseasedef.ICD9Code "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"LEFT JOIN disease ON disease.PatNum=patient.PatNum "
						+"AND disease.DiseaseDefNum IN (SELECT DiseaseDefNum FROM diseasedef WHERE ICD9Code REGEXP '^40[1-4]') "//starts with 401 through 404
						//+"LEFT JOIN icd9 ON icd9.ICD9Num=disease.ICD9Num "
						+"LEFT JOIN diseasedef ON diseasedef.DiseaseDefNum=disease.DiseaseDefNum "
						//+"AND icd9.ICD9Code REGEXP '^40[1-4]' "//starts with 401 through 404
						+"WHERE Birthdate <= "+POut.Date(DateTime.Today.AddYears(-18))+" "//18+
						+"GROUP BY patient.PatNum";
					Db.NonQ(command);
					//now, find BMIs in measurement period.
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.DateBpEntered=vitalsign.DateTaken "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.BpSystolic != 0 "
						+"AND vitalsign.BpDiastolic != 0 "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd);
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region TobaccoUse
				case QualityType.TobaccoUse:
					//TobaccoUse---------------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						DateVisit date NOT NULL DEFAULT '0001-01-01',
						VisitCount int NOT NULL,
						DateAssessment date NOT NULL DEFAULT '0001-01-01'
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName,DateVisit,VisitCount) "
						+"SELECT patient.PatNum,LName,FName,"
						+"MAX(ProcDate), "// most recent visit
						+"COUNT(DISTINCT ProcDate) "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"WHERE Birthdate <= "+POut.Date(DateTime.Today.AddYears(-18))+" "//18+
						+"GROUP BY patient.PatNum";
					Db.NonQ(command);
					//now, find most recent tobacco assessment date.  We will check later that it is within 2 years of last exam.
					command="UPDATE tempehrquality "//,ehrmeasureevent "
						+"SET tempehrquality.DateAssessment=(SELECT MAX(DATE(ehrmeasureevent.DateTEvent)) "
						+"FROM ehrmeasureevent "
						+"WHERE tempehrquality.PatNum=ehrmeasureevent.PatNum "
						+"AND ehrmeasureevent.EventType="+POut.Int((int)EhrMeasureEventType.TobaccoUseAssessed)+")";
					Db.NonQ(command);
					command="UPDATE tempehrquality SET DateAssessment='0001-01-01' WHERE DateAssessment='0000-00-00'";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region TobaccoCessation
				case QualityType.TobaccoCessation:
					//TobaccoCessation----------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						DateVisit date NOT NULL DEFAULT '0001-01-01',
						DateAssessment date NOT NULL DEFAULT '0001-01-01',
						DateCessation date NOT NULL DEFAULT '0001-01-01',
						Documentation varchar(255) NOT NULL
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName,DateVisit) "
						+"SELECT patient.PatNum,LName,FName,"
						+"MAX(ProcDate) "// most recent visit
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"WHERE Birthdate <= "+POut.Date(DateTime.Today.AddYears(-18))+" "//18+
						+"AND patient.SmokingSnoMed IN('"+POut.String(SmokingSnoMed._449868002.ToString().Substring(1))+"','"
						+POut.String(SmokingSnoMed._428041000124106.ToString().Substring(1))+"','"
						+POut.String(SmokingSnoMed._428061000124105.ToString().Substring(1))+"','"
						+POut.String(SmokingSnoMed._428071000124103.ToString().Substring(1))+"') "//CurrentEveryDay,CurrentSomeDay,LightSmoker,HeavySmoker
						+"GROUP BY patient.PatNum";
					Db.NonQ(command);
					//find most recent tobacco assessment date.
					command="UPDATE tempehrquality "
						+"SET tempehrquality.DateAssessment=(SELECT MAX(DATE(ehrmeasureevent.DateTEvent)) "
						+"FROM ehrmeasureevent "
						+"WHERE tempehrquality.PatNum=ehrmeasureevent.PatNum "
						+"AND ehrmeasureevent.EventType="+POut.Int((int)EhrMeasureEventType.TobaccoUseAssessed)+")";
					Db.NonQ(command);
					command="UPDATE tempehrquality SET DateAssessment='0001-01-01' WHERE DateAssessment='0000-00-00'";
					Db.NonQ(command);
					//find most recent tobacco cessation date.
					command="UPDATE tempehrquality "
						+"SET tempehrquality.DateCessation=(SELECT MAX(DATE(ehrmeasureevent.DateTEvent)) "
						+"FROM ehrmeasureevent "
						+"WHERE tempehrquality.PatNum=ehrmeasureevent.PatNum "
						+"AND ehrmeasureevent.EventType="+POut.Int((int)EhrMeasureEventType.TobaccoCessation)+")";
					Db.NonQ(command);
					command="UPDATE tempehrquality SET DateCessation='0001-01-01' WHERE DateCessation='0000-00-00'";
					Db.NonQ(command);
					//Pull the documentation based on date
					command="UPDATE tempehrquality "
						+"SET Documentation=(SELECT ehrmeasureevent.MoreInfo "
						+"FROM ehrmeasureevent "
						+"WHERE tempehrquality.PatNum=ehrmeasureevent.PatNum "
						+"AND ehrmeasureevent.EventType="+POut.Int((int)EhrMeasureEventType.TobaccoCessation)+" "
						+"AND DATE(ehrmeasureevent.DateTEvent)=tempehrquality.DateCessation) "
						+"WHERE DateCessation > '1880-01-01'";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region InfluenzaAdult
				case QualityType.InfluenzaAdult:
					//InfluenzaAdult----------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						DateVaccine date NOT NULL,
						NotGiven tinyint NOT NULL,
						Documentation varchar(255) NOT NULL
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName) SELECT patient.PatNum,LName,FName "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate > '1880-01-01' AND Birthdate <= "+POut.Date(DateTime.Today.AddYears(-50))+" "//50 or older
						+"GROUP BY patient.PatNum";
					Db.NonQ(command);
					//find most recent vaccine date
					command="UPDATE tempehrquality "
						+"SET tempehrquality.DateVaccine=(SELECT MAX(DATE(vaccinepat.DateTimeStart)) "
						+"FROM vaccinepat,vaccinedef "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND vaccinedef.CVXCode IN('135','15'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality SET DateVaccine='0001-01-01' WHERE DateVaccine='0000-00-00'";
					Db.NonQ(command);
					//pull documentation on vaccine exclusions based on date.
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET Documentation=Note, "
						+"tempehrquality.NotGiven=vaccinepat.NotGiven "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND DATE(vaccinepat.DateTimeStart)=tempehrquality.DateVaccine "
						+"AND vaccinedef.CVXCode IN('135','15')";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region WeightChild_1
				case QualityType.WeightChild_1_1:
				case QualityType.WeightChild_1_2:
				case QualityType.WeightChild_1_3:
					//WeightChild_1-----------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						IsPregnant tinyint NOT NULL,
						HasBMI tinyint NOT NULL,
						ChildGotNutrition tinyint NOT NULL,
						ChildGotPhysCouns tinyint NOT NULL				
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName) SELECT patient.PatNum,LName,FName "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate <= "+POut.Date(DateTime.Today.AddYears(-2))+" "//2+
						+"AND Birthdate > "+POut.Date(DateTime.Today.AddYears(-17))+" "//less than 17
						+"GROUP BY patient.PatNum";//there will frequently be multiple procedurelog events
					Db.NonQ(command);
					//find any BMIs within the period that indicate pregnancy
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.IsPregnant=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.IsIneligible=1";
					Db.NonQ(command);
					//find any BMIs within the period with a valid BMI
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.HasBMI=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.Height > 0 "
						+"AND vitalsign.Weight > 0";
					Db.NonQ(command);
					//find any BMIs within the period that indicate ChildGotNutrition
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.ChildGotNutrition=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.ChildGotNutrition=1";
					Db.NonQ(command);
					//find any BMIs within the period that indicate ChildGotPhysCouns
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.ChildGotPhysCouns=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.ChildGotPhysCouns=1";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region WeightChild_2
				case QualityType.WeightChild_2_1:
				case QualityType.WeightChild_2_2:
				case QualityType.WeightChild_2_3:
					//WeightChild_2-----------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						IsPregnant tinyint NOT NULL,
						HasBMI tinyint NOT NULL,
						ChildGotNutrition tinyint NOT NULL,
						ChildGotPhysCouns tinyint NOT NULL				
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName) SELECT patient.PatNum,LName,FName "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate <= "+POut.Date(DateTime.Today.AddYears(-2))+" "//2+
						+"AND Birthdate > "+POut.Date(DateTime.Today.AddYears(-11))+" "//less than 11
						+"GROUP BY patient.PatNum";//there will frequently be multiple procedurelog events
					Db.NonQ(command);
					//find any BMIs within the period that indicate pregnancy
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.IsPregnant=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.IsIneligible=1";
					Db.NonQ(command);
					//find any BMIs within the period with a valid BMI
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.HasBMI=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.Height > 0 "
						+"AND vitalsign.Weight > 0";
					Db.NonQ(command);
					//find any BMIs within the period that indicate ChildGotNutrition
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.ChildGotNutrition=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.ChildGotNutrition=1";
					Db.NonQ(command);
					//find any BMIs within the period that indicate ChildGotPhysCouns
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.ChildGotPhysCouns=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.ChildGotPhysCouns=1";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region WeightChild_3
				case QualityType.WeightChild_3_1:
				case QualityType.WeightChild_3_2:
				case QualityType.WeightChild_3_3:
					//WeightChild_3-----------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						IsPregnant tinyint NOT NULL,
						HasBMI tinyint NOT NULL,
						ChildGotNutrition tinyint NOT NULL,
						ChildGotPhysCouns tinyint NOT NULL			
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName) SELECT patient.PatNum,LName,FName "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate <= "+POut.Date(DateTime.Today.AddYears(-11))+" "//11+
						+"AND Birthdate > "+POut.Date(DateTime.Today.AddYears(-17))+" "//less than 17
						+"GROUP BY patient.PatNum";//there will frequently be multiple procedurelog events
					Db.NonQ(command);
					//find any BMIs within the period that indicate pregnancy
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.IsPregnant=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.IsIneligible=1";
					Db.NonQ(command);
					//find any BMIs within the period with a valid BMI
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.HasBMI=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.Height > 0 "
						+"AND vitalsign.Weight > 0";
					Db.NonQ(command);
					//find any BMIs within the period that indicate ChildGotNutrition
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.ChildGotNutrition=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.ChildGotNutrition=1";
					Db.NonQ(command);
					//find any BMIs within the period that indicate ChildGotPhysCouns
					command="UPDATE tempehrquality,vitalsign "
						+"SET tempehrquality.ChildGotPhysCouns=1 "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.DateTaken >= "+POut.Date(dateStart)+" "
						+"AND vitalsign.DateTaken <= "+POut.Date(dateEnd)+" "
						+"AND vitalsign.ChildGotPhysCouns=1";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region ImmunizeChild
				case QualityType.ImmunizeChild_1:
				case QualityType.ImmunizeChild_2:
				case QualityType.ImmunizeChild_3:
				case QualityType.ImmunizeChild_4:
				case QualityType.ImmunizeChild_5:
				case QualityType.ImmunizeChild_6:
				case QualityType.ImmunizeChild_7:
				case QualityType.ImmunizeChild_8:
				case QualityType.ImmunizeChild_9:
				case QualityType.ImmunizeChild_10:
				case QualityType.ImmunizeChild_11:
				case QualityType.ImmunizeChild_12:
					//ImmunizeChild----------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						Birthdate date NOT NULL,
						Count1 tinyint NOT NULL,
						NotGiven1 tinyint NOT NULL,
						Documentation1 varchar(255) NOT NULL,
						Count2 tinyint NOT NULL,
						NotGiven2 tinyint NOT NULL,
						Documentation2 varchar(255) NOT NULL,
						Count3 tinyint NOT NULL,
						NotGiven3 tinyint NOT NULL,
						Documentation3 varchar(255) NOT NULL,
						Count3a tinyint NOT NULL,
						NotGiven3a tinyint NOT NULL,
						Documentation3a varchar(255) NOT NULL,
						Count3b tinyint NOT NULL,
						NotGiven3b tinyint NOT NULL,
						Documentation3b varchar(255) NOT NULL,
						Count3c tinyint NOT NULL,
						NotGiven3c tinyint NOT NULL,
						Documentation3c varchar(255) NOT NULL,
						Count4 tinyint NOT NULL,
						NotGiven4 tinyint NOT NULL,
						Documentation4 varchar(255) NOT NULL,
						Count5 tinyint NOT NULL,
						NotGiven5 tinyint NOT NULL,
						Documentation5 varchar(255) NOT NULL,
						Count6 tinyint NOT NULL,
						NotGiven6 tinyint NOT NULL,
						Documentation6 varchar(255) NOT NULL,
						Count7 tinyint NOT NULL,
						NotGiven7 tinyint NOT NULL,
						Documentation7 varchar(255) NOT NULL,
						Count8 tinyint NOT NULL,
						NotGiven8 tinyint NOT NULL,
						Documentation8 varchar(255) NOT NULL,
						Count9 tinyint NOT NULL,
						NotGiven9 tinyint NOT NULL,
						Documentation9 varchar(255) NOT NULL,
						Count10 tinyint NOT NULL,
						NotGiven10 tinyint NOT NULL,
						Documentation10 varchar(255) NOT NULL
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName,Birthdate) SELECT patient.PatNum,LName,FName,Birthdate "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE DATE_ADD(Birthdate,INTERVAL 2 YEAR) >= "+POut.Date(dateStart)+" "//second birthdate is in meas period
						+"AND DATE_ADD(Birthdate,INTERVAL 2 YEAR) <= "+POut.Date(dateEnd)+" "
						+"GROUP BY patient.PatNum";
					Db.NonQ(command);
					#region DTaP
					//Count1, DTaP
					command="UPDATE tempehrquality "
						+"SET Count1=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) >= DATE_ADD(tempehrquality.Birthdate,INTERVAL 42 DAY) "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('110','120','20','50'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven1=1,Documentation1=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('110','120','20','50')";
					Db.NonQ(command);
					#endregion
					#region IPV
					//Count2, IPV
					command="UPDATE tempehrquality "
						+"SET Count2=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) >= DATE_ADD(tempehrquality.Birthdate,INTERVAL 42 DAY) "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('10','120'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven2=1,Documentation2=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('10','120')";
					Db.NonQ(command);
					#endregion
					#region MMR
					//Count3, MMR
					command="UPDATE tempehrquality "
						+"SET Count3=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('03','94'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven3=1,Documentation3=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('03','94')";
					Db.NonQ(command);
					#endregion
					#region measles
					//Count3a, measles
					command="UPDATE tempehrquality "
						+"SET Count3a=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('05'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven3a=1,Documentation3a=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('05')";
					Db.NonQ(command);
					#endregion
					#region mumps
					//Count3b, mumps
					command="UPDATE tempehrquality "
						+"SET Count3b=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('07'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven3b=1,Documentation3b=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('07')";
					Db.NonQ(command);
					#endregion
					#region rubella
					//Count3c, rubella
					command="UPDATE tempehrquality "
						+"SET Count3c=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('06'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven3c=1,Documentation3c=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('06')";
					Db.NonQ(command);
					#endregion
					#region HiB
					//Count4, HiB
					command="UPDATE tempehrquality "
						+"SET Count4=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) >= DATE_ADD(tempehrquality.Birthdate,INTERVAL 42 DAY) "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('120','46','47','48','49','50','51'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven4=1,Documentation4=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('120','46','47','48','49','50','51')";
					Db.NonQ(command);
					#endregion
					#region HepB
					//Count5, HepB
					command="UPDATE tempehrquality "
						+"SET Count5=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('08','110','44','51'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven5=1,Documentation5=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('08','110','44','51')";
					Db.NonQ(command);
					#endregion
					#region VZV
					//Count6, VZV
					command="UPDATE tempehrquality "
						+"SET Count6=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('21','94'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven6=1,Documentation6=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('21','94')";
					Db.NonQ(command);
					#endregion
					#region pneumococcal
					//Count7, pneumococcal
					command="UPDATE tempehrquality "
						+"SET Count7=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) >= DATE_ADD(tempehrquality.Birthdate,INTERVAL 42 DAY) "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('100','133'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven7=1,Documentation7=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('100','133')";
					Db.NonQ(command);
					#endregion
					#region HepA
					//Count8, HepA
					command="UPDATE tempehrquality "
						+"SET Count8=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('83'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven8=1,Documentation8=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('83')";
					Db.NonQ(command);
					#endregion
					#region rotavirus
					//Count9, rotavirus
					command="UPDATE tempehrquality "
						+"SET Count9=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) >= DATE_ADD(tempehrquality.Birthdate,INTERVAL 42 DAY) "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('116','119'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven9=1,Documentation9=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('116','119')";
					Db.NonQ(command);
					#endregion
					#region influenza
					//Count10, influenza
					command="UPDATE tempehrquality "
						+"SET Count10=(SELECT COUNT(DISTINCT VaccinePatNum) FROM vaccinepat "
						+"LEFT JOIN vaccinedef ON vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"WHERE tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=0 "
						+"AND DATE(DateTimeStart) >= DATE_ADD(tempehrquality.Birthdate,INTERVAL 180 DAY) "
						+"AND DATE(DateTimeStart) < DATE_ADD(tempehrquality.Birthdate,INTERVAL 2 YEAR) "
						+"AND vaccinedef.CVXCode IN('135','15'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality,vaccinepat,vaccinedef "
						+"SET NotGiven10=1,Documentation10=Note "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND NotGiven=1 "
						+"AND vaccinedef.CVXCode IN('135','15')";
					Db.NonQ(command);
					#endregion
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region Pneumonia
				case QualityType.Pneumonia:
					//Pneumonia----------------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						DateVaccine date NOT NULL
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName) SELECT patient.PatNum,LName,FName "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateEnd.AddYears(-1))+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate > '1880-01-01' AND Birthdate <= "+POut.Date(dateStart.AddYears(-65))+" "//65 or older as of dateEnd
						+"GROUP BY patient.PatNum";
					Db.NonQ(command);
					//find most recent vaccine date
					command="UPDATE tempehrquality "
						+"SET tempehrquality.DateVaccine=(SELECT MAX(DATE(vaccinepat.DateTimeStart)) "
						+"FROM vaccinepat,vaccinedef "
						+"WHERE vaccinepat.VaccineDefNum=vaccinedef.VaccineDefNum "
						+"AND tempehrquality.PatNum=vaccinepat.PatNum "
						+"AND vaccinepat.NotGiven=0 "
						+"AND vaccinedef.CVXCode IN('33','100','133'))";
					Db.NonQ(command);
					command="UPDATE tempehrquality SET DateVaccine='0001-01-01' WHERE DateVaccine='0000-00-00'";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region DiabetesBloodPressure
				case QualityType.DiabetesBloodPressure:
					//DiabetesBloodPressure-------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						HasMedication tinyint NOT NULL,
						HasDiagnosisDiabetes tinyint NOT NULL,
						DateBP date NOT NULL,
						Systolic int NOT NULL,
						Diastolic int NOT NULL,
						HasDiagnosisPolycystic tinyint NOT NULL,
						HasDiagnosisAcuteDiabetes tinyint NOT NULL
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName) SELECT patient.PatNum,LName,FName "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate <= "+POut.Date(dateStart.AddYears(-17))+" "
						+"AND Birthdate >= "+POut.Date(dateStart.AddYears(-74))+" "//17-74 before dateStart
						+"GROUP BY patient.PatNum";
					Db.NonQ(command);
					//Medication
					command="UPDATE tempehrquality "
						+"SET HasMedication = 1 "
						+"WHERE (SELECT COUNT(*) "
						+"FROM medicationpat "
						+"WHERE medicationpat.PatNum=tempehrquality.PatNum "
						+"AND medicationpat.RxCui IN(199149, 199150, 200132, 205329, 205330, 205331, 401938,"//alph-glucosidas
						+"200256, 200257, 200258, 311919, 314142, 389139, 861035, 861039, 861042, 861044, 861787, 861790,"//amylin analogs
						+"744863 , 847910 , 847915,"//antidiabetic
						+"602544, 602549, 602550, 647237, 647239, 706895, 706896, 861731, 861736, 861740, 861743, 861748, 861753, 861760, 861763, 861769, 861783, 861787, 861790, 861795, 861806, 861816, 861819, 861822,"//antidiabetic combos
						+"665033, 665038, 665042, 860975, 860978, 860981, 860984, 860996, 860999, 861004, 861007, 861010, 861021, 861025, 861731, 861736, 861740, 861743, 861748, 861753, 861760, 861763, 861769, 861783, 861787, 861790, 861795, 861806, 861816, 861819, 861822,"//Biguanides
						+"205314, 237527, 242120, 242916, 242917, 259111, 260265, 283394, 311040, 311041, 311053, 311054, 311055, 311056, 311057, 311058, 311059, 311060, 311061, 314038, 317800, 351297, 358349, 484322, 485210, 544614, 763002, 763007, 763013, 763014, 833159, 847191, 847207, 847211, 847230, 847239, 847252, 847259, 847263, 847416,"//insulin
						+"200256, 200257, 200258, 311919, 314142, 389139,"//meglitinides
						+"105374, 153842, 197306, 197307, 197495, 197496, 197737, 198291, 198292, 198293, 198294, 199245, 199246, 199247, 199825, 199984, 199985, 200065, 252960, 310488, 310489, 310490, 310534, 310536, 310537, 310539, 312440, 312441, 312859, 312860, 312861, 313418, 313419, 314000, 314006, 315107, 315239, 317573, 379804, 389137, 602544, 602549, 602550, 647237, 647239, 706895, 706896, 757710, 757712, 844809, 844824, 844827, 861731, 861736, 861740, 861743, 861748, 861753, 861760, 861763, 861783, 861795, 861806, 861816, 861822,"//Sulfonylureas
						+"312440, 312441, 312859, 312860, 312861, 317573) "//Thiazolidinediones
						+"AND (DateStop >= "+POut.Date(dateEnd.AddYears(-2))+" "//med active <= 2 years before or simultaneous to end date
						+"OR DateStop < '1880-01-01') "//or still active
						+") > 0";
					Db.NonQ(command);
					//HasDiagnosisDiabetes
					command="UPDATE tempehrquality "
						+"SET HasDiagnosisDiabetes = 1 "
						+"WHERE (SELECT COUNT(*) "
						+"FROM disease,diseasedef "
						+"WHERE disease.DiseaseDefNum=diseasedef.DiseaseDefNum "
						+"AND disease.PatNum=tempehrquality.PatNum "
						+"AND (diseasedef.ICD9Code LIKE '250%' "
						+"OR diseasedef.ICD9Code LIKE '357.2' "
						+"OR diseasedef.ICD9Code LIKE '362.0%' "
						+"OR diseasedef.ICD9Code LIKE '366.41' "
						+"OR diseasedef.ICD9Code LIKE '648.0%') "
						+"AND (disease.DateStart <= "+POut.Date(dateEnd)+" "//if there is a start date, it can't be after the period end.
						+"OR disease.DateStart < '1880-01-01') "//no startdate
						+"AND (disease.DateStop >= "+POut.Date(dateEnd.AddYears(-2))+" "//if there's a datestop, it can't have stopped more than 2 years ago.
							//Specs say: diagnosis active <= 2 years before or simultaneous to end date
						+"OR disease.DateStop < '1880-01-01') "//or still active
						+") > 0";
					Db.NonQ(command);
					//DateBP
					command="UPDATE tempehrquality "
						+"SET tempehrquality.DateBP=(SELECT MAX(vitalsign.DateTaken) "
						+"FROM vitalsign "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.BpSystolic != 0 "
						+"AND vitalsign.BpDiastolic != 0 "
						+"GROUP BY vitalsign.PatNum)";
					Db.NonQ(command);
					command="UPDATE tempehrquality SET DateBP='0001-01-01' WHERE DateBP='0000-00-00'";
					Db.NonQ(command);
					//Systolic and diastolic
					command="UPDATE tempehrquality,vitalsign "
						+"SET Systolic=BpSystolic, "
						+"Diastolic=BpDiastolic "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND tempehrquality.DateBP=vitalsign.DateTaken";
					Db.NonQ(command);
					//HasDiagnosisPolycystic
					command="UPDATE tempehrquality "
						+"SET HasDiagnosisPolycystic = 1 "
						+"WHERE (SELECT COUNT(*) "
						+"FROM disease,diseasedef "
						+"WHERE disease.DiseaseDefNum=diseasedef.DiseaseDefNum "
						+"AND disease.PatNum=tempehrquality.PatNum "
						+"AND diseasedef.ICD9Code = '256.4' "
						+"AND (disease.DateStart <= "+POut.Date(dateEnd)+" "//if there's a datestart, it can't be after period end
						+"OR disease.DateStart < '1880-01-01') "
						//no restrictions on datestop.  It could still be active or could have stopped before or after the period end.
						+") > 0";
					Db.NonQ(command);
					//HasDiagnosisAcuteDiabetes
					command="UPDATE tempehrquality "
						+"SET HasDiagnosisAcuteDiabetes = 1 "
						+"WHERE (SELECT COUNT(*) "
						+"FROM disease,diseasedef "
						+"WHERE disease.DiseaseDefNum=diseasedef.DiseaseDefNum "
						+"AND disease.PatNum=tempehrquality.PatNum "
						+"AND (diseasedef.ICD9Code LIKE '249%' OR diseasedef.ICD9Code='251.8' OR diseasedef.ICD9Code='962.0' "//steroid induced
						+"OR diseasedef.ICD9Code LIKE '648.8%') "//gestational
						+"AND (disease.DateStart <= "+POut.Date(dateEnd)+" "//if there's a datestart, it can't be after period end
						+"OR disease.DateStart < '1880-01-01') "
						//no restrictions on datestop.  It could still be active or could have stopped before or after the period end.
						+") > 0";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				#region BloodPressureManage
				case QualityType.BloodPressureManage:
					//DiabetesBloodPressure-------------------------------------------------------------------------------------------------------
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					command=@"CREATE TABLE tempehrquality (
						PatNum bigint NOT NULL PRIMARY KEY,
						LName varchar(255) NOT NULL,
						FName varchar(255) NOT NULL,
						HasDiagnosisHypertension tinyint NOT NULL,
						HasProcedureESRD tinyint NOT NULL,
						HasDiagnosisPregnancy tinyint NOT NULL,
						HasDiagnosisESRD tinyint NOT NULL,
						DateBP date NOT NULL,
						Systolic int NOT NULL,
						Diastolic int NOT NULL
						) DEFAULT CHARSET=utf8";
					Db.NonQ(command);
					command="INSERT INTO tempehrquality (PatNum,LName,FName) SELECT patient.PatNum,LName,FName "
						+"FROM patient "
						+"INNER JOIN procedurelog "
						+"ON Patient.PatNum=procedurelog.PatNum "
						+"AND procedurelog.ProcStatus=2 "//complete
						+"AND procedurelog.ProvNum="+POut.Long(provNum)+" "
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+"WHERE Birthdate <= "+POut.Date(dateStart.AddYears(-17))+" "
						+"AND Birthdate >= "+POut.Date(dateStart.AddYears(-74))+" "//17-74 before dateStart
						+"GROUP BY patient.PatNum";
					Db.NonQ(command);
					//HasDiagnosisHypertension
					command="UPDATE tempehrquality "
						+"SET HasDiagnosisHypertension = 1 "
						+"WHERE (SELECT COUNT(*) "
						+"FROM disease,diseasedef "
						+"WHERE disease.DiseaseDefNum=diseasedef.DiseaseDefNum "
						+"AND disease.PatNum=tempehrquality.PatNum "
						+"AND diseasedef.ICD9Code LIKE '401%' "
						+"AND (disease.DateStart <= "+POut.Date(dateStart.AddMonths(6))+" "//if there is a start date, it can't be after this point
						+"OR disease.DateStart < '1880-01-01') "//no startdate
						//no restrictions on datestop.  It could still be active or could have stopped before or after the period end.
						+") > 0";
					Db.NonQ(command);
					command="DELETE FROM tempehrquality WHERE HasDiagnosisHypertension=0";//for speed
					Db.NonQ(command);
					//HasProcedureESRD
					command="UPDATE tempehrquality "
						+"SET HasProcedureESRD = 1 "
						+"WHERE (SELECT COUNT(*) "
						+"FROM procedurelog,procedurecode "
						+"WHERE procedurelog.CodeNum=procedurecode.CodeNum "
						+"AND procedurelog.PatNum=tempehrquality.PatNum "
						+"AND procedurecode.ProcCode IN ('36145','36147','36148','36800', '36810','36815','36818','36819','36820', '36821','36831', '36832', '36833', '50300', '50320','50340','50360','50365','50370', '50380','90920','90921','90924','90925', '90935','90937', '90940','90945', '90947', '90957', '90958','90959','90960','90961','90962','90965','90966','90969','90970','90989','90993','90997','90999','99512') "//ESRD
						+"AND procedurelog.ProcDate >= "+POut.Date(dateStart)+" "
						+"AND procedurelog.ProcDate <= "+POut.Date(dateEnd)+" "
						+") > 0";
					Db.NonQ(command);
					//HasDiagnosisPregnancy
					command="UPDATE tempehrquality "
						+"SET HasDiagnosisPregnancy = 1 "
						+"WHERE (SELECT COUNT(*) "
						+"FROM disease,diseasedef "
						+"WHERE disease.DiseaseDefNum=diseasedef.DiseaseDefNum "
						+"AND disease.PatNum=tempehrquality.PatNum "
						+"AND (diseasedef.ICD9Code LIKE '63%' "
						+"OR diseasedef.ICD9Code LIKE '64%' "
						+"OR diseasedef.ICD9Code LIKE '65%' "
						+"OR diseasedef.ICD9Code LIKE '66%' "
						+"OR diseasedef.ICD9Code LIKE '67%' "
						+"OR diseasedef.ICD9Code LIKE 'V22%' "
						+"OR diseasedef.ICD9Code LIKE 'V23%' "
						+"OR diseasedef.ICD9Code LIKE 'V28%') "
						//active during the period
						+"AND (disease.DateStart <= "+POut.Date(dateEnd)+" "//if there is a start date, it can't be after the period end.
						+"OR disease.DateStart < '1880-01-01') "//no startdate
						+"AND (disease.DateStop >= "+POut.Date(dateStart)+" "//if there's a datestop, it can't have stopped before the period.
						+"OR disease.DateStop < '1880-01-01') "//or still active
						+") > 0";
					Db.NonQ(command);
					//HasDiagnosisESRD
					command="UPDATE tempehrquality "
						+"SET HasDiagnosisESRD = 1 "
						+"WHERE (SELECT COUNT(*) "
						+"FROM disease,diseasedef "
						+"WHERE disease.DiseaseDefNum=diseasedef.DiseaseDefNum "
						+"AND disease.PatNum=tempehrquality.PatNum "
						+"AND (diseasedef.ICD9Code LIKE '38.95' "
						+"OR diseasedef.ICD9Code LIKE '39%' "
						+"OR diseasedef.ICD9Code LIKE '54.98' "
						+"OR diseasedef.ICD9Code LIKE '55.6%' "
						+"OR diseasedef.ICD9Code LIKE '585%' "
						+"OR diseasedef.ICD9Code LIKE 'V42.0%' "
						+"OR diseasedef.ICD9Code LIKE 'V45.1%' "
						+"OR diseasedef.ICD9Code LIKE 'V56%') "
						//active during the period
						+"AND (disease.DateStart <= "+POut.Date(dateEnd)+" "
						+"OR disease.DateStart < '1880-01-01') "
						+"AND (disease.DateStop >= "+POut.Date(dateStart)+" "
						+"OR disease.DateStop < '1880-01-01') "
						+") > 0";
					Db.NonQ(command);
					//DateBP
					command="UPDATE tempehrquality "
						+"SET tempehrquality.DateBP=(SELECT MAX(vitalsign.DateTaken) "
						+"FROM vitalsign "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND vitalsign.BpSystolic != 0 "
						+"AND vitalsign.BpDiastolic != 0 "
						+"GROUP BY vitalsign.PatNum)";
					Db.NonQ(command);
					command="UPDATE tempehrquality SET DateBP='0001-01-01' WHERE DateBP='0000-00-00'";
					Db.NonQ(command);
					//Systolic and diastolic
					command="UPDATE tempehrquality,vitalsign "
						+"SET Systolic=BpSystolic, "
						+"Diastolic=BpDiastolic "
						+"WHERE tempehrquality.PatNum=vitalsign.PatNum "
						+"AND tempehrquality.DateBP=vitalsign.DateTaken";
					Db.NonQ(command);
					command="SELECT * FROM tempehrquality";
					tableRaw=Db.GetTable(command);
					command="DROP TABLE IF EXISTS tempehrquality";
					Db.NonQ(command);
					break;
				#endregion
				default:
					throw new ApplicationException("Type not found: "+qtype.ToString());
			}
			//PatNum, PatientName, Numerator(X), and Exclusion(X).
			DataTable table=new DataTable("audit");
			DataRow row;
			table.Columns.Add("PatNum");
			table.Columns.Add("patientName");
			table.Columns.Add("numerator");//X
			table.Columns.Add("exclusion");//X
			table.Columns.Add("explanation");
			List<DataRow> rows=new List<DataRow>();
			Patient pat;
			//string explanation;
			for(int i=0;i<tableRaw.Rows.Count;i++) {
				row=table.NewRow();
				row["PatNum"]=tableRaw.Rows[i]["PatNum"].ToString();
				pat=new Patient();
				pat.LName=tableRaw.Rows[i]["LName"].ToString();
				pat.FName=tableRaw.Rows[i]["FName"].ToString();
				pat.Preferred="";
				row["patientName"]=pat.GetNameLF();
				row["numerator"]="";
				row["exclusion"]="";
				row["explanation"]="";
				float weight=0;
				float height=0;
				float bmi=0;
				DateTime dateVisit;
				int visitCount;
				switch(qtype) {
					#region WeightOver65
					case QualityType.WeightOver65:
						//WeightOver65-----------------------------------------------------------------------------------------------------------------
						weight=PIn.Float(tableRaw.Rows[i]["Weight"].ToString());
						height=PIn.Float(tableRaw.Rows[i]["Height"].ToString());
						bmi=Vitalsigns.CalcBMI(weight,height);
						bool hasFollowupPlan=PIn.Bool(tableRaw.Rows[i]["HasFollowupPlan"].ToString());
						bool isIneligible=PIn.Bool(tableRaw.Rows[i]["IsIneligible"].ToString());
						string documentation=tableRaw.Rows[i]["Documentation"].ToString();
						if(bmi==0){
							row["explanation"]="No BMI";
						}
						else if(bmi < 22) {
							row["explanation"]="Underweight";
							if(hasFollowupPlan) {
								row["explanation"]+=", has followup plan: "+documentation;
								row["numerator"]="X";
							}
						}
						else if(bmi < 30) {
							row["numerator"]="X";
							row["explanation"]="Normal weight";
						}
						else {
							row["explanation"]="Overweight";
							if(hasFollowupPlan) {
								row["explanation"]+=", has followup plan: "+documentation;
								row["numerator"]="X";
							}
						}
						if(isIneligible) {
							row["exclusion"]="X";
							row["explanation"]+=", "+documentation;
						}
						break;
					#endregion
					#region WeightAdult
					case QualityType.WeightAdult:
						//WeightAdult-----------------------------------------------------------------------------------------------------------------
						weight=PIn.Float(tableRaw.Rows[i]["Weight"].ToString());
						height=PIn.Float(tableRaw.Rows[i]["Height"].ToString());
						bmi=Vitalsigns.CalcBMI(weight,height);
						hasFollowupPlan=PIn.Bool(tableRaw.Rows[i]["HasFollowupPlan"].ToString());
						isIneligible=PIn.Bool(tableRaw.Rows[i]["IsIneligible"].ToString());
						documentation=tableRaw.Rows[i]["Documentation"].ToString();
						if(bmi==0){
							row["explanation"]="No BMI";
						}
						else if(bmi < 18.5f) {
							row["explanation"]="Underweight";
							if(hasFollowupPlan) {
								row["explanation"]+=", has followup plan: "+documentation;
								row["numerator"]="X";
							}
						}
						else if(bmi < 25) {
							row["numerator"]="X";
							row["explanation"]="Normal weight";
						}
						else {
							row["explanation"]="Overweight";
							if(hasFollowupPlan) {
								row["explanation"]+=", has followup plan: "+documentation;
								row["numerator"]="X";
							}
						}
						if(isIneligible) {
							row["exclusion"]="X";
							row["explanation"]+=", "+documentation;
						}
						break;
					#endregion
					#region Hypertension
					case QualityType.Hypertension:
						//Hypertension---------------------------------------------------------------------------------------------------------------------
						dateVisit=PIn.Date(tableRaw.Rows[i]["DateVisit"].ToString());
						visitCount=PIn.Int(tableRaw.Rows[i]["VisitCount"].ToString());
						string icd9code=tableRaw.Rows[i]["Icd9Code"].ToString();
						DateTime datePbEntered=PIn.Date(tableRaw.Rows[i]["DateBpEntered"].ToString());
						if(dateVisit<dateStart || dateVisit>dateEnd) {//no visits in the measurement period
							continue;//don't add this row.  Not part of denominator.
						}
						if(visitCount<2) {
							continue;
						}
						if(icd9code=="") {
							continue;
						}
						if(datePbEntered.Year<1880) {//no bp entered
							row["explanation"]="No BP entered";
						}
						else {
							row["numerator"]="X";
							row["explanation"]="BP entered";
						}
						break;
					#endregion
					#region TobaccoUse
					case QualityType.TobaccoUse:
						//TobaccoUse---------------------------------------------------------------------------------------------------------------------
						dateVisit=PIn.Date(tableRaw.Rows[i]["DateVisit"].ToString());
						//visitCount=PIn.Int(tableRaw.Rows[i]["VisitCount"].ToString());
						DateTime dateAssessment=PIn.Date(tableRaw.Rows[i]["DateAssessment"].ToString());
						if(dateVisit<dateStart || dateVisit>dateEnd) {//no visits in the measurement period
							continue;//don't add this row.  Not part of denominator.
						}
						//if(visitCount<2) {//no, as explained in comments in GetDenominatorExplain().
						//	continue;
						//}
						if(dateAssessment.Year<1880) {
							row["explanation"]="No tobacco use entered.";
						}
						else if(dateAssessment < dateVisit.AddYears(-2)) {
							row["explanation"]="No tobacco use entered within timeframe.";
						}
						else{
							row["numerator"]="X";
							row["explanation"]="Tobacco use entered.";
						}
						break;
					#endregion
					#region TobaccoCessation
					case QualityType.TobaccoCessation:
						//TobaccoCessation----------------------------------------------------------------------------------------------------------------
						dateVisit=PIn.Date(tableRaw.Rows[i]["DateVisit"].ToString());
						dateAssessment=PIn.Date(tableRaw.Rows[i]["DateAssessment"].ToString());
						DateTime DateCessation=PIn.Date(tableRaw.Rows[i]["DateCessation"].ToString());
						documentation=tableRaw.Rows[i]["Documentation"].ToString();
						if(dateVisit<dateStart || dateVisit>dateEnd) {//no visits in the measurement period
							continue;//don't add this row.  Not part of denominator.
						}
						else if(dateAssessment < dateVisit.AddYears(-2)) {
							continue;//no assessment within 24 months, so not part of denominator.
						}
						else if(DateCessation.Year<1880) {
							row["explanation"]="No tobacco cessation entered.";
						}
						else if(DateCessation < dateVisit.AddYears(-2)) {
							row["explanation"]="No tobacco cessation entered within timeframe.";
						}
						else {
							row["numerator"]="X";
							row["explanation"]="Tobacco cessation: "+documentation;
						}
						break;
					#endregion
					#region InfluenzaAdult
					case QualityType.InfluenzaAdult:
						//InfluenzaAdult----------------------------------------------------------------------------------------------------------------
						DateTime DateVaccine=PIn.Date(tableRaw.Rows[i]["DateVaccine"].ToString());
						bool notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven"].ToString());
						documentation=tableRaw.Rows[i]["Documentation"].ToString();
						if(DateVaccine.Year<1880) {
							row["explanation"]="No influenza vaccine given";
						}
						else if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No influenza vaccine given, "+documentation;
						}
						else {
							row["numerator"]="X";
							row["explanation"]="Influenza vaccine given";
						}
						break;
					#endregion
					#region WeightChild_1_1
					case QualityType.WeightChild_1_1:
						//WeightChild_1_1----------------------------------------------------------------------------------------------------------------
						bool isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						bool hasBMI=PIn.Bool(tableRaw.Rows[i]["HasBMI"].ToString());
						if(isPregnant) {
							continue;
						}
						if(hasBMI) {
							row["numerator"]="X";
							row["explanation"]="BMI entered";
						}
						else {
							row["explanation"]="No BMI entered";
						}
						break;
					#endregion
					#region WeightChild_1_2
					case QualityType.WeightChild_1_2:
						//WeightChild_1_2----------------------------------------------------------------------------------------------------------------
						isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						bool ChildGotNutrition=PIn.Bool(tableRaw.Rows[i]["ChildGotNutrition"].ToString());
						if(isPregnant) {
							continue;
						}
						if(ChildGotNutrition) {
							row["numerator"]="X";
							row["explanation"]="Counseled for nutrition";
						}
						else {
							row["explanation"]="Not counseled for nutrition";
						}
						break;
					#endregion
					#region WeightChild_1_3
					case QualityType.WeightChild_1_3:
						//WeightChild_1_3----------------------------------------------------------------------------------------------------------------
						isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						bool ChildGotPhysCouns=PIn.Bool(tableRaw.Rows[i]["ChildGotPhysCouns"].ToString());
						if(isPregnant) {
							continue;
						}
						if(ChildGotPhysCouns) {
							row["numerator"]="X";
							row["explanation"]="Counseled for physical activity";
						}
						else {
							row["explanation"]="Not counseled for physical activity";
						}
						break;
					#endregion
					#region WeightChild_2_1
					case QualityType.WeightChild_2_1:
						//WeightChild_2_1----------------------------------------------------------------------------------------------------------------
						isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						hasBMI=PIn.Bool(tableRaw.Rows[i]["HasBMI"].ToString());
						if(isPregnant) {
							continue;
						}
						if(hasBMI) {
							row["numerator"]="X";
							row["explanation"]="BMI entered";
						}
						else {
							row["explanation"]="No BMI entered";
						}
						break;
					#endregion
					#region WeightChild_2_2
					case QualityType.WeightChild_2_2:
						//WeightChild_2_2----------------------------------------------------------------------------------------------------------------
						isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						ChildGotNutrition=PIn.Bool(tableRaw.Rows[i]["ChildGotNutrition"].ToString());
						if(isPregnant) {
							continue;
						}
						if(ChildGotNutrition) {
							row["numerator"]="X";
							row["explanation"]="Counseled for nutrition";
						}
						else {
							row["explanation"]="Not counseled for nutrition";
						}
						break;
					#endregion
					#region WeightChild_2_3
					case QualityType.WeightChild_2_3:
						//WeightChild_2_3----------------------------------------------------------------------------------------------------------------
						isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						ChildGotPhysCouns=PIn.Bool(tableRaw.Rows[i]["ChildGotPhysCouns"].ToString());
						if(isPregnant) {
							continue;
						}
						if(ChildGotPhysCouns) {
							row["numerator"]="X";
							row["explanation"]="Counseled for physical activity";
						}
						else {
							row["explanation"]="Not counseled for physical activity";
						}
						break;
					#endregion
					#region WeightChild_3_1
					case QualityType.WeightChild_3_1:
						//WeightChild_3_1----------------------------------------------------------------------------------------------------------------
						isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						hasBMI=PIn.Bool(tableRaw.Rows[i]["HasBMI"].ToString());
						if(isPregnant) {
							continue;
						}
						if(hasBMI) {
							row["numerator"]="X";
							row["explanation"]="BMI entered";
						}
						else {
							row["explanation"]="No BMI entered";
						}
						break;
					#endregion
					#region WeightChild_3_2
					case QualityType.WeightChild_3_2:
						//WeightChild_3_2----------------------------------------------------------------------------------------------------------------
						isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						ChildGotNutrition=PIn.Bool(tableRaw.Rows[i]["ChildGotNutrition"].ToString());
						if(isPregnant) {
							continue;
						}
						if(ChildGotNutrition) {
							row["numerator"]="X";
							row["explanation"]="Counseled for nutrition";
						}
						else {
							row["explanation"]="Not counseled for nutrition";
						}
						break;
					#endregion
					#region WeightChild_3_3
					case QualityType.WeightChild_3_3:
						//WeightChild_3_3----------------------------------------------------------------------------------------------------------------
						isPregnant=PIn.Bool(tableRaw.Rows[i]["IsPregnant"].ToString());
						ChildGotPhysCouns=PIn.Bool(tableRaw.Rows[i]["ChildGotPhysCouns"].ToString());
						if(isPregnant) {
							continue;
						}
						if(ChildGotPhysCouns) {
							row["numerator"]="X";
							row["explanation"]="Counseled for physical activity";
						}
						else {
							row["explanation"]="Not counseled for physical activity";
						}
						break;
					#endregion
					#region ImmunizeChild_1
					case QualityType.ImmunizeChild_1:
						//ImmunizeChild_1--------------------------------------------------------------------------------------------------------------
						int count=PIn.Int(tableRaw.Rows[i]["Count1"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven1"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation1"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No DTaP vaccine given, "+documentation;
						}
						else if(count>=4) {
							row["numerator"]="X";
							row["explanation"]="DTaP vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="DTaP vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_2
					case QualityType.ImmunizeChild_2:
						//ImmunizeChild_2--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count2"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven2"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation2"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No IPV vaccine given, "+documentation;
						}
						else if(count>=3) {
							row["numerator"]="X";
							row["explanation"]="IPV vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="IPV vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_3
					case QualityType.ImmunizeChild_3:
						//ImmunizeChild_3--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count3"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven3"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation3"].ToString());
						int count3a=PIn.Int(tableRaw.Rows[i]["Count3a"].ToString());
						bool notGiven3a=PIn.Bool(tableRaw.Rows[i]["NotGiven3a"].ToString());
						string documentation3a=PIn.String(tableRaw.Rows[i]["Documentation3a"].ToString());
						int count3b=PIn.Int(tableRaw.Rows[i]["Count3b"].ToString());
						bool notGiven3b=PIn.Bool(tableRaw.Rows[i]["NotGiven3b"].ToString());
						string documentation3b=PIn.String(tableRaw.Rows[i]["Documentation3b"].ToString());
						int count3c=PIn.Int(tableRaw.Rows[i]["Count3c"].ToString());
						bool notGiven3c=PIn.Bool(tableRaw.Rows[i]["NotGiven3c"].ToString());
						string documentation3c=PIn.String(tableRaw.Rows[i]["Documentation3c"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No MMR vaccine given, "+documentation;
						}
						else if(notGiven3a) {
							row["exclusion"]="X";
							row["explanation"]+="No measles vaccine given, "+documentation3a;
						}
						else if(notGiven3b) {
							row["exclusion"]="X";
							row["explanation"]+="No mumps vaccine given, "+documentation3b;
						}
						else if(notGiven3c) {
							row["exclusion"]="X";
							row["explanation"]+="No rubella vaccine given, "+documentation3c;
						}
						else if(count>=1) {
							row["numerator"]="X";
							row["explanation"]="MMR vaccinations: "+count.ToString();
						}
						else if(count3a>=1 && count3b>=1 && count3c>=1) {
							row["numerator"]="X";
							row["explanation"]="MMR individual vaccinations given.";
						}
						else {
							row["explanation"]="MMR vaccination not given";
						}
						break;
					#endregion
					#region ImmunizeChild_4
					case QualityType.ImmunizeChild_4:
						//ImmunizeChild_4--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count4"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven4"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation4"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No HiB vaccine given, "+documentation;
						}
						else if(count>=2) {
							row["numerator"]="X";
							row["explanation"]="HiB vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="HiB vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_5
					case QualityType.ImmunizeChild_5:
						//ImmunizeChild_5--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count5"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven5"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation5"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No hepatitis B vaccine given, "+documentation;
						}
						else if(count>=3) {
							row["numerator"]="X";
							row["explanation"]="hepatitis B vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="hepatitis B vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_6
					case QualityType.ImmunizeChild_6:
						//ImmunizeChild_6--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count6"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven6"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation6"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No VZV vaccine given, "+documentation;
						}
						else if(count>=1) {
							row["numerator"]="X";
							row["explanation"]="VZV vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="VZV vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_7
					case QualityType.ImmunizeChild_7:
						//ImmunizeChild_7--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count7"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven7"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation7"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No pneumococcal vaccine given, "+documentation;
						}
						else if(count>=4) {
							row["numerator"]="X";
							row["explanation"]="pneumococcal vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="pneumococcal vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_8
					case QualityType.ImmunizeChild_8:
						//ImmunizeChild_8--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count8"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven8"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation8"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No hepatitis A vaccine given, "+documentation;
						}
						else if(count>=2) {
							row["numerator"]="X";
							row["explanation"]="hepatitis A vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="hepatitis A vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_9
					case QualityType.ImmunizeChild_9:
						//ImmunizeChild_9--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count9"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven9"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation9"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No rotavirus vaccine given, "+documentation;
						}
						else if(count>=2) {
							row["numerator"]="X";
							row["explanation"]="rotavirus vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="rotavirus vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_10
					case QualityType.ImmunizeChild_10:
						//ImmunizeChild_10--------------------------------------------------------------------------------------------------------------
						count=PIn.Int(tableRaw.Rows[i]["Count10"].ToString());
						notGiven=PIn.Bool(tableRaw.Rows[i]["NotGiven10"].ToString());
						documentation=PIn.String(tableRaw.Rows[i]["Documentation10"].ToString());
						if(notGiven) {
							row["exclusion"]="X";
							row["explanation"]+="No influenza vaccine given, "+documentation;
						}
						else if(count>=2) {
							row["numerator"]="X";
							row["explanation"]="influenza vaccinations: "+count.ToString();
						}
						else {
							row["explanation"]="influenza vaccinations: "+count.ToString();
						}
						break;
					#endregion
					#region ImmunizeChild_11
					case QualityType.ImmunizeChild_11:
						int count1=PIn.Int(tableRaw.Rows[i]["Count1"].ToString());
						int count2=PIn.Int(tableRaw.Rows[i]["Count2"].ToString());
						int count3=PIn.Int(tableRaw.Rows[i]["Count3"].ToString());
						count3a=PIn.Int(tableRaw.Rows[i]["Count3a"].ToString());
						count3b=PIn.Int(tableRaw.Rows[i]["Count3b"].ToString());
						count3c=PIn.Int(tableRaw.Rows[i]["Count3c"].ToString());
						int count4=PIn.Int(tableRaw.Rows[i]["Count4"].ToString());
						int count5=PIn.Int(tableRaw.Rows[i]["Count5"].ToString());
						int count6=PIn.Int(tableRaw.Rows[i]["Count6"].ToString());
						bool notGiven1=PIn.Bool(tableRaw.Rows[i]["NotGiven1"].ToString());
						bool notGiven2=PIn.Bool(tableRaw.Rows[i]["NotGiven2"].ToString());
						bool notGiven3=PIn.Bool(tableRaw.Rows[i]["NotGiven3"].ToString());
						notGiven3a=PIn.Bool(tableRaw.Rows[i]["NotGiven3a"].ToString());
						notGiven3b=PIn.Bool(tableRaw.Rows[i]["NotGiven3b"].ToString());
						notGiven3c=PIn.Bool(tableRaw.Rows[i]["NotGiven3c"].ToString());
						bool notGiven4=PIn.Bool(tableRaw.Rows[i]["NotGiven4"].ToString());
						bool notGiven5=PIn.Bool(tableRaw.Rows[i]["NotGiven5"].ToString());
						bool notGiven6=PIn.Bool(tableRaw.Rows[i]["NotGiven6"].ToString());
						if(notGiven1 || notGiven2 || notGiven3 || notGiven3a || notGiven3b || notGiven3c || notGiven4 || notGiven5 || notGiven6) {
							row["exclusion"]="X";
							row["explanation"]+="Not given.";//too complicated to document.
						}
						else if(count1>=4 && count2>=3 
							&& (count3>=1 || (count3a>=1 && count3b>=1 && count3c>=1)) && count4>=2 && count5>=3 && count6>=1) {
							row["numerator"]="X";
							row["explanation"]="All vaccinations given.";
						}
						else {
							row["explanation"]="Missing vaccinations.";
						}
						break;
					#endregion
					#region ImmunizeChild_12
					case QualityType.ImmunizeChild_12:
						//ImmunizeChild_12--------------------------------------------------------------------------------------------------------------
						count1=PIn.Int(tableRaw.Rows[i]["Count1"].ToString());
						count2=PIn.Int(tableRaw.Rows[i]["Count2"].ToString());
						count3=PIn.Int(tableRaw.Rows[i]["Count3"].ToString());
						count3a=PIn.Int(tableRaw.Rows[i]["Count3a"].ToString());
						count3b=PIn.Int(tableRaw.Rows[i]["Count3b"].ToString());
						count3c=PIn.Int(tableRaw.Rows[i]["Count3c"].ToString());
						count4=PIn.Int(tableRaw.Rows[i]["Count4"].ToString());
						count5=PIn.Int(tableRaw.Rows[i]["Count5"].ToString());
						count6=PIn.Int(tableRaw.Rows[i]["Count6"].ToString());
						int count7=PIn.Int(tableRaw.Rows[i]["Count7"].ToString());
						notGiven1=PIn.Bool(tableRaw.Rows[i]["NotGiven1"].ToString());
						notGiven2=PIn.Bool(tableRaw.Rows[i]["NotGiven2"].ToString());
						notGiven3=PIn.Bool(tableRaw.Rows[i]["NotGiven3"].ToString());
						notGiven3a=PIn.Bool(tableRaw.Rows[i]["NotGiven3a"].ToString());
						notGiven3b=PIn.Bool(tableRaw.Rows[i]["NotGiven3b"].ToString());
						notGiven3c=PIn.Bool(tableRaw.Rows[i]["NotGiven3c"].ToString());
						notGiven4=PIn.Bool(tableRaw.Rows[i]["NotGiven4"].ToString());
						notGiven5=PIn.Bool(tableRaw.Rows[i]["NotGiven5"].ToString());
						notGiven6=PIn.Bool(tableRaw.Rows[i]["NotGiven6"].ToString());
						bool notGiven7=PIn.Bool(tableRaw.Rows[i]["NotGiven7"].ToString());
						if(notGiven1 || notGiven2 || notGiven3 || notGiven3a || notGiven3b || notGiven3c || notGiven4 || notGiven5 || notGiven6 || notGiven7) {
							row["exclusion"]="X";
							row["explanation"]+="Not given.";//too complicated to document.
						}
						else if(count1>=4 && count2>=3 
							&& (count3>=1 || (count3a>=1 && count3b>=1 && count3c>=1)) && count4>=2 && count5>=3 && count6>=1 && count7>=4) {
							row["numerator"]="X";
							row["explanation"]="All vaccinations given.";
						}
						else {
							row["explanation"]="Missing vaccinations.";
						}
						break;
					#endregion
					#region Pneumonia
					case QualityType.Pneumonia:
						//Pneumonia----------------------------------------------------------------------------------------------------------------
						DateVaccine=PIn.Date(tableRaw.Rows[i]["DateVaccine"].ToString());
						if(DateVaccine.Year<1880) {
							row["explanation"]="No pneumococcal vaccine given";
						}
						else {
							row["numerator"]="X";
							row["explanation"]="Pneumococcal vaccine given";
						}
						break;
					#endregion
					#region DiabetesBloodPressure
					case QualityType.DiabetesBloodPressure:
						//DiabetesBloodPressure---------------------------------------------------------------------------------------------------
						bool hasMedication=PIn.Bool(tableRaw.Rows[i]["HasMedication"].ToString());
						bool HasDiagnosisDiabetes=PIn.Bool(tableRaw.Rows[i]["HasDiagnosisDiabetes"].ToString());
						DateTime DateBP=PIn.Date(tableRaw.Rows[i]["DateBP"].ToString());
						int systolic=PIn.Int(tableRaw.Rows[i]["Systolic"].ToString());
						int diastolic=PIn.Int(tableRaw.Rows[i]["Diastolic"].ToString());
						bool HasDiagnosisPolycystic=PIn.Bool(tableRaw.Rows[i]["HasDiagnosisPolycystic"].ToString());
						bool HasDiagnosisAcuteDiabetes=PIn.Bool(tableRaw.Rows[i]["HasDiagnosisAcuteDiabetes"].ToString());
						if(!hasMedication && !HasDiagnosisDiabetes) {
							continue;//not part of denominator
						}
						if(HasDiagnosisPolycystic && !HasDiagnosisDiabetes) {
							row["exclusion"]="X";
							row["explanation"]+="polycystic ovaries";
						}
						else if(HasDiagnosisAcuteDiabetes && hasMedication && !HasDiagnosisDiabetes) {
							row["exclusion"]="X";
							row["explanation"]+="gestational or steroid induced diabetes";
						}
						else if(DateBP.Year<1880) {
							row["explanation"]="No BP entered";
						}
						else if(systolic < 90 && diastolic < 140) {
							row["numerator"]="X";
							row["explanation"]="Controlled blood pressure: "+systolic.ToString()+"/"+diastolic.ToString();
						}
						else {
							row["explanation"]="High blood pressure: "+systolic.ToString()+"/"+diastolic.ToString();
						}
						break;
					#endregion
					#region BloodPressureManage
					case QualityType.BloodPressureManage:
						//BloodPressureManage-------------------------------------------------------------------------------------------------------
						bool HasDiagnosisHypertension=PIn.Bool(tableRaw.Rows[i]["HasDiagnosisHypertension"].ToString());
						bool HasProcedureESRD=PIn.Bool(tableRaw.Rows[i]["HasProcedureESRD"].ToString());
						bool HasDiagnosisPregnancy=PIn.Bool(tableRaw.Rows[i]["HasDiagnosisPregnancy"].ToString());
						bool HasDiagnosisESRD=PIn.Bool(tableRaw.Rows[i]["HasDiagnosisESRD"].ToString());
						DateBP=PIn.Date(tableRaw.Rows[i]["DateBP"].ToString());
						systolic=PIn.Int(tableRaw.Rows[i]["Systolic"].ToString());
						diastolic=PIn.Int(tableRaw.Rows[i]["Diastolic"].ToString());
						if(!HasDiagnosisHypertension) {
							continue;//not part of denominator
						}
						if(HasProcedureESRD || HasDiagnosisPregnancy || HasDiagnosisESRD) {
							continue;//not part of denominator
						}
						if(DateBP.Year<1880) {
							row["explanation"]="No BP entered";
						}
						else if(systolic < 90 && diastolic < 140) {
							row["numerator"]="X";
							row["explanation"]="Controlled blood pressure: "+systolic.ToString()+"/"+diastolic.ToString();
						}
						else {
							row["explanation"]="High blood pressure: "+systolic.ToString()+"/"+diastolic.ToString();
						}
						break;
					#endregion
					default:
						throw new ApplicationException("Type not found: "+qtype.ToString());
				}
				rows.Add(row);
			}
			for(int i=0;i<rows.Count;i++) {
				table.Rows.Add(rows[i]);
			}
			return table;
		}
		private static string GetDescript(QualityType qtype) {
			switch(qtype) {
				case QualityType.WeightOver65:
					return "Weight, Adult, 65+";
				case QualityType.WeightAdult:
					return "Weight, Adult, 18 to 64";
				case QualityType.Hypertension:
					return "Hypertension";
				case QualityType.TobaccoUse:
					return "Tobacco Use Assessment";
				case QualityType.TobaccoCessation:
					return "Tobacco Cessation Intervention";
				case QualityType.InfluenzaAdult:
					return "Influenza Immunization, 50+";
				case QualityType.WeightChild_1_1:
					return "Weight, Child 2-16, BMI";
				case QualityType.WeightChild_1_2:
					return "Weight, Child 2-16, nutrition";
				case QualityType.WeightChild_1_3:
					return "Weight, Child 2-16, physical";
				case QualityType.WeightChild_2_1:
					return "Weight, Child 2-10, BMI";
				case QualityType.WeightChild_2_2:
					return "Weight, Child 2-10, nutrition";
				case QualityType.WeightChild_2_3:
					return "Weight, Child 2-10, physical";
				case QualityType.WeightChild_3_1:
					return "Weight, Child 11-16, BMI";
				case QualityType.WeightChild_3_2:
					return "Weight, Child 11-16, nutrition";
				case QualityType.WeightChild_3_3:
					return "Weight, Child 11-16, physical";
				case QualityType.ImmunizeChild_1:
					return "Immun Status, Child, DTaP";
				case QualityType.ImmunizeChild_2:
					return "Immun Status, Child, IPV";
				case QualityType.ImmunizeChild_3:
					return "Immun Status, Child, MMR";
				case QualityType.ImmunizeChild_4:
					return "Immun Status, Child, HiB";
				case QualityType.ImmunizeChild_5:
					return "Immun Status, Child, hep B";
				case QualityType.ImmunizeChild_6:
					return "Immun Status, Child, VZV";
				case QualityType.ImmunizeChild_7:
					return "Immun Status, Child, pneumococcal";
				case QualityType.ImmunizeChild_8:
					return "Immun Status, Child, hep A";
				case QualityType.ImmunizeChild_9:
					return "Immun Status, Child, rotavirus";
				case QualityType.ImmunizeChild_10:
					return "Immun Status, Child, influenza";
				case QualityType.ImmunizeChild_11:
					return "Immun Status, Child, 1-6";
				case QualityType.ImmunizeChild_12:
					return "Immun Status, Child, 1-7";
				case QualityType.Pneumonia:
					return "Pneumonia Immunization, 64+";
				case QualityType.DiabetesBloodPressure:
					return "Diabetes: BP Management";
				case QualityType.BloodPressureManage:
					return "Controlling High BP";
				default:
					throw new ApplicationException("Type not found: "+qtype.ToString());
			}
		}
		private static string GetId(QualityType qtype){
			switch(qtype) {
				case QualityType.WeightOver65:
					return "0421a";
				case QualityType.WeightAdult:
					return "0421b";
				case QualityType.Hypertension:
					return "0013";
				case QualityType.TobaccoUse:
					return "0028a";
				case QualityType.TobaccoCessation:
					return "0028b";
				case QualityType.InfluenzaAdult:
					return "0041";
				case QualityType.WeightChild_1_1:
					return "0024-1.1";
				case QualityType.WeightChild_1_2:
					return "0024-1.2";
				case QualityType.WeightChild_1_3:
					return "0024-1.3";
				case QualityType.WeightChild_2_1:
					return "0024-2.1";
				case QualityType.WeightChild_2_2:
					return "0024-2.2";
				case QualityType.WeightChild_2_3:
					return "0024-2.3";
				case QualityType.WeightChild_3_1:
					return "0024-3.1";
				case QualityType.WeightChild_3_2:
					return "0024-3.2";
				case QualityType.WeightChild_3_3:
					return "0024-3.3";
				case QualityType.ImmunizeChild_1:
					return "0038-1";
				case QualityType.ImmunizeChild_2:
					return "0038-2";
				case QualityType.ImmunizeChild_3:
					return "0038-3";
				case QualityType.ImmunizeChild_4:
					return "0038-4";
				case QualityType.ImmunizeChild_5:
					return "0038-5";
				case QualityType.ImmunizeChild_6:
					return "0038-6";
				case QualityType.ImmunizeChild_7:
					return "0038-7";
				case QualityType.ImmunizeChild_8:
					return "0038-8";
				case QualityType.ImmunizeChild_9:
					return "0038-9";
				case QualityType.ImmunizeChild_10:
					return "0038-10";
				case QualityType.ImmunizeChild_11:
					return "0038-11";
				case QualityType.ImmunizeChild_12:
					return "0038-12";		
				case QualityType.Pneumonia:
					return "0043";
				case QualityType.DiabetesBloodPressure:
					return "0061";
				case QualityType.BloodPressureManage:
					return "0018";
				default:
					throw new ApplicationException("Type not found: "+qtype.ToString());
			}
		}
Exemple #42
0
        /// <summary>
        /// Load the Attribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            _guidExternalID = Guid.Parse(objNode["eguid"].InnerText);
            _guiID = Guid.Parse(objNode["guid"].InnerText);
            _strName = objNode["name"].InnerText;
            _strExtra = objNode["extra"].InnerText;
            _intCost = Convert.ToInt32(objNode["cost"].InnerText);
            _blnContributeToLimit = Convert.ToBoolean(objNode["contributetolimit"].InnerText);
            _blnPrint = Convert.ToBoolean(objNode["print"].InnerText);
            _objQualityType = ConvertToQualityType(objNode["qualitytype"].InnerText);
            _objQualitySource = ConvertToQualitySource(objNode["qualitysource"].InnerText);
            if (objNode["mutant"] != null)
                _strMutant = objNode["mutant"].InnerText;
            _strSource = objNode["source"].InnerText;
            _strPage = objNode["page"].InnerText;
            _nodBonus = objNode["bonus"];
            _nodConditional = objNode["conditional"];
            if (objNode["weaponguid"] != null)
                _guiWeaponID = Guid.Parse(objNode["weaponguid"].InnerText);
            _strNotes = objNode["notes"].InnerText;

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
                XmlNode objQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[id = \"" + ExternalId + "\"]");
                if (objQualityNode != null)
                {
                    if (objQualityNode["translate"] != null)
                        _strAltName = objQualityNode["translate"].InnerText;
                    if (objQualityNode["altpage"] != null)
                        _strAltPage = objQualityNode["altpage"].InnerText;
                }
            }
        }
Exemple #43
0
 /// <summary>
 /// 设置拍照黑匣子
 /// </summary>
 /// <param name="ordinal"></param>
 /// <param name="size"></param>
 /// <param name="quality"></param>
 /// <param name="count"></param>
 /// <param name="state"></param>
 /// <param name="ts"></param>
 /// <returns></returns>
 public override byte[] Capturebox(uint ordinal, SizeType size, QualityType quality, byte count, StateType state, TimeSpan ts, bool upload)
 {
     return null;
 }
Exemple #44
0
		/// <summary>
		/// Create a Quality from an XmlNode and return the TreeNodes for it.
		/// </summary>
		/// <param name="objXmlQuality">XmlNode to create the object from.</param>
		/// <param name="objCharacter">Character object the Quality will be added to.</param>
		/// <param name="objQualitySource">Source of the Quality.</param>
		/// <param name="objNode">TreeNode to populate a TreeView.</param>
		/// <param name="objWeapons">List of Weapons that should be added to the Character.</param>
		/// <param name="objWeaponNodes">List of TreeNodes to represent the Weapons added.</param>
		/// <param name="strForceValue">Force a value to be selected for the Quality.</param>
		public virtual void Create(XmlNode objXmlQuality, Character objCharacter, QualitySource objQualitySource, TreeNode objNode, List<Weapon> objWeapons, List<TreeNode> objWeaponNodes, string strForceValue = "")
		{
			_strName = objXmlQuality["name"].InnerText;
            if (objXmlQuality["metagenetic"] != null)
            {
                _strMetagenetic = objXmlQuality["metagenetic"].InnerText;
            }
			// Check for a Variable Cost.
			if (objXmlQuality["karma"].InnerText.StartsWith("Variable"))
			{
					int intMin = 0;
					int intMax = 0;
					string strCost = objXmlQuality["karma"].InnerText.Replace("Variable(", string.Empty).Replace(")", string.Empty);
					if (strCost.Contains("-"))
					{
						string[] strValues = strCost.Split('-');
						intMin = Convert.ToInt32(strValues[0]);
						intMax = Convert.ToInt32(strValues[1]);
					}
					else
						intMin = Convert.ToInt32(strCost.Replace("+", string.Empty));

					if (intMin != 0 || intMax != 0)
					{
						frmSelectNumber frmPickNumber = new frmSelectNumber();
						if (intMax == 0)
							intMax = 1000000;
						frmPickNumber.Minimum = intMin;
						frmPickNumber.Maximum = intMax;
						frmPickNumber.Description = LanguageManager.Instance.GetString("String_SelectVariableCost").Replace("{0}", DisplayNameShort);
						frmPickNumber.AllowCancel = false;
						frmPickNumber.ShowDialog();
						_intBP = frmPickNumber.SelectedValue;
					}
			}
			else
			{ 
                _intBP = Convert.ToInt32(objXmlQuality["karma"].InnerText);
            }
            if (objXmlQuality["lp"] != null)
            {
                _intLP = Convert.ToInt32(objXmlQuality["lp"].InnerText);
            }
			_objQualityType = ConvertToQualityType(objXmlQuality["category"].InnerText);
			_objQualitySource = objQualitySource;
			if (objXmlQuality["print"] != null)
			{
				if (objXmlQuality["print"].InnerText == "no")
					_blnPrint = false;
			}
			if (objXmlQuality["implemented"] != null)
			{
				if (objXmlQuality["implemented"].InnerText == "False")
					_blnImplemented = false;
			}
			if (objXmlQuality["contributetolimit"] != null)
			{
				if (objXmlQuality["contributetolimit"].InnerText == "no")
					_blnContributeToLimit = false;
			}
			_strSource = objXmlQuality["source"].InnerText;
			_strPage = objXmlQuality["page"].InnerText;
			if (objXmlQuality["mutant"] != null)
				_strMutant = "yes";

			if (_objQualityType == QualityType.LifeModule)
			{
				objXmlQuality.TryGetField("stage", out _stage);
			}

            if(objXmlQuality["id"] != null)
                _qualiyGuid = Guid.Parse(objXmlQuality["id"].InnerText);

			if (GlobalOptions.Instance.Language != "en-us")
			{
				XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
				XmlNode objQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + _strName + "\"]");
				if (objQualityNode != null)
				{
					if (objQualityNode["translate"] != null)
						_strAltName = objQualityNode["translate"].InnerText;
					if (objQualityNode["altpage"] != null)
						_strAltPage = objQualityNode["altpage"].InnerText;
				}
			}

			// Add Weapons if applicable.
			if (objXmlQuality.InnerXml.Contains("<addweapon>"))
			{
				XmlDocument objXmlWeaponDocument = XmlManager.Instance.Load("weapons.xml");

				// More than one Weapon can be added, so loop through all occurrences.
				foreach (XmlNode objXmlAddWeapon in objXmlQuality.SelectNodes("addweapon"))
				{
					XmlNode objXmlWeapon = objXmlWeaponDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + objXmlAddWeapon.InnerText + "\" and starts-with(category, \"Quality\")]");

					TreeNode objGearWeaponNode = new TreeNode();
					Weapon objGearWeapon = new Weapon(objCharacter);
					objGearWeapon.Create(objXmlWeapon, objCharacter, objGearWeaponNode, null, null, null);
					objGearWeaponNode.ForeColor = SystemColors.GrayText;
					objWeaponNodes.Add(objGearWeaponNode);
					objWeapons.Add(objGearWeapon);

					_guiWeaponID = Guid.Parse(objGearWeapon.InternalId);
				}
			}

			if (objXmlQuality.InnerXml.Contains("<naturalweapons>"))
            {
				foreach (XmlNode objXmlNaturalWeapon in objXmlQuality["naturalweapons"].SelectNodes("naturalweapon"))
				{
					TreeNode objGearWeaponNode = new TreeNode();
					Weapon objWeapon = new Weapon(_objCharacter);
					objWeapon.Name = objXmlNaturalWeapon["name"].InnerText;
					objWeapon.Category = LanguageManager.Instance.GetString("Tab_Critter");
					objWeapon.WeaponType = "Melee";
					objWeapon.Reach = Convert.ToInt32(objXmlNaturalWeapon["reach"].InnerText);
					objWeapon.Damage = objXmlNaturalWeapon["damage"].InnerText; ;
					objWeapon.AP = objXmlNaturalWeapon["ap"].InnerText; ;
					objWeapon.Mode = "0";
					objWeapon.RC = "0";
					objWeapon.Concealability = 0;
					objWeapon.Avail = "0";
					objWeapon.Cost = 0;
					objWeapon.UseSkill = objXmlNaturalWeapon["useskill"].InnerText;
					objWeapon.Source = objXmlNaturalWeapon["source"].InnerText;
					objWeapon.Page = objXmlNaturalWeapon["page"].InnerText;
					objGearWeaponNode.ForeColor = SystemColors.GrayText;
					objGearWeaponNode.Text = objWeapon.Name;
					objGearWeaponNode.Tag = objWeapon.InternalId;
					objWeaponNodes.Add(objGearWeaponNode);

					_objCharacter.Weapons.Add(objWeapon);
				}
			}

			// If the item grants a bonus, pass the information to the Improvement Manager.
			if (objXmlQuality.InnerXml.Contains("<bonus>"))
			{
				ImprovementManager objImprovementManager = new ImprovementManager(objCharacter);
				objImprovementManager.ForcedValue = strForceValue;
				if (!objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Quality, _guiID.ToString(), objXmlQuality["bonus"], false, 1, DisplayNameShort))
				{
					_guiID = Guid.Empty;
					return;
				}
				if (objImprovementManager.SelectedValue != "")
				{
					_strExtra = objImprovementManager.SelectedValue;
					objNode.Text += " (" + objImprovementManager.SelectedValue + ")";
				}
			}

			// Metatype Qualities appear as grey text to show that they cannot be removed.
			if (objQualitySource == QualitySource.Metatype || objQualitySource == QualitySource.MetatypeRemovable)
				objNode.ForeColor = SystemColors.GrayText;

			objNode.Text = DisplayName;
			objNode.Tag = InternalId;
		}
 /// <summary>
 /// Sets the quality type
 /// </summary>
 /// <param name="cardId">Unique id of the card</param>
 /// <param name="qualityType">The new quality type</param>
 public void SetQualityType(int cardId, QualityType qualityType)
 {
   if (ValidateTvControllerParams(cardId) || !SupportsQualityControl(cardId))
     return;
   IQuality qualityControl = _cards[cardId].Card.Quality;
   if (qualityControl != null)
   {
     qualityControl.QualityType = qualityType;
   }
 }
Exemple #46
0
 /// <summary>
 /// Called when playback starts
 /// </summary>
 public void StartPlayback()
 {
   if (_configuration != null)
   {
     _bitRateMode = _configuration.PlaybackQualityMode;
     _qualityType = _configuration.PlaybackQualityType;
   }
   else
   {
     _bitRateMode = VIDEOENCODER_BITRATE_MODE.NotSet;
     _qualityType = QualityType.Default;
   }
   ApplyQuality();
 }
Exemple #47
0
 /// <summary>
 /// Called when record starts
 /// </summary>
 public void StartRecord()
 {
   if (_configuration != null)
   {
     _bitRateMode = _configuration.RecordQualityMode;
     _qualityType = _configuration.RecordQualityType;
   }
   else
   {
     _bitRateMode = VIDEOENCODER_BITRATE_MODE.ConstantBitRate;
     _qualityType = QualityType.Default;
   }
   ApplyQuality();
 }
Exemple #48
0
		/// <summary>
		/// Load the Attribute from the XmlNode.
		/// </summary>
		/// <param name="objNode">XmlNode to load.</param>
		public virtual void Load(XmlNode objNode)
		{
			_guiID = Guid.Parse(objNode["guid"].InnerText);
			_strName = objNode["name"].InnerText;
			_strExtra = objNode["extra"].InnerText;
			_intBP = Convert.ToInt32(objNode["bp"].InnerText);
			//_blnImplemented = Convert.ToBoolean(objNode["implemented"].InnerText);

			objNode.TryPreserveField("implemented", ref _blnImplemented);
			_blnContributeToLimit = Convert.ToBoolean(objNode["contributetolimit"].InnerText);
			_blnPrint = Convert.ToBoolean(objNode["print"].InnerText);
			_objQualityType = ConvertToQualityType(objNode["qualitytype"].InnerText);
			_objQualitySource = ConvertToQualitySource(objNode["qualitysource"].InnerText);
            try
            {
                _strMetagenetic = objNode["metagenetic"].InnerText;
            }
            catch 
            {
            }
			try
			{
				_strMutant = objNode["mutant"].InnerText;
			}
			catch
			{
			}
			_strSource = objNode["source"].InnerText;
			_strPage = objNode["page"].InnerText;
			_nodBonus = objNode["bonus"];
			try
			{
				_guiWeaponID = Guid.Parse(objNode["weaponguid"].InnerText);
			}
			catch
			{
			}
			try
			{
				_strNotes = objNode["notes"].InnerText;
			}
			catch
			{
			}

			if (_objQualityType == QualityType.LifeModule)
			{
				objNode.TryGetField("stage", out _stage);
			}
			if (objNode["id"] != null)
			{
				Guid.TryParse(objNode["id"].InnerText, out _qualiyGuid);
			}

			if (GlobalOptions.Instance.Language != "en-us")
			{
				XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
				XmlNode objQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + _strName + "\"]");
				if (objQualityNode != null)
				{
					if (objQualityNode["translate"] != null)
						_strAltName = objQualityNode["translate"].InnerText;
					if (objQualityNode["altpage"] != null)
						_strAltPage = objQualityNode["altpage"].InnerText;
				}
			}
		}
Exemple #49
0
        /// <summary>
        /// Create a Quality from an XmlNode and return the TreeNodes for it.
        /// </summary>
        /// <param name="objXmlQuality">XmlNode to create the object from.</param>
        /// <param name="objCharacter">Character object the Quality will be added to.</param>
        /// <param name="objQualitySource">Source of the Quality.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="objWeapons">List of Weapons that should be added to the Character.</param>
        /// <param name="objWeaponNodes">List of TreeNodes to represent the Weapons added.</param>
        /// <param name="strForceValue">Force a value to be selected for the Quality.</param>
        public void Create(XmlNode objXmlQuality, Character objCharacter, QualitySource objQualitySource, TreeNode objNode, List<Weapon> objWeapons, List<TreeNode> objWeaponNodes, string strForceValue = "")
        {
            _strName = objXmlQuality["name"].InnerText;
            _intBP = Convert.ToInt32(objXmlQuality["karma"].InnerText);
            _objQualityType = ConvertToQualityType(objXmlQuality["category"].InnerText);
            _objQualitySource = objQualitySource;
            if (objXmlQuality["print"] != null)
            {
                if (objXmlQuality["print"].InnerText == "no")
                    _blnPrint = false;
            }
            if (objXmlQuality["contributetolimit"] != null)
            {
                if (objXmlQuality["contributetolimit"].InnerText == "no")
                    _blnContributeToLimit = false;
            }
            _strSource = objXmlQuality["source"].InnerText;
            _strPage = objXmlQuality["page"].InnerText;
            if (objXmlQuality["mutant"] != null)
                _strMutant = "yes";

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
                XmlNode objQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + _strName + "\"]");
                if (objQualityNode != null)
                {
                    if (objQualityNode["translate"] != null)
                        _strAltName = objQualityNode["translate"].InnerText;
                    if (objQualityNode["altpage"] != null)
                        _strAltPage = objQualityNode["altpage"].InnerText;
                }
            }

            // Add Weapons if applicable.
            if (objXmlQuality.InnerXml.Contains("<addweapon>"))
            {
                XmlDocument objXmlWeaponDocument = XmlManager.Instance.Load("weapons.xml");

                // More than one Weapon can be added, so loop through all occurrences.
                foreach (XmlNode objXmlAddWeapon in objXmlQuality.SelectNodes("addweapon"))
                {
                    XmlNode objXmlWeapon = objXmlWeaponDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + objXmlAddWeapon.InnerText + "\" and starts-with(category, \"Quality\")]");

                    TreeNode objGearWeaponNode = new TreeNode();
                    Weapon objGearWeapon = new Weapon(objCharacter);
                    objGearWeapon.Create(objXmlWeapon, objCharacter, objGearWeaponNode, null, null, null);
                    objGearWeaponNode.ForeColor = SystemColors.GrayText;
                    objWeaponNodes.Add(objGearWeaponNode);
                    objWeapons.Add(objGearWeapon);

                    _guiWeaponID = Guid.Parse(objGearWeapon.InternalId);
                }
            }

            // If the item grants a bonus, pass the information to the Improvement Manager.
            if (objXmlQuality.InnerXml.Contains("<bonus>"))
            {
                ImprovementManager objImprovementManager = new ImprovementManager(objCharacter);
                objImprovementManager.ForcedValue = strForceValue;
                if (!objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Quality, _guiID.ToString(), objXmlQuality["bonus"], false, 1, DisplayNameShort))
                {
                    _guiID = Guid.Empty;
                    return;
                }
                if (objImprovementManager.SelectedValue != "")
                {
                    _strExtra = objImprovementManager.SelectedValue;
                    objNode.Text += " (" + objImprovementManager.SelectedValue + ")";
                }
            }

            // Metatype Qualities appear as grey text to show that they cannot be removed.
            if (objQualitySource == QualitySource.Metatype || objQualitySource == QualitySource.MetatypeRemovable)
                objNode.ForeColor = SystemColors.GrayText;

            objNode.Text = DisplayName;
            objNode.Tag = InternalId;
        }
 /// <summary>
 /// 装备对应品质
 /// </summary>
 /// <param name="qualityType"></param>
 /// <returns></returns>
 public static PriorityQuality UserEquPriorityQuality(QualityType qualityType)
 {
     PriorityQuality quality = new PriorityQuality();
     switch (qualityType)
     {
         case QualityType.BaiSe:
             quality = PriorityQuality.First;
             break;
         case QualityType.LanSe:
             quality = PriorityQuality.Three;
             break;
         case QualityType.ZiSe:
             quality = PriorityQuality.Four;
             break;
         case QualityType.HuangSe:
             quality = PriorityQuality.Five;
             break;
         case QualityType.HongSe:
             quality = PriorityQuality.Six;
             break;
     }
     return quality;
 }
Exemple #51
0
 protected override object this[string index]
 {
     get
     {
         #region
         switch (index)
         {
             case "ItemID": return ItemID;
             case "ItemName": return ItemName;
             case "HeadID": return HeadID;
             case "ItemType": return ItemType;
             case "EquParts": return EquParts;
             case "QualityType": return QualityType;
             case "CareerRange": return CareerRange;
             case "DemandLv": return DemandLv;
             case "MedicineType": return MedicineType;
             case "MedicineLv": return MedicineLv;
             case "MedicineNum": return MedicineNum;
             case "PropType": return PropType;
             case "EffectNum": return EffectNum;
             case "SalePrice": return SalePrice;
             case "PackMaxNum": return PackMaxNum;
             case "ItemDesc": return ItemDesc;
             case "EnableSale": return EnableSale;
             case "IsMystery": return IsMystery;
             case "DemandEnergy": return DemandEnergy;
             case "Version": return Version;
             case "ItemPack": return ItemPack;
             case "PictrueID": return PictrueID;
             case "MysteryNum": return MysteryNum;
             case "MysteryPrice": return MysteryPrice;
             case "IsGold": return IsGold;
             case "GiftType": return GiftType;
             case "SatiationNum": return SatiationNum;
             case "AbilityType": return AbilityType;
             case "IsUse": return IsUse;
             case "MaxHeadID": return MaxHeadID;
             case "IsCostly": return IsCostly;
             case "Athletics": return Athletics;
             default: throw new ArgumentException(string.Format("ItemBaseInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
     set
     {
         #region
         switch (index)
         {
             case "ItemID":
                 _ItemID = value.ToInt();
                 break;
             case "ItemName":
                 _ItemName = value.ToNotNullString();
                 break;
             case "HeadID":
                 _HeadID = value.ToNotNullString();
                 break;
             case "ItemType":
                 _ItemType = value.ToEnum<ItemType>();
                 break;
             case "EquParts":
                 _EquParts = value.ToEnum<EquParts>();
                 break;
             case "QualityType":
                 _QualityType = value.ToEnum<QualityType>();
                 break;
             case "CareerRange":
                 _CareerRange = value.ToNotNullString();
                 break;
             case "DemandLv":
                 _DemandLv = value.ToShort();
                 break;
             case "MedicineType":
                 _MedicineType = value.ToShort();
                 break;
             case "MedicineLv":
                 _MedicineLv = value.ToShort();
                 break;
             case "MedicineNum":
                 _MedicineNum = value.ToShort();
                 break;
             case "PropType":
                 _PropType = value.ToShort();
                 break;
             case "EffectNum":
                 _EffectNum = value.ToInt();
                 break;
             case "SalePrice":
                 _SalePrice = value.ToInt();
                 break;
             case "PackMaxNum":
                 _PackMaxNum = value.ToInt();
                 break;
             case "ItemDesc":
                 _ItemDesc = value.ToNotNullString();
                 break;
             case "EnableSale":
                 _EnableSale = value.ToShort();
                 break;
             case "IsMystery":
                 _IsMystery = value.ToInt();
                 break;
             case "DemandEnergy":
                 _DemandEnergy = value.ToInt();
                 break;
             case "Version":
                 _Version = value.ToInt();
                 break;
             case "ItemPack":
                 _ItemPack =ConvertCustomField<CacheList<PrizeInfo>>(value, index);
                 break;
             case "PictrueID":
                 _PictrueID = value.ToNotNullString();
                 break;
             case "MysteryNum":
                 _MysteryNum = value.ToInt();
                 break;
             case "MysteryPrice":
                 _MysteryPrice = value.ToInt();
                 break;
             case "IsGold":
                 _IsGold = value.ToBool();
                 break;
             case "GiftType":
                 _GiftType = value.ToEnum<GiftType>();
                 break;
             case "SatiationNum":
                 _SatiationNum = value.ToShort();
                 break;
             case "AbilityType":
                 _AbilityType = value.ToEnum<AbilityType>();
                 break;
             case "IsUse":
                 _IsUse = value.ToBool();
                 break;
             case "MaxHeadID":
                 _MaxHeadID = value.ToNotNullString();
                 break;
             case "IsCostly":
                 _IsCostly = value.ToBool();
                 break;
             case "Athletics":
                 _Athletics = value.ToInt();
                 break;
             default: throw new ArgumentException(string.Format("ItemBaseInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
 }