示例#1
0
        public void CreateDefaultMedifastTestRequirements()
        {
            var defaultItems = T_MEDICALTESTREQUIREMENT.Select(new WhereClause("InsurerID is null and Active=1"));
            var trans        = new DBODataManager().BeginTransaction();

            foreach (var item in defaultItems)
            {
                item.InsurerID  = this.Config.UserInfo.CompanyID;
                item.CreatedBy  = this.Config.UserInfo.ID;
                item.ModifiedBy = this.Config.UserInfo.ID;
                trans.Insert(item);
            }
            trans.SubmitChanges();
        }
            protected override IEnumerable <MedicalTestRequirementInfo> GenerateItems()
            {
                List <T_MEDICALTESTREQUIREMENT> testRequirements = new List <T_MEDICALTESTREQUIREMENT>();
                var clientItems = T_CLIENTMEDICALTESTREQUIREMENT.Select(new WhereClause("ClientCaseID={0}", this._clientCaseID));

                if (this.Config.IsInsurer)
                {
                    testRequirements = T_MEDICALTESTREQUIREMENT.Select(new WhereClause("InsurerID={0} and Active=1", this.Config.UserInfo.CompanyID));
                    if (testRequirements.Count == 0 && T_MEDICALTESTREQUIREMENT.SelectCount(new WhereClause("InsurerID={0}", this.Config.UserInfo.CompanyID)) == 0)
                    {
                        new MediFastManager().CreateDefaultMedifastTestRequirements();
                        testRequirements = T_MEDICALTESTREQUIREMENT.Select(new WhereClause("InsurerID={0} and Active=1", this.Config.UserInfo.CompanyID));
                    }
                }
                else if (clientItems.Count() > 0)
                {
                    testRequirements = T_MEDICALTESTREQUIREMENT.Select(new WhereClause("ID in ({0}) and Active=1", clientItems.Select(item => item.MedicalTestRequirement)));
                }

                return(from testRequirement in testRequirements.OrderBy(item => item.Category).ThenBy(item => item.Name)
                       select new MedicalTestRequirementInfo(testRequirement, clientItems.FirstOrDefault(i => i.MedicalTestRequirement == testRequirement.ID)));
            }