Beispiel #1
0
 //Dispose method
 public void Dispose()
 {
     if (GenderCollection != null)
     {
         GenderCollection.Clear();
     }
     if (EmploymentCollection != null)
     {
         EmploymentCollection.Clear();
     }
     if (EducationCollection != null)
     {
         EducationCollection.Clear();
     }
     if (MaritalCollection != null)
     {
         MaritalCollection.Clear();
     }
     if (OccupationCollection != null)
     {
         OccupationCollection.Clear();
     }
     if (AccountsCollection != null)
     {
         AccountsCollection.Clear();
     }
 }
Beispiel #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <EducationInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(EducationInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <EducationInfo>);
            }
            else
            {
                List <EducationInfo> list       = new List <EducationInfo>();
                EducationCollection  collection = new  EducationCollection();
                Query qry = new Query(Education.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (Education education in collection)
                {
                    EducationInfo educationInfo = new EducationInfo();
                    LoadFromDAL(educationInfo, education);
                    list.Add(educationInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(EducationInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
        private void ButtonViewEmployee_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(selectedEmployeeId))
            {
                MessageBox.Show("Please select employee");
            }
            else
            {
                EducationCollection  selectedEduList   = new EducationCollection();
                ExperienceCollection selectedExpList   = new ExperienceCollection();
                TrainingCollection   selectedTrainList = new TrainingCollection();

                var vEmpItem   = new EmployeeItem();
                var vEduList   = new List <EducationItem>();
                var vExpList   = new List <ExperienceItem>();
                var vTrainList = new List <TrainingItem>();
                vEmpItem   = empCollection.Where(t => t._EMP_NO.Equals(selectedEmployeeId)).FirstOrDefault();
                vEduList   = selectedEduList.RetreiveEmpEducation(vEmpItem._EMP_NO);
                vExpList   = selectedExpList.RetreiveEmpExperience(vEmpItem._EMP_NO);
                vTrainList = selectedTrainList.RetreiveEmpTraining(vEmpItem._EMP_NO);
                ViewEmployeeDetails viewEmp = new ViewEmployeeDetails(vEmpItem, vEduList, vExpList, vTrainList);
                EmployeeManagement.mEmpTransitioner.Items.Add(viewEmp);
                EmployeeManagement.mEmpTransitioner.SelectedIndex = 1;
                GetAllEmployees();
            }
        }
Beispiel #4
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <EducationInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <EducationInfo> list = new List <EducationInfo>();

            Query q = Education.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            EducationCollection collection = new  EducationCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Education education  in collection)
            {
                EducationInfo educationInfo = new EducationInfo();
                LoadFromDAL(educationInfo, education);
                list.Add(educationInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
Beispiel #5
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <EducationInfo> pList, EducationCollection pCollection)
 {
     foreach (Education education in pCollection)
     {
         EducationInfo educationInfo = new EducationInfo();
         LoadFromDAL(educationInfo, education);
         pList.Add(educationInfo);
     }
 }
Beispiel #6
0
        private void GetComboBoxCollection()
        {
            GenderCollection.Add("Male");
            GenderCollection.Add("Female");

            EmploymentCollection.Add("Consultant");
            EmploymentCollection.Add("Private");
            EmploymentCollection.Add("PSFederal");
            EmploymentCollection.Add("PSLocal");
            EmploymentCollection.Add("PSState");
            EmploymentCollection.Add("SelfEmp");
            EmploymentCollection.Add("Volunteer");

            EducationCollection.Add("Associate");
            EducationCollection.Add("Bachelor");
            EducationCollection.Add("College");
            EducationCollection.Add("Doctorate");
            EducationCollection.Add("HSgrad");
            EducationCollection.Add("Master");
            EducationCollection.Add("Preschool");
            EducationCollection.Add("Professional");
            EducationCollection.Add("Vocational");
            EducationCollection.Add("Yr9");
            EducationCollection.Add("Yr10");
            EducationCollection.Add("Yr11");
            EducationCollection.Add("Yr12");
            EducationCollection.Add("Yr1t4");
            EducationCollection.Add("Yr5t6");
            EducationCollection.Add("Yr7t8");

            MaritalCollection.Add("Absent");
            MaritalCollection.Add("Divorced");
            MaritalCollection.Add("Married");
            MaritalCollection.Add("Married-spouse-absent");
            MaritalCollection.Add("Unmarried");
            MaritalCollection.Add("Widowed");

            OccupationCollection.Add("Cleaner");
            OccupationCollection.Add("Clerical");
            OccupationCollection.Add("Executive");
            OccupationCollection.Add("Farming");
            OccupationCollection.Add("Home");
            OccupationCollection.Add("Machinist");
            OccupationCollection.Add("Military");
            OccupationCollection.Add("Professional");
            OccupationCollection.Add("Protective");
            OccupationCollection.Add("Repair");
            OccupationCollection.Add("Sales");
            OccupationCollection.Add("Service");
            OccupationCollection.Add("Support");
            OccupationCollection.Add("Transport");

            AccountsCollection.Add("Canada");
            AccountsCollection.Add("China");
            AccountsCollection.Add("Columbia");
            AccountsCollection.Add("Cuba");
            AccountsCollection.Add("Ecuador");
            AccountsCollection.Add("England");
            AccountsCollection.Add("Fiji");
            AccountsCollection.Add("Germany");
            AccountsCollection.Add("Greece");
            AccountsCollection.Add("Guatemala");
            AccountsCollection.Add("Hong");
            AccountsCollection.Add("Hungary");
            AccountsCollection.Add("India");
            AccountsCollection.Add("Indonesia");
            AccountsCollection.Add("Iran");
            AccountsCollection.Add("Ireland");
            AccountsCollection.Add("Italy");
            AccountsCollection.Add("Jamaica");
            AccountsCollection.Add("Japan");
            AccountsCollection.Add("Malaysia");
            AccountsCollection.Add("Mexico");
            AccountsCollection.Add("NewZealand");
            AccountsCollection.Add("Nicaragua");
            AccountsCollection.Add("Philippines");
            AccountsCollection.Add("Poland");
            AccountsCollection.Add("Portugal");
            AccountsCollection.Add("Scotland");
            AccountsCollection.Add("Singapore");
            AccountsCollection.Add("Taiwan");
            AccountsCollection.Add("UnitedStates");
            AccountsCollection.Add("Vietnam");
            AccountsCollection.Add("Yugoslavia");
        }
Beispiel #7
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< EducationInfo> pList, EducationCollection pCollection)
 {
     foreach (Education education in pCollection)
     {
         EducationInfo educationInfo = new EducationInfo();
         LoadFromDAL(educationInfo, education );
         pList.Add(educationInfo);
     }
 }
Beispiel #8
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<EducationInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< EducationInfo> list = new List< EducationInfo>();

            Query q = Education .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            EducationCollection  collection=new  EducationCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Education  education  in collection)
            {
                EducationInfo educationInfo = new EducationInfo();
                LoadFromDAL(educationInfo,   education);
                list.Add(educationInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Beispiel #9
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<EducationInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(EducationInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< EducationInfo>;
     }
     else
     {
         List< EducationInfo>  list =new List< EducationInfo>();
         EducationCollection  collection=new  EducationCollection();
         Query qry = new Query(Education.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(Education education in collection)
         {
             EducationInfo educationInfo= new EducationInfo();
             LoadFromDAL(educationInfo,education);
             list.Add(educationInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(EducationInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }