예제 #1
0
        public void Sync()
        {
            string      commandText = string.Format(@"
                delete [ProjectWebApp].[pub].[MSP_RESOURCES]
                    where WRES_ACCOUNT is null and RES_NAME<>'unknown';
                    
                    Select 
	                    ResourceUID, ResourceName, ResourceNTAccount,EmployeeCode
                    From 
	                    ProjectWebApp..MSP_EpmResource_UserView where ResourceNTAccount is not null"    );
            SqlCommand  sqlCommand  = new SqlCommand(commandText, new SqlConnection(_PWAConnString));
            var         dataTable   = SqlQueryExecute.GetDataTable(commandText, _PWAConnString);
            List <User> users       = PWATranslator.ToUsers(dataTable, _RASContext.Users.ToList());

            users.ForEach(entity =>
            {
                if (IsExistById(entity.ID))
                {
                    Edit(entity);
                }
                else
                {
                    Add(entity);
                }
            });
        }
        public void Sync()
        {
            string      commandText = string.Format(@"
                    Select 
	                    ResourceUID, ResourceName, ResourceNTAccount,EmployeeCode
                    From 
	                    MSP_EpmResource_UserView"    );
            SqlCommand  sqlCommand  = new SqlCommand(commandText, new SqlConnection(_PWAConnString));
            var         dataTable   = SqlQueryExecute.GetDataTable(commandText, _PWAConnString);
            List <User> users       = PWATranslator.ToUsers(dataTable, _RASContext.Users.ToList());

            users.ForEach(entity =>
            {
                if (IsExistById(entity.ID))
                {
                    Edit(entity);
                }
                else
                {
                    Add(entity);
                }
            });
        }