Esempio n. 1
0
        public int GetDefaultCostCenterID(DatabaseConnection dbConn)
        {
            if (m_CostCenterID != 0)
            {
                ECostCenter costCenter = new ECostCenter();
                costCenter.CostCenterID = m_CostCenterID;
                if (ECostCenter.db.select(dbConn, costCenter))
                {
                    return(costCenter.CostCenterID);
                }
            }
            ERosterClient rosterClient = new ERosterClient();

            rosterClient.RosterClientID = m_RosterClientID;
            if (ERosterClient.db.select(dbConn, rosterClient))
            {
                ECostCenter costCenter = new ECostCenter();
                costCenter.CostCenterID = rosterClient.CostCenterID;
                if (ECostCenter.db.select(dbConn, costCenter))
                {
                    return(costCenter.CostCenterID);
                }
            }
            return(0);
        }
Esempio n. 2
0
        public bool IsChangeSite(DatabaseConnection dbConn)
        {
            ERosterCode rosterCode = new ERosterCode();

            rosterCode.RosterCodeID = m_RosterCodeID;
            if (ERosterCode.db.select(dbConn, rosterCode))
            {
                ERosterClientSite site = new ERosterClientSite();
                site.RosterClientSiteID = rosterCode.RosterClientSiteID;
                if (ERosterClientSite.db.select(dbConn, site))
                {
                    ERosterClient client = new ERosterClient();
                    client.RosterClientID = site.RosterClientID;
                    if (ERosterClient.db.select(dbConn, client))
                    {
                        EHierarchyLevel hLevel = new EHierarchyLevel();
                        hLevel.HLevelID = client.RosterClientMappingSiteCodeToHLevelID;
                        if (EHierarchyLevel.db.select(dbConn, hLevel))
                        {
                            EEmpPositionInfo empPos = AppUtils.GetLastPositionInfo(dbConn, m_AttendanceRecordDate, m_EmpID);
                            if (empPos != null)
                            {
                                DBFilter empHierarchyFilter = new DBFilter();
                                empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID));
                                empHierarchyFilter.add(new Match("HLevelID", hLevel.HLevelID));

                                System.Collections.ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter);
                                foreach (EEmpHierarchy empHierarchy in empHierarchyList)
                                {
                                    EHierarchyElement hElement = new EHierarchyElement();
                                    hElement.HElementID = empHierarchy.HElementID;
                                    if (EHierarchyElement.db.select(dbConn, hElement))
                                    {
                                        if (!hElement.HElementCode.Trim().Equals(site.RosterClientSiteCode.Trim(), StringComparison.CurrentCultureIgnoreCase))
                                        {
                                            return(true);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }