Пример #1
0
        private void InitChildren()
        {
            List <SearchCondition> conditions = new List <SearchCondition>();

            conditions.Add(SearchCondition.CreateSearchCondition("FKEmployeeID", PKEmployeeID.ToString(), SearchComparator.Equal, SearchType.SearchString));
            conditions.Add(SearchCondition.CreateSearchCondition("IsDeleted", Convert.ToString(0), SearchComparator.Equal, SearchType.SearchNotString));
            employeeRoleList = CommonDAL <EmployeeRoleRL> .GetObjects(conditions);

            foreach (EmployeeRoleRL item in employeeRoleList)
            {
                if (item.EmployeeRole.Name.Equals("Admin"))
                {
                    isAdmin = true;
                }

                if (item.EmployeeRole.Name.Equals("Manager"))
                {
                    isManager = true;
                }
            }

            conditions.Clear();
            conditions.Add(SearchCondition.CreateSearchCondition("PKEmployeeID", FKReportManagerID.ToString(), SearchComparator.Equal, SearchType.SearchString));
            manager = CommonDAL <Employee> .GetSingleObject(conditions);
        }
Пример #2
0
        protected override void Update()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                List <SearchCondition> conditions = new List <SearchCondition>();
                conditions.Add(SearchCondition.CreateSearchCondition(GlobalParams.PKEmployeeID, PKEmployeeID.ToString(), SearchComparator.Equal, SearchType.SearchString));
                CommonDAL <Employee> .Update(this, conditions);

                //#region Transact unit test
                //throw new Exception();
                //#endregion

                foreach (EmployeeRoleRL item in employeeRoleList)
                {
                    if (item.IsNew)
                    {
                        item.FKEmployeeID = this.PKEmployeeID;
                    }
                    item.Save();
                }

                ts.Complete();
            }
        }